QtPass 1.7.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
Pass Class Referenceabstract

Abstract base class for password store operations. More...

#include <pass.h>

Inheritance diagram for Pass:
Collaboration diagram for Pass:

Signals

void error (QProcess::ProcessError)
 Emitted when a process error occurs.
void startingExecuteWrapper ()
 Emitted before executing a command.
void statusMsg (const QString &msg, int timeout)
 Emit status message.
void critical (const QString &title, const QString &message)
 Emit critical error.
void processErrorExit (int exitCode, const QString &err)
 Emitted on process error exit.
void finishedAny (const QString &out, const QString &err)
 Emitted when any operation finishes.
void finishedGitInit (const QString &out, const QString &err)
 Emitted when Git init finishes.
void finishedGitPull (const QString &out, const QString &err)
 Emitted when Git pull finishes.
void finishedGitPush (const QString &out, const QString &err)
 Emitted when Git push finishes.
void finishedShow (const QString &out)
 Emitted when show finishes.
void finishedOtpGenerate (const QString &out)
 Emitted when OTP generation finishes.
void finishedInsert (const QString &out, const QString &err)
 Emitted when insert finishes.
void finishedRemove (const QString &out, const QString &err)
 Emitted when remove finishes.
void finishedInit (const QString &out, const QString &err)
 Emitted when init finishes.
void finishedMove (const QString &out, const QString &err)
 Emitted when move finishes.
void finishedCopy (const QString &out, const QString &err)
 Emitted when copy finishes.
void finishedGenerate (const QString &out, const QString &err)
 Emitted when generate finishes.
void finishedGenerateGPGKeys (const QString &out, const QString &err)
 Emitted when GPG key generation finishes.
void finishedGrep (const QList< QPair< QString, QStringList > > &results)
 Emitted when grep finishes with matching results.

Public Member Functions

 Pass ()
 Construct a Pass instance.
void init ()
 Initialize the Pass instance.
virtual void GitInit ()=0
 Initialize Git repository in password store.
virtual void GitPull ()=0
 Pull changes from remote Git repository.
virtual void GitPull_b ()=0
 Pull with rebase from remote.
virtual void GitPush ()=0
 Push changes to remote Git repository.
virtual void Show (QString file)=0
 Show decrypted password file.
virtual void OtpGenerate (QString file)=0
 Generate OTP for password file.
virtual void Insert (QString file, QString value, bool force)=0
 Insert or update password.
virtual void Remove (QString file, bool isDir)=0
 Remove password file or directory.
virtual void Move (const QString srcDir, const QString dest, const bool force=false)=0
 Move password file or directory.
virtual void Copy (const QString srcDir, const QString dest, const bool force=false)=0
 Copy password file or directory.
virtual void Init (QString path, const QList< UserInfo > &users)=0
 Initialize new password store.
virtual void Grep (QString pattern, bool caseInsensitive=false)=0
 Search password content for a pattern.
virtual auto generatePassword (unsigned int length, const QString &charset) -> QString
 Generate random password.
void GenerateGPGKeys (QString batch)
 Generate GPG keys using batch script.
auto listKeys (QStringList keystrings, bool secret=false) -> QList< UserInfo >
 List GPG keys matching patterns.
auto listKeys (const QString &keystring="", bool secret=false) -> QList< UserInfo >
 List GPG keys.
void updateEnv ()
 Update environment for subprocesses.

Static Public Member Functions

static bool gpgSupportsEd25519 ()
 Check if GPG supports Ed25519 encryption.
static QString getDefaultKeyTemplate ()
 Get default key template for new GPG keys.
static auto resolveGpgconfCommand (const QString &gpgPath) -> ResolvedGpgconfCommand
 Resolve the gpgconf command to kill agents.
static auto getGpgIdPath (const QString &for_file) -> QString
 Get .gpg-id file path for a password file.
static auto getRecipientList (const QString &for_file) -> QStringList
 Get list of recipients for a password file.
static auto getRecipientString (const QString &for_file, const QString &separator=" ", int *count=nullptr) -> QStringList
 Get recipients as string.

Protected Types

using PROCESS = Enums::PROCESS
 Alias for Enums::PROCESS used throughout this class.

Protected Slots

virtual void finished (int id, int exitCode, const QString &out, const QString &err)
 Handle process completion.

Protected Member Functions

void executeWrapper (PROCESS id, const QString &app, const QStringList &args, bool readStdout=true, bool readStderr=true)
 Execute external wrapper command.
auto generateRandomPassword (const QString &charset, unsigned int length) -> QString
 Generate random password from charset.
auto boundedRandom (quint32 bound) -> quint32
 Generate random number in range.
void setEnvVar (const QString &key, const QString &value)
 Set or remove an environment variable.
virtual void executeWrapper (PROCESS id, const QString &app, const QStringList &args, QString input, bool readStdout=true, bool readStderr=true)
 Execute wrapper with input.

Protected Attributes

Executor exec
 Internal command executor for queuing and running subprocesses.

Detailed Description

Abstract base class for password store operations.

Pass provides an abstraction layer for password management, supporting both the native 'pass' utility and gopass/imitation backends. It handles:

  • Password file operations (show, insert, remove, move, copy)
  • GPG key management and Git integration
  • OTP generation
  • Random password generation

Subclasses must implement Git and password operations.

Definition at line 50 of file pass.h.

Member Typedef Documentation

◆ PROCESS

using Pass::PROCESS = Enums::PROCESS
protected

Alias for Enums::PROCESS used throughout this class.

Definition at line 65 of file pass.h.

Member Function Documentation

◆ boundedRandom()

auto Pass::boundedRandom ( quint32 bound) -> quint32
protected

Generate random number in range.

Parameters
boundUpper bound (exclusive).
Returns
Random number.

◆ Copy()

virtual void Pass::Copy ( const QString srcDir,
const QString dest,
const bool force = false )
pure virtual

Copy password file or directory.

Parameters
srcDirSource path.
destDestination path.
forceOverwrite existing.

Implemented in ImitatePass, and RealPass.

◆ critical

void Pass::critical ( const QString & title,
const QString & message )
signal

Emit critical error.

Parameters
titleError dialog title.
messageError description.

◆ executeWrapper() [1/2]

void Pass::executeWrapper ( PROCESS id,
const QString & app,
const QStringList & args,
bool readStdout = true,
bool readStderr = true )
protected

Execute external wrapper command.

Parameters
idProcess identifier.
appExecutable path.
argsCommand arguments.
readStdoutCapture stdout.
readStderrCapture stderr.

◆ executeWrapper() [2/2]

virtual void Pass::executeWrapper ( PROCESS id,
const QString & app,
const QStringList & args,
QString input,
bool readStdout = true,
bool readStderr = true )
protectedvirtual

Execute wrapper with input.

Parameters
idProcess identifier.
appExecutable path.
argsCommand arguments.
inputInput to pass to stdin.
readStdoutCapture stdout.
readStderrCapture stderr.

Reimplemented in ImitatePass.

◆ finished

virtual void Pass::finished ( int id,
int exitCode,
const QString & out,
const QString & err )
protectedvirtualslot

Handle process completion.

Parameters
idProcess identifier.
exitCodeProcess exit code.
outStandard output.
errStandard error.

Reimplemented in ImitatePass.

◆ finishedAny

void Pass::finishedAny ( const QString & out,
const QString & err )
signal

Emitted when any operation finishes.

Parameters
outStandard output from the process.
errStandard error from the process.

◆ finishedCopy

void Pass::finishedCopy ( const QString & out,
const QString & err )
signal

Emitted when copy finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedGenerate

void Pass::finishedGenerate ( const QString & out,
const QString & err )
signal

Emitted when generate finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedGenerateGPGKeys

void Pass::finishedGenerateGPGKeys ( const QString & out,
const QString & err )
signal

Emitted when GPG key generation finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedGitInit

void Pass::finishedGitInit ( const QString & out,
const QString & err )
signal

Emitted when Git init finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedGitPull

void Pass::finishedGitPull ( const QString & out,
const QString & err )
signal

Emitted when Git pull finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedGitPush

void Pass::finishedGitPush ( const QString & out,
const QString & err )
signal

Emitted when Git push finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedGrep

void Pass::finishedGrep ( const QList< QPair< QString, QStringList > > & results)
signal

Emitted when grep finishes with matching results.

Parameters
resultsList of (entry path, matching lines) pairs.

◆ finishedInit

void Pass::finishedInit ( const QString & out,
const QString & err )
signal

Emitted when init finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedInsert

void Pass::finishedInsert ( const QString & out,
const QString & err )
signal

Emitted when insert finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedMove

void Pass::finishedMove ( const QString & out,
const QString & err )
signal

Emitted when move finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedOtpGenerate

void Pass::finishedOtpGenerate ( const QString & out)
signal

Emitted when OTP generation finishes.

Parameters
outGenerated OTP value.

◆ finishedRemove

void Pass::finishedRemove ( const QString & out,
const QString & err )
signal

Emitted when remove finishes.

Parameters
outStandard output.
errStandard error.

◆ finishedShow

void Pass::finishedShow ( const QString & out)
signal

Emitted when show finishes.

Parameters
outDecrypted password file content.

◆ GenerateGPGKeys()

void Pass::GenerateGPGKeys ( QString batch)

Generate GPG keys using batch script.

Parameters
batchGPG batch script content.

◆ generatePassword()

virtual auto Pass::generatePassword ( unsigned int length,
const QString & charset ) -> QString
virtual

Generate random password.

Parameters
lengthPassword length.
charsetCharacter set to use.
Returns
Generated password.

◆ generateRandomPassword()

auto Pass::generateRandomPassword ( const QString & charset,
unsigned int length ) -> QString
protected

Generate random password from charset.

Parameters
charsetCharacter set.
lengthPassword length.
Returns
Generated password.

◆ getDefaultKeyTemplate()

QString Pass::getDefaultKeyTemplate ( )
static

Get default key template for new GPG keys.

Returns
Default template string.
Here is the call graph for this function:

◆ getGpgIdPath()

auto Pass::getGpgIdPath ( const QString & for_file) -> QString
static

Get .gpg-id file path for a password file.

Parameters
for_filePath to password file.
Returns
Path to .gpg-id file.

◆ getRecipientList()

auto Pass::getRecipientList ( const QString & for_file) -> QStringList
static

Get list of recipients for a password file.

Parameters
for_filePath to password file.
Returns
List of recipient key IDs.

◆ getRecipientString()

auto Pass::getRecipientString ( const QString & for_file,
const QString & separator = " ",
int * count = nullptr ) -> QStringList
static

Get recipients as string.

Parameters
for_filePath to password file.
separatorSeparator between recipients.
countPointer to store recipient count.
Returns
List of recipient key IDs.

◆ GitInit()

virtual void Pass::GitInit ( )
pure virtual

Initialize Git repository in password store.

Implemented in ImitatePass, and RealPass.

◆ GitPull()

virtual void Pass::GitPull ( )
pure virtual

Pull changes from remote Git repository.

Implemented in ImitatePass, and RealPass.

◆ GitPull_b()

virtual void Pass::GitPull_b ( )
pure virtual

Pull with rebase from remote.

Implemented in ImitatePass, and RealPass.

◆ GitPush()

virtual void Pass::GitPush ( )
pure virtual

Push changes to remote Git repository.

Implemented in ImitatePass, and RealPass.

◆ gpgSupportsEd25519()

bool Pass::gpgSupportsEd25519 ( )
static

Check if GPG supports Ed25519 encryption.

Returns
true if Ed25519 is supported.

◆ Grep()

virtual void Pass::Grep ( QString pattern,
bool caseInsensitive = false )
pure virtual

Search password content for a pattern.

Parameters
patternSearch pattern (regular expression).
caseInsensitivetrue for case-insensitive search.

Implemented in ImitatePass, and RealPass.

◆ Init()

virtual void Pass::Init ( QString path,
const QList< UserInfo > & users )
pure virtual

Initialize new password store.

Parameters
pathRoot of password store.
usersList of recipient GPG keys.

Implemented in ImitatePass, and RealPass.

◆ Insert()

virtual void Pass::Insert ( QString file,
QString value,
bool force )
pure virtual

Insert or update password.

Parameters
filePath to password file.
valuePassword content to store.
forceOverwrite existing file.

Implemented in ImitatePass, and RealPass.

◆ listKeys() [1/2]

auto Pass::listKeys ( const QString & keystring = "",
bool secret = false ) -> QList< UserInfo >

List GPG keys.

Parameters
keystringSearch pattern.
secretInclude secret keys.
Returns
List of matching keys.

◆ listKeys() [2/2]

auto Pass::listKeys ( QStringList keystrings,
bool secret = false ) -> QList< UserInfo >

List GPG keys matching patterns.

Parameters
keystringsList of search patterns.
secretInclude secret keys.
Returns
List of matching keys.

◆ Move()

virtual void Pass::Move ( const QString srcDir,
const QString dest,
const bool force = false )
pure virtual

Move password file or directory.

Parameters
srcDirSource path.
destDestination path.
forceOverwrite existing.

Implemented in ImitatePass, and RealPass.

◆ OtpGenerate()

virtual void Pass::OtpGenerate ( QString file)
pure virtual

Generate OTP for password file.

Parameters
filePath to password file.

Implemented in ImitatePass, and RealPass.

◆ processErrorExit

void Pass::processErrorExit ( int exitCode,
const QString & err )
signal

Emitted on process error exit.

Parameters
exitCodeProcess exit code.
errError message or stderr output.

◆ Remove()

virtual void Pass::Remove ( QString file,
bool isDir )
pure virtual

Remove password file or directory.

Parameters
filePath to remove.
isDirtrue if removing a directory.

Implemented in ImitatePass, and RealPass.

◆ resolveGpgconfCommand()

auto Pass::resolveGpgconfCommand ( const QString & gpgPath) -> ResolvedGpgconfCommand
static

Resolve the gpgconf command to kill agents.

Parameters
gpgPathPath to gpg executable.
Returns
Resolved command with program and arguments.

◆ setEnvVar()

void Pass::setEnvVar ( const QString & key,
const QString & value )
protected

Set or remove an environment variable.

Parameters
keyVariable name including trailing '='.
valueNew value; empty string removes the variable.

◆ Show()

virtual void Pass::Show ( QString file)
pure virtual

Show decrypted password file.

Parameters
filePath to password file relative to store root.

Implemented in ImitatePass, and RealPass.

◆ statusMsg

void Pass::statusMsg ( const QString & msg,
int timeout )
signal

Emit status message.

Parameters
msgStatus text.
timeoutDisplay duration in milliseconds.

Member Data Documentation

◆ exec

Executor Pass::exec
protected

Internal command executor for queuing and running subprocesses.

Definition at line 60 of file pass.h.


The documentation for this class was generated from the following file: