|
QtPass 1.6.0
Multi-platform GUI for pass, the standard unix password manager.
|
Implementation that imitates 'pass' when the real tool is unavailable. More...
#include <imitatepass.h>
Classes | |
| class | transactionHelper |
| RAII helper for wrapping operations in transactions. More... | |
Signals | |
| void | startReencryptPath () |
| Emitted before starting re-encryption. | |
| void | endReencryptPath () |
| Emitted after finishing re-encryption. | |
| Signals inherited from Pass | |
| void | error (QProcess::ProcessError) |
| Emitted when a process error occurs. | |
| void | startingExecuteWrapper () |
| Emitted before executing a command. | |
| void | statusMsg (const QString &, int) |
| Emit status message. | |
| void | critical (const QString &, const QString &) |
| Emit critical error. | |
| void | processErrorExit (int exitCode, const QString &err) |
| Emitted on process error exit. | |
| void | finishedAny (const QString &, const QString &) |
| Emitted when any operation finishes. | |
| void | finishedGitInit (const QString &, const QString &) |
| Emitted when Git init finishes. | |
| void | finishedGitPull (const QString &, const QString &) |
| Emitted when Git pull finishes. | |
| void | finishedGitPush (const QString &, const QString &) |
| Emitted when Git push finishes. | |
| void | finishedShow (const QString &) |
| Emitted when show finishes. | |
| void | finishedOtpGenerate (const QString &) |
| Emitted when OTP generation finishes. | |
| void | finishedInsert (const QString &, const QString &) |
| Emitted when insert finishes. | |
| void | finishedRemove (const QString &, const QString &) |
| Emitted when remove finishes. | |
| void | finishedInit (const QString &, const QString &) |
| Emitted when init finishes. | |
| void | finishedMove (const QString &, const QString &) |
| Emitted when move finishes. | |
| void | finishedCopy (const QString &, const QString &) |
| Emitted when copy finishes. | |
| void | finishedGenerate (const QString &, const QString &) |
| Emitted when generate finishes. | |
| void | finishedGenerateGPGKeys (const QString &, const QString &) |
| Emitted when GPG key generation finishes. | |
Public Member Functions | |
| void | executeMoveGit (const QString &src, const QString &destFile, bool force) |
| Execute git move operation. | |
| void | gitCommit (const QString &file, const QString &msg) |
| Commit changes to git. | |
| void | executeGit (PROCESS id, const QStringList &args, QString input=QString(), bool readStdout=true, bool readStderr=true) |
| Execute git command. | |
| void | executeGpg (PROCESS id, const QStringList &args, QString input=QString(), bool readStdout=true, bool readStderr=true) |
| Execute GPG command. | |
| ImitatePass () | |
| Construct ImitatePass instance. | |
| ~ImitatePass () override=default | |
| Destructor. | |
| void | GitInit () override |
| Initialize Git repository. | |
| void | GitPull () override |
| Pull from remote. | |
| void | GitPull_b () override |
| Pull with rebase. | |
| void | GitPush () override |
| Push to remote. | |
| void | Show (QString file) override |
| Show decrypted password. | |
| void | OtpGenerate (QString file) override |
| Generate OTP. | |
| void | Insert (QString file, QString newValue, bool overwrite=false) override |
| Insert new password. | |
| void | Remove (QString file, bool isDir=false) override |
| Remove password. | |
| void | Init (QString path, const QList< UserInfo > &users) override |
| Initialize store. | |
| void | reencryptPath (const QString &dir) |
| Re-encrypt entire directory. | |
| void | Move (const QString src, const QString dest, const bool force=false) override |
| Move password file. | |
| void | Copy (const QString src, const QString dest, const bool force=false) override |
| Copy password file. | |
| Public Member Functions inherited from Pass | |
| Pass () | |
| Construct a Pass instance. | |
| void | init () |
| Initialize the Pass instance. | |
| ~Pass () override=default | |
| 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. | |
Protected Member Functions | |
| auto | verifyGpgIdFile (const QString &file) -> bool |
| Verify .gpg-id file exists and is valid. | |
| auto | removeDir (const QString &dirName) -> bool |
| Remove directory recursively. | |
| auto | checkSigningKeys (const QStringList &signingKeys) -> bool |
| Check if signing keys are valid. | |
| void | writeGpgIdFile (const QString &gpgIdFile, const QList< UserInfo > &users) |
| Write recipients to .gpg-id file. | |
| auto | signGpgIdFile (const QString &gpgIdFile, const QStringList &signingKeys) -> bool |
| Sign .gpg-id file with signing keys. | |
| void | gitAddGpgId (const QString &gpgIdFile, const QString &gpgIdSigFile, bool addFile, bool addSigFile) |
| Add .gpg-id to git staging. | |
| auto | verifyGpgIdForDir (const QString &file, QStringList &gpgIdFilesVerified, QStringList &gpgId) -> bool |
| Verify .gpg-id file for a directory. | |
| auto | createBackupCommit () -> bool |
| Create git backup commit before re-encryption. | |
| auto | getKeysFromFile (const QString &fileName) -> QStringList |
| Read recipients from file. | |
| auto | reencryptSingleFile (const QString &fileName, const QStringList &recipients) -> bool |
| Re-encrypt single file with new recipients. | |
| auto | resolveMoveDestination (const QString &src, const QString &dest, bool force) -> QString |
| Resolve destination for move operation. | |
| void | finished (int id, int exitCode, const QString &out, const QString &err) override |
| Handle process completion. | |
| void | executeWrapper (PROCESS id, const QString &app, const QStringList &args, QString input, bool readStdout=true, bool readStderr=true) override |
| Execute command wrapper. | |
| Protected Member Functions inherited from Pass | |
| 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. | |
Friends | |
| class | tst_util |
Additional Inherited Members | |
| Static Public Member Functions inherited from Pass | |
| 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 inherited from Pass | |
| using | PROCESS = Enums::PROCESS |
| Protected Attributes inherited from Pass | |
| Executor | exec |
Implementation that imitates 'pass' when the real tool is unavailable.
ImitatePass provides a complete password store implementation using direct GPG operations when 'pass' is not installed or not enabled. It handles:
This is used as a fallback when RealPass cannot be initialized.
Definition at line 23 of file imitatepass.h.
|
default |
Construct ImitatePass instance.
ImitatePass::ImitatePass for situations when pass is not available we imitate the behavior of pass https://www.passwordstore.org/.
|
overridedefault |
Destructor.
|
protected |
Check if signing keys are valid.
ImitatePass::Init initialize pass repository.
| signingKeys | List of key IDs. |
| path | path in which new password-store will be created |
| users | list of users who shall be able to decrypt passwords in path |
Definition at line 201 of file imitatepass.cpp.
|
overridevirtual |
Copy password file.
Implements Pass.
Definition at line 910 of file imitatepass.cpp.
|
protected |
Create git backup commit before re-encryption.
Definition at line 664 of file imitatepass.cpp.
|
signal |
Emitted after finishing re-encryption.
| void ImitatePass::executeGit | ( | PROCESS | id, |
| const QStringList & | args, | ||
| QString | input = QString(), | ||
| bool | readStdout = true, | ||
| bool | readStderr = true ) |
Execute git command.
ImitatePass::executeGit easy wrapper for running git commands.
| id | Process identifier. |
| args | Git arguments. |
| input | Input to stdin. |
| readStdout | Capture stdout. |
| readStderr | Capture stderr. |
| args |
Definition at line 956 of file imitatepass.cpp.
| void ImitatePass::executeGpg | ( | PROCESS | id, |
| const QStringList & | args, | ||
| QString | input = QString(), | ||
| bool | readStdout = true, | ||
| bool | readStderr = true ) |
Execute GPG command.
ImitatePass::executeGpg easy wrapper for running gpg commands.
| id | Process identifier. |
| args | GPG arguments. |
| input | Input to stdin. |
| readStdout | Capture stdout. |
| readStderr | Capture stderr. |
| args |
Definition at line 946 of file imitatepass.cpp.
| void ImitatePass::executeMoveGit | ( | const QString & | src, |
| const QString & | destFile, | ||
| bool | force ) |
Execute git move operation.
| src | Source path. |
| destFile | Destination path. |
| force | Overwrite existing. |
Definition at line 842 of file imitatepass.cpp.
|
overrideprotectedvirtual |
Execute command wrapper.
executeWrapper overrided so that every execution is a transaction
| id | |
| app | |
| args | |
| input | |
| readStdout | |
| readStderr |
Reimplemented from Pass.
Definition at line 1011 of file imitatepass.cpp.
|
overrideprotectedvirtual |
Handle process completion.
ImitatePass::finished this function is overloaded to ensure identical behaviour to RealPass ie. only PASS_* processes are visible inside Pass::finish, so that interface-wise it all looks the same.
| id | |
| exitCode | |
| out | |
| err |
Reimplemented from Pass.
Definition at line 972 of file imitatepass.cpp.
|
protected |
Read recipients from file.
| fileName | Path to file. |
Definition at line 504 of file imitatepass.cpp.
|
protected |
Add .gpg-id to git staging.
| gpgIdFile | .gpg-id file path. |
| gpgIdSigFile | Signature file path. |
| addFile | Stage .gpg-id file. |
| addSigFile | Stage signature file. |
Definition at line 316 of file imitatepass.cpp.
| void ImitatePass::gitCommit | ( | const QString & | file, |
| const QString & | msg ) |
Commit changes to git.
ImitatePass::gitCommit commit a file to git with an appropriate commit message.
| file | Changed file path. |
| msg | Commit message. |
| file | |
| msg |
Definition at line 161 of file imitatepass.cpp.
|
overridevirtual |
Initialize Git repository.
ImitatePass::GitInit git init wrapper.
Implements Pass.
Definition at line 61 of file imitatepass.cpp.
|
overridevirtual |
Pull from remote.
ImitatePass::GitPull git pull wrapper.
Implements Pass.
Definition at line 68 of file imitatepass.cpp.
|
overridevirtual |
Pull with rebase.
ImitatePass::GitPull_b git pull wrapper.
Implements Pass.
Definition at line 73 of file imitatepass.cpp.
|
overridevirtual |
Push to remote.
ImitatePass::GitPush git push wrapper.
Implements Pass.
Definition at line 80 of file imitatepass.cpp.
|
overridevirtual |
Initialize store.
Implements Pass.
Definition at line 347 of file imitatepass.cpp.
|
overridevirtual |
Insert new password.
ImitatePass::Insert create new file with encrypted content.
| file | file to be created |
| newValue | value to be stored in file |
| overwrite | whether to overwrite existing file |
Implements Pass.
Definition at line 115 of file imitatepass.cpp.
|
overridevirtual |
Move password file.
Implements Pass.
Definition at line 874 of file imitatepass.cpp.
|
overridevirtual |
Generate OTP.
ImitatePass::OtpGenerate generates an otp code.
Implements Pass.
Definition at line 99 of file imitatepass.cpp.
| void ImitatePass::reencryptPath | ( | const QString & | dir | ) |
Re-encrypt entire directory.
Re-encrypts all .gpg files under the given directory using the verified GPG key configuration for each folder.
| dir | Directory path. |
This method optionally pulls the latest changes before starting, creates a backup commit, verifies .gpg-id files per directory, and re-encrypts files whose current recipients do not match the expected keys. It emits progress, status, and error signals throughout the process, and optionally pushes the updated password-store when finished.
| dir | - Root directory to scan recursively for .gpg files. |
Definition at line 705 of file imitatepass.cpp.
|
protected |
Re-encrypt single file with new recipients.
| fileName | File to re-encrypt. |
| recipients | New recipient key IDs. |
Definition at line 550 of file imitatepass.cpp.
|
overridevirtual |
Remove password.
ImitatePass::Remove custom implementation of "pass remove".
Implements Pass.
Definition at line 172 of file imitatepass.cpp.
|
protected |
Remove directory recursively.
ImitatePass::removeDir delete folder recursive.
| dirName | Directory path. |
| dirName | which folder. |
Definition at line 443 of file imitatepass.cpp.
|
protected |
Resolve destination for move operation.
| src | Source path. |
| dest | Destination path. |
| force | Overwrite existing. |
Definition at line 784 of file imitatepass.cpp.
|
overridevirtual |
Show decrypted password.
ImitatePass::Show shows content of file.
Implements Pass.
Definition at line 89 of file imitatepass.cpp.
|
protected |
Sign .gpg-id file with signing keys.
| gpgIdFile | Path to .gpg-id file. |
| signingKeys | Key IDs to sign with. |
Definition at line 270 of file imitatepass.cpp.
|
signal |
Emitted before starting re-encryption.
|
protected |
Verify .gpg-id file exists and is valid.
ImitatePass::verifyGpgIdFile verify detached gpgid file signature.
| file | Path to check. |
| file | which gpgid file. |
Definition at line 399 of file imitatepass.cpp.
|
protected |
Verify .gpg-id file for a directory.
ImitatePass::reencryptPath reencrypt all files under the chosen directory.
| file | Password file path. |
| gpgIdFilesVerified | List of already verified .gpg-id files. |
| gpgId | Output parameter for recipient key IDs. |
This is still quite experimental..
| dir |
Definition at line 474 of file imitatepass.cpp.
|
protected |
Write recipients to .gpg-id file.
Writes the selected users' GPG key IDs to a .gpg-id file.
| gpgIdFile | Path to .gpg-id file. |
| users | List of recipients. |
Opens the specified file for writing, stores the key ID of each enabled user on a separate line, and warns if none of the selected users has a secret key available.
| QString | &gpgIdFile - Path to the .gpg-id file to be written. |
| QList<UserInfo> | &users - List of users to evaluate and write to the file. |
Definition at line 233 of file imitatepass.cpp.
|
friend |
Definition at line 26 of file imitatepass.h.