|
| void | idle () |
| | Nothing of the store's runs or waits any more (isIdle()).
|
| void | startingExecuteWrapper () |
| | Emitted each time a queued process is about to start, and by the refusals that go on to emit processErrorExit().
|
| void | statusMsg (const QString &msg, int timeout) |
| | Progress or a non-fatal problem worth a line in the status bar ("Creating backup commit", "Git pull failed: ...").
|
| void | critical (const QString &title, const QString &message) |
| | Something went wrong that the user has to be told about in a dialog, such as a refused path or a failed backup commit.
|
| void | processErrorExit (int exitCode, const QString &err) |
| | An operation ended in failure: its process exited non-zero, could not be started or crashed, or the operation was refused.
|
| void | finishedAnyWithPid (const QString &out, const QString &err, Enums::PROCESS pid) |
| | A process of any kind finished successfully and its output cannot contain a secret.
|
| void | finishedGitInit (const QString &out, const QString &err) |
| | git init in the store succeeded; the store is a repository now and the tree is re-read.
|
| void | finishedGitPull (const QString &out, const QString &err) |
| | git pull succeeded; entries may have changed on disk.
|
| void | finishedGitPush (const QString &out, const QString &err) |
| | git push succeeded.
|
| void | finishedShow (const QString &out, const QString &file) |
| | Emitted when a Show() succeeds.
|
| void | finishedInsert (const QString &out, const QString &err) |
| | An Insert() succeeded: the entry is in the store and, with Git in use, committed.
|
| void | finishedRemove (const QString &out, const QString &err) |
| | A Remove() succeeded; the entry or folder is gone from the store.
|
| void | finishedInit (const QString &out, const QString &err) |
| | An Init() succeeded: the folder's .gpg-id holds the new recipient list.
|
| void | finishedMove (const QString &out, const QString &err) |
| | A Move() succeeded; the entry or folder is under its new name.
|
| void | finishedCopy (const QString &out, const QString &err) |
| | A Copy() succeeded; the copy exists beside the original.
|
| void | finishedGenerateGPGKeys (const QString &out, const QString &err) |
| | GenerateGPGKeys() succeeded; the new key pair is in the keyring.
|
| void | generateGPGKeysFailed (const QString &err) |
| | Emitted when GPG key generation fails, alongside the generic processErrorExit(); lets the keygen dialog react to its own failure only, not to any other command failing meanwhile.
|
| void | insertFailed (const QString &err, bool written) |
| | Emitted when an Insert() fails through a queued command, before the generic processErrorExit(): the process exited non-zero, crashed or could not be started, or the entry could not be put in place afterwards. Lets the password dialog keep what was typed and say why, without reacting to any other command failing meanwhile. An insert refused before anything is queued does not emit it.
|
| void | finishedGrep (const QList< QPair< QString, QStringList > > &results) |
| | The newest Grep() is over; an empty list means no entry matched.
|
|
| | Pass () |
| | Construct a Pass instance.
|
| void | init (const AppSettings &settings) |
| | Initialize the Pass instance with a settings snapshot.
|
| 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 | Insert (QString file, QString value, bool force)=0 |
| | Insert or update password.
|
| auto | insertsPending () const -> int |
| | How many inserts have started queueing but not yet reported.
|
| 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)=0 |
| | Move password file or directory.
|
| virtual void | Copy (const QString srcDir, const QString dest, const bool force)=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)=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.
|
| auto | recipientsForEditing (const QString &dir, const QString &passStore) -> RecipientsForEditing |
| | The recipients a dialog may preselect for editing the list of dir.
|
| auto | isIdle () const -> bool |
| | Whether no gpg, git or pass of this backend runs or waits.
|
|
| static bool | gpgSupportsEd25519 (const QString &gpgExecutable={}) |
| | Check if GPG supports Ed25519 encryption.
|
| static QString | getDefaultKeyTemplate (const QString &gpgExecutable={}) |
| | Get default key template for new GPG keys.
|
| static auto | maxOutputArgs () -> QStringList |
| | The gpg options that enforce kMaxPlaintextBytes.
|
| static auto | resolveGpgconfCommand (const QString &gpgPath) -> ResolvedGpgconfCommand |
| | Resolve the gpgconf command to kill agents.
|
| static auto | getGpgIdPath (const QString &for_file, const QString &passStore) -> QString |
| | Get .gpg-id file path for a password file.
|
| static auto | skippedGpgId (const QString &forFile, const QString &passStore, QString *recordError=nullptr) -> std::optional< QString > |
| | The folder list getGpgIdPath() passed over on its way up to the one it returns, if it passed one over that a signed store must not.
|
| static auto | getRecipientList (const QString &for_file, const QString &passStore) -> QStringList |
| | Get list of recipients for a password file.
|
| static auto | parseRecipients (const QByteArray &contents, const QString &sourceName) -> QStringList |
| | Parse the contents of a .gpg-id: one recipient per line, # starts a comment, unusable lines are logged and skipped.
|
| static auto | loggableArgs (const QStringList &args) -> QStringList |
| | The arguments as they may appear in the debug log: the value of --passphrase and friends, and otpauth URIs, are replaced.
|
| static auto | seedGpgIdFile (const QString &newDir, const QString &passStore) -> bool |
| | Seed a new folder's .gpg-id from the recipients it inherits.
|
|
| auto | storeEnvironment () const -> QProcessEnvironment |
| | The environment QtPass runs the store's processes in.
|
| auto | withCurrentGitPin (QProcessEnvironment base) const -> QProcessEnvironment |
| | base with GIT_DIR and GIT_WORK_TREE as the store is now (Util::gitStoreVariables()), not as it was at updateEnv(): a .git that appeared or changed hands since then is judged when Git runs.
|
| auto | refuseSkippedGpgId (const QString &file, bool signing, const QString &except=QString()) -> bool |
| | With signing on, refuse to encrypt file when the lookup passed over its folder's own list (skippedGpgId()): the parent's list is not what was signed for it.
|
| auto | verifySignedList (const GpgIdSigner &signer, const QString &gpgIdFile, QByteArray *contents, QString *why) const -> bool |
| | Whether gpgIdFile is a signed list QtPass accepts: its signature verifies (GpgIdSigner::verifyFile()), and it is current and bound to the folder it lies in (GpgIdGeneration::accept()), so an older authentic list put back, or one signed for another folder, is refused.
|
| virtual auto | insertWritten (const QString &err) const -> bool |
| | Whether the insert that just failed had put its entry in the store before a later step failed. The backend that writes the entry knows; this default says no.
|
| void | queueShow (const QString &file) |
| | Remember what a Show() asked for, so its completion can say so.
|
| void | queueInsert () |
| | Count one insert that has started queueing but not yet reported.
|
| auto | refuseLinkedPath (const QString &path, LinkScope scope=LinkScope::EntryAndParents, PathSpelling spelling=PathSpelling::Configured) -> bool |
| | Refuse an operation on something that is, or lies behind, a symbolic link or NTFS junction inside the store.
|
| auto | refuseFolderOutsideStore (const QString &folder, QString *relative=nullptr) -> bool |
| | Refuse recipients for a folder outside the store, as pass refuses a path with .. in it.
|
| virtual auto | storeGit (const QStringList &args, QString *out) -> bool |
| | Run a git command in the store's repository, blocking.
|
| auto | refuseUnfinishedGitOperation () -> bool |
| | Refuse to change the store while git is mid-rebase, -merge, -cherry-pick or -revert.
|
| auto | unfinishedGitOperationReason () -> QString |
| | The unfinished git operation in progress in the store, if any.
|
| auto | refusePendingPull () -> bool |
| | Refuse a store change while a Git pull is still queued or running.
|
| 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 &name, const QString &value) |
| | Set or remove an environment variable.
|
| void | executeWrapper (PROCESS id, const QString &app, const QStringList &args, QString input, bool readStdout, bool readStderr) |
| | Execute wrapper with input.
|
| virtual void | beforeExecute (PROCESS id) |
| | Hook invoked just before a wrapped command is dispatched.
|
|
| void | handleProcessError (PROCESS pid, int exitCode, const QString &out, const QString &err) |
| | Report a process that exited non-zero; called by finished().
|
| auto | formatInsertError (const QString &friendly, const QString &err) -> QString |
| | Put the translated reason for a failed insert above what gpg itself printed, leaving out the machine-readable [GNUPG:] lines.
|
| void | emitProcessFinishedSignal (PROCESS pid, const QString &out, const QString &err) |
| | Emit the signals for a process that exited with 0; called by finished() for everything but PASS_SHOW.
|
| void | refuseAsNotPartOfStore (const QString &why) |
| | Refuse an operation on something that is not part of the store.
|
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.
Paths: the operations take a path relative to the store, or an absolute path spelled from the store as configured (passStore), as the store tree and the dialogs build them. The link checks, pass names and Git paths are worked out against that spelling. A path spelled through the target of a store root that is itself a link is not under the store as named. Init() places such a folder from its canonical path; the other operations would check only the entry itself for a link and give pass and Git ../ names, so callers must not hand one over. Resolving every link instead is no way out: a removal would then reach a link's target, not the link.
Definition at line 75 of file pass.h.
| void Pass::processErrorExit |
( |
int | exitCode, |
|
|
const QString & | err ) |
|
signal |
An operation ended in failure: its process exited non-zero, could not be started or crashed, or the operation was refused.
The counterpart of the finished... signals for an operation that queued a command: it ends in one or the other. The main window releases the busy state and shows err in the password pane. One case emits both: when RealPass has removed a linked folder but could not commit that, this signal is followed by finishedRemove(), because the store did change.
Before anything is queued the paths differ, so a caller must not wait for this signal after every call. A path behind a link and an unfinished Git operation are refused with startingExecuteWrapper(), critical() and this signal. Other early checks, such as an entry that already exists, emit critical() alone and return.
insertFailed() and generateGPGKeysFailed() are emitted before this signal whenever their operation fails through a queued command, be it a non-zero exit, a crash or a process that could not be started, so their dialogs need not guess whose failure it is. generateGPGKeysFailed() also comes first when no gpg executable is configured and nothing is queued at all. A refusal that reaches this signal without queuing anything emits neither of them.
- Parameters
-
| exitCode | Exit code of the process; -1 when it did not exit normally, 1 for a refusal. |
| err | What to show the user: stderr, or a translated message. |
| auto Pass::recipientsForEditing |
( |
const QString & | dir, |
|
|
const QString & | passStore ) -> RecipientsForEditing |
The recipients a dialog may preselect for editing the list of dir.
With a signing key configured, only a list whose signature, generation and folder binding are all accepted: the Users dialog preselects what it loads and OK writes and signs the selection, so a list read unauthenticated would turn an attacker's unsigned edit into a genuinely signed one with one click. The one exception is an authentic list the generation record calls older (the recovery from a rollback goes through this dialog): preselected, with the reason shown for review. Anything else that fails preselects nothing and says why. Without a signing key, the list as it is.
- Parameters
-
| dir | Folder whose list is edited; empty for the store root. |
| passStore | The store the folder belongs to: the dialog's, which for a profile being set up is not this backend's. |
- Returns
- The state, the recipients to preselect and the warning to show.
Definition at line 1068 of file pass.cpp.
Refuse an operation on something that is, or lies behind, a symbolic link or NTFS junction inside the store.
The store tree shows a linked entry or folder like any other, and gpg, pass and QFile all follow links, so without this a planted link would have an entry shown, edited, copied or written outside the store, with the store's recipients. The configured store root itself may be a link (a synced folder); that is not judged.
- Parameters
-
| path | Store-relative (as Show/Insert/Remove get it, .gpg included where it applies) or absolute (as Move/Copy get it). |
| scope | Whether the entry itself counts, or only the folders it lies in (a removal). |
| spelling | Whether path follows the class's path rule, or the caller places a target-spelled path itself (Init()). |
- Returns
- true when critical() and processErrorExit() were emitted and the caller must stop.
Definition at line 791 of file pass.cpp.
| auto Pass::refusePendingPull |
( |
| ) |
-> bool |
|
protected |
Refuse a store change while a Git pull is still queued or running.
An operation checks the repository when it is requested, but a pull queued before it (the asynchronous Update) has not run yet, so a conflict it will cause is not visible. For operations that commit without a later point to re-check (every delete, move and copy, and the pass backend, whose single pass insert commits by itself), refuse while the pull is in flight so the change cannot land in the conflict it leaves. Nothing is refused when Git is off or no pull is pending.
- Returns
- true when critical() and processErrorExit() were emitted and the caller must stop.
Definition at line 883 of file pass.cpp.
| auto Pass::refuseUnfinishedGitOperation |
( |
| ) |
-> bool |
|
protected |
Refuse to change the store while git is mid-rebase, -merge, -cherry-pick or -revert.
A pull that stopped in a conflict leaves the repository part-way through an operation. Committing a save or a re-encryption into it lands the change on a detached HEAD (a later git rebase --abort drops it) or concludes the merge in favour of the local copy (pushing over a colleague's change). Every store-changing operation calls this at its entry, next to refuseLinkedPath(), so the change is refused before gpg or pass runs and the dialog keeps what was typed. Nothing is refused when git is off, the store is not a repository, or git gives no answer. A HEAD detached by hand (no operation in progress) is deliberately accepted.
- Returns
- true when critical() and processErrorExit() were emitted and the caller must stop.
Definition at line 898 of file pass.cpp.
| auto Pass::skippedGpgId |
( |
const QString & | forFile, |
|
|
const QString & | passStore, |
|
|
QString * | recordError = nullptr ) -> std::optional< QString > |
|
static |
The folder list getGpgIdPath() passed over on its way up to the one it returns, if it passed one over that a signed store must not.
getGpgIdPath() skips a .gpg-id that is missing, a link or a junction and falls back to a parent folder's list, as pass does. In a signed store that lets anyone who can write to it, without the signing key, move a folder's entries to the parent's (also validly signed) recipients by removing or linking the folder's own list. This names the first such list between the start and the folder of the list found (that folder and the store root excluded): one that is under the name but not a regular file, or one that is gone although this device has accepted a list at that path before (GpgIdGeneration::remembered()). When the generation record cannot be read, whether a list was accepted at a path cannot be told: the first folder without its own list is named then too (fail closed), and recordError says why.
- Parameters
-
| forFile | Entry or folder, as for getGpgIdPath(). |
| passStore | Root directory of the password store. |
| recordError | Receives the record's error when it could not be read, if not null; left untouched otherwise. |
- Returns
- The skipped .gpg-id path, or nothing when the list found is the one that applies.
Definition at line 982 of file pass.cpp.
| auto Pass::unfinishedGitOperationReason |
( |
| ) |
-> QString |
|
protected |
The unfinished git operation in progress in the store, if any.
The detection behind refuseUnfinishedGitOperation(), without emitting a refusal: a backend re-checks it when a save's gpg step has finished (a pull queued before the save, from the asynchronous Update, may have finished and left a conflict meanwhile) so the entry is not placed or committed into the operation.
- Returns
- A ready-to-show reason naming the operation (rebase, merge, cherry-pick or revert), or an empty string when none is in progress, git is off, or the store is not a repository.
Definition at line 835 of file pass.cpp.