QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
imitatepass.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2016 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#ifndef SRC_IMITATEPASS_H_
9#define SRC_IMITATEPASS_H_
10
11#include "gpgidsigner.h"
12#include "nativegrep.h"
13#include "pass.h"
14#include "simpletransaction.h"
15#include <QQueue>
16#include <QSet>
17#include <QTemporaryDir>
18
19#include <atomic>
20#include <memory>
21#include <optional>
22
23class QRegularExpression;
24class QThread;
25
41class ImitatePass : public Pass {
42 Q_OBJECT
43
44 friend class tst_util;
45 friend class tst_imitatepass;
46
47protected:
54 auto gpgIdSigner() -> GpgIdSigner;
71 auto loadVerifiedRecipients(const QString &gpgIdFile, QStringList *recipients,
72 QString *why = nullptr) -> bool;
85 auto writeGpgIdFile(const QString &gpgIdFile, const QList<UserInfo> &users,
86 QByteArray *written = nullptr) -> bool;
95 auto signGpgIdFile(const QString &gpgIdFile, const QByteArray &contents)
96 -> bool;
103 auto refuseLinkedGpgIdFolder(const QString &path) -> bool;
111 auto recipientsForEntry(const QString &file, QStringList *recipients) -> bool;
121 auto copyDestination(const QString &src, const QString &dest, bool force)
122 -> QString;
134 auto addGenerationHeader(const QString &gpgIdFile, const GpgIdSigner &signer,
135 QByteArray *contents) -> bool;
147 auto settleSignature(const QString &gpgIdFile, const QByteArray &written,
148 const GpgIdSigner &signer, bool useGit,
149 QString *sigToCommit) -> bool;
162 auto gitAddGpgId(const QString &gpgIdFile, const QString &gpgIdSigFile,
163 QString *out, QString *err) -> int;
172 [[nodiscard]] auto commitName(const QString &path) const -> QString;
178 auto gitTracks(const QString &file) -> bool;
184 auto commitArgs() -> QStringList;
195 auto verifyGpgIdForDir(const QString &file,
196 QHash<QString, QStringList> &verified,
197 QStringList &gpgId) -> bool;
202 auto createBackupCommit() -> bool;
208 auto getKeysFromFile(const QString &fileName) -> QStringList;
217 auto primaryKeysOf(const QStringList &ids, QHash<QString, QString> &primaries,
218 QHash<QString, QString> &names) -> QSet<QString>;
231 auto keysEncryptedTo(const QStringList &recipients,
232 QHash<QString, QString> &primaries,
233 QHash<QString, QString> &names, bool lookUp = true)
234 -> std::optional<QSet<QString>>;
241 auto entryHash(const QString &file) const -> QByteArray;
251 auto reencryptSingleFile(const QString &fileName,
252 const QStringList &recipients, QString *why) -> bool;
266 auto decryptEntry(const QString &fileName, QByteArray *plaintext,
267 QString *why) -> bool;
275 auto encryptFor(const QString &output, const QStringList &recipients,
276 const QByteArray &plaintext) -> bool;
285 auto ciphertextHolds(const QString &ciphertext, const QByteArray &plaintext)
286 -> bool;
294 auto commitReencrypted(const QString &fileName) -> bool;
302 auto resolveMoveDestination(const QString &src, const QString &dest,
303 bool force) -> QString;
304
305public:
312 void executeMoveGit(const QString &src, const QString &destFile, bool force);
313
319 void gitCommit(const QString &file, const QString &msg);
326 void gitCommit(const QStringList &files, const QString &msg);
327
336 void executeGit(PROCESS id, const QStringList &args,
337 QString input = QString(), bool readStdout = true,
338 bool readStderr = true);
343 auto gitConfigured() const -> bool;
349 auto gitReady() -> bool;
358 void executeGpg(PROCESS id, const QStringList &args,
359 QString input = QString(), bool readStdout = true,
360 bool readStderr = true);
361
387
388protected:
391 QProcessEnvironment m_reencryptEnv;
410 [[nodiscard]] auto execBlocking(const QString &app, const QStringList &args,
411 const QString &input = QString(),
412 QString *process_out = nullptr,
413 QString *process_err = nullptr) -> int;
422 [[nodiscard]] auto execBlocking(const QString &app, const QStringList &args,
423 QString *process_out,
424 QString *process_err = nullptr) -> int;
434 [[nodiscard]] auto execBlockingRaw(const QString &app,
435 const QStringList &args,
436 const QByteArray &input,
437 QByteArray *process_out) -> int;
445 auto prepareBlocking(QProcess &process) -> const std::atomic_bool *;
452 auto storeGit(const QStringList &args, QString *out) -> bool override;
460 void finished(int id, int exitCode, const QString &out,
461 const QString &err) override;
462
469 [[nodiscard]] auto insertWritten(const QString &err) const -> bool override {
470 Q_UNUSED(err);
471 return m_insertPlaced;
472 }
473
481 void beforeExecute(PROCESS id) override;
482
483public:
487 ImitatePass();
492 ~ImitatePass() override;
493
494 // Git operations
498 void GitInit() override;
502 void GitPull() override;
507 void GitPull_b(int timeoutMs) override;
514 void GitPush() override;
515
516 // Password operations
521 void Show(QString file) override;
528 void Insert(QString file, QString newValue, bool overwrite) override;
529 auto readersAnEditWouldAdd(const QString &file) -> EditReaders override;
535 void Remove(QString file, bool isDir) override;
548 void Init(QString path, const QList<UserInfo> &users) override;
549
550protected:
557 auto fullKeyListing(QString *listing) -> int override;
558
559public:
573 void reencryptPath(const QString &dir);
585 void reencryptPath(const QString &dir, const AppSettings &settings);
601 void cancelReencryptPath();
616 void reencryptAlso(const QString &dir, const QStringList &files,
617 const AppSettings &settings);
618
619signals:
643 void reencryptProgress(int current, int total);
656 void unexpectedRecipients(const QString &dir, const QStringList &files,
657 const QStringList &details);
658
659 // Pass interface
660public:
673 void Move(const QString src, const QString dest, const bool force) override;
680 void Copy(const QString src, const QString dest, const bool force) override;
690 void Grep(QString pattern, bool caseInsensitive) override;
694 void CancelGrep() override { m_grep.cancel(); }
695
696private:
703 struct PendingMove {
704 QString src;
705 QString destFile;
706 QString fromList;
708 std::optional<bool> landed;
709 };
710
711 QQueue<PendingMove> m_pendingMoves;
727 void sendDeferredPush();
735 void reencryptMoved(const PendingMove &move);
744 auto refuseOverlappingMove(const QString &src, const QString &destFile)
745 -> bool;
753
760 std::shared_ptr<QTemporaryDir> scratch;
762 QString output;
764 QString file;
766 bool overwrite = false;
767 };
768
769 QQueue<PendingInsert> m_pendingInserts;
774 bool m_insertPlaced = false;
775
791 auto placeEncryptedFile(const QString &output, const QString &file,
792 bool overwrite, QString *error) -> bool;
802 auto placePendingInsert(int exitCode, QString *error) -> int;
803
808 struct ReencryptResult;
810 bool m_reencryptActive = false;
817 bool m_reencryptPushing = false;
823 std::atomic<bool> m_reencryptCancel{false};
828 QThread *m_reencryptThread = nullptr;
833 void startReencryptWorker(const QString &dir);
839 auto reencryptFiles(const QString &dir) -> ReencryptResult;
841 struct ListKeys;
843 struct WhoReads;
845 struct ReaderChange;
855 auto startReencryptRun(const QString &dir, ReencryptResult &result) -> bool;
864 [[nodiscard]] auto isTrustedEntry(const QString &fileName,
865 const QSet<QString> &listNow) const -> bool;
873 auto listKeysFor(const QString &gpgIdPath, const QStringList &gpgId,
874 WhoReads &who) -> const ListKeys &;
885 auto readerChangeOf(const QString &fileName, const QStringList &keys,
886 const ListKeys &lk, WhoReads &who) -> ReaderChange;
893 static auto namedReaders(const QSet<QString> &fprs,
894 const QHash<QString, QString> &names) -> QString;
906 auto holdForAgreement(const QString &fileName, const QStringList &keys,
907 const ReaderChange &change, const WhoReads &who,
908 ReencryptResult &result) -> bool;
919 auto reencryptEntry(const QString &fileName, const QStringList &gpgId,
920 WhoReads &who, ReencryptResult &result) -> bool;
928 auto pullBeforeReencrypt() -> bool;
938 auto entriesToReencrypt(const QString &dir, QStringList *failed)
939 -> QStringList;
948 auto recipientsForDir(const QString &fileName,
949 QHash<QString, QStringList> &verified,
950 QStringList &gpgId, ReencryptResult &result) -> bool;
964 auto recoverReencryptLeftovers(const QString &dir) -> bool;
971 void dropStaleTemporary(const QString &path);
980 auto restoreBackup(const QString &path, QStringList &problems) -> bool;
987 void reportUnrestorable(const QString &path, QStringList &problems);
992 void finishReencrypt(const ReencryptResult &result);
998 void reportFailedEntries(const QStringList &failed);
1010 auto settleAutoPushHold(const ReencryptResult &result, bool agreedRun)
1011 -> bool;
1019 void reportReencryptOutcome(const ReencryptResult &result, bool stillRead);
1026 void rememberUnexpected(const ReencryptResult &result);
1027
1032 QString folder;
1033 QString gitError;
1034 };
1035
1040 std::optional<UncommittedGpgId> m_uncommittedGpgId;
1046 QString file;
1047 QByteArray bytes;
1048 };
1049
1054 std::optional<WrittenGpgId> m_writtenGpgId;
1063 QString gpgIdFile;
1064 QStringList recipients;
1065 };
1066
1068 std::optional<PreviousList> m_previousList;
1078 auto refuseInitBeforeWrite(const QString &gpgIdFile,
1079 const GpgIdSigner &signer) -> bool;
1089 auto previousListOf(const QString &path, const QString &gpgIdFile)
1090 -> std::optional<PreviousList>;
1099 void keepPreviousList(const QString &gpgIdFile,
1100 const std::optional<PreviousList> &previous);
1112 void reencryptAfterFailedCommit(const QString &path, int gitExit,
1113 const QString &gitOut, const QString &gitErr,
1114 const QString &gpgIdFile,
1115 const std::optional<PreviousList> &previous);
1122 struct Agreed {
1123 QByteArray hash;
1124 QSet<QString> readers;
1125 };
1126
1129 QHash<QString, Agreed> m_reencryptAgreed;
1132 QHash<QString, Agreed> m_lastUnexpected;
1138 QHash<QString, QSet<QString>> m_removedReaders;
1144 auto reencryptUsesGit() const -> bool;
1152 void reencryptWithoutGit(const QString &dir, const QString &gitError);
1162 void reportUncommittedGpgId(const QString &dir, const QString &gitError,
1163 bool reencrypted);
1164
1172 auto translatePathForWsl(const QString &path, const QString &exe) const
1173 -> QString;
1180 auto pgit(const QString &path) const -> QString;
1187 auto pgpg(const QString &path) const -> QString;
1188};
1189
1190#endif // SRC_IMITATEPASS_H_
The detached signature on a store's .gpg-id: whether the configured signing key is usable,...
Definition gpgidsigner.h:29
TransactionHelper(SimpleTransaction *trans, PROCESS result)
Start transaction.
~TransactionHelper()
End transaction on destruction.
SimpleTransaction * m_transaction
The transaction being bracketed; not owned.
PROCESS m_result
What the transaction reports as once its last step ends.
Implementation that imitates 'pass' when the real tool is unavailable.
Definition imitatepass.h:41
auto commitReencrypted(const QString &fileName) -> bool
Stage and commit a re-encrypted entry, when the store is a Git repository QtPass manages.
auto reencryptEntry(const QString &fileName, const QStringList &gpgId, WhoReads &who, ReencryptResult &result) -> bool
Check one entry and re-encrypt it to gpgId when it is not encrypted to those keys yet,...
QHash< QString, Agreed > m_reencryptAgreed
auto prepareBlocking(QProcess &process) -> const std::atomic_bool *
Give process the environment for the calling thread: the store's on the owning thread,...
auto createBackupCommit() -> bool
Create git backup commit before re-encryption.
auto previousListOf(const QString &path, const QString &gpgIdFile) -> std::optional< PreviousList >
The verified list the entries of path were encrypted to before Init() replaces it,...
auto primaryKeysOf(const QStringList &ids, QHash< QString, QString > &primaries, QHash< QString, QString > &names) -> QSet< QString >
The primary keys behind key IDs from an entry (ENC_TO).
void finishReencrypt(const ReencryptResult &result)
Report the outcome of a run and emit endReencryptPath().
void Remove(QString file, bool isDir) override
Remove password.
bool m_insertPlaced
QString m_transactionOutput
stdout of the steps of the transaction in flight, collected by finished() and handed on,...
auto execBlocking(const QString &app, const QStringList &args, const QString &input=QString(), QString *process_out=nullptr, QString *process_err=nullptr) -> int
Executor::executeBlocking() for the re-encryption helpers.
auto refuseOverlappingMove(const QString &src, const QString &destFile) -> bool
Refuse a move of src to destFile that touches what an earlier move or a re-encryption still has to se...
void GitInit() override
Initialize Git repository.
auto recipientsForEntry(const QString &file, QStringList *recipients) -> bool
The recipients to encrypt file to: its folder's .gpg-id, verified when a signing key is set.
void executeGpg(PROCESS id, const QStringList &args, QString input=QString(), bool readStdout=true, bool readStderr=true)
Execute GPG command.
auto reencryptSingleFile(const QString &fileName, const QStringList &recipients, QString *why) -> bool
Re-encrypt single file with new recipients.
void reportUncommittedGpgId(const QString &dir, const QString &gitError, bool reencrypted)
Tell the user that the recipients of dir changed on disk but the change is not committed,...
QHash< QString, Agreed > m_lastUnexpected
auto keysEncryptedTo(const QStringList &recipients, QHash< QString, QString > &primaries, QHash< QString, QString > &names, bool lookUp=true) -> std::optional< QSet< QString > >
The primary keys gpg encrypts to for recipients, found by a throwaway encryption outside the store wi...
auto placePendingInsert(int exitCode, QString *error) -> int
Finish the oldest pending insert after its gpg step: place the ciphertext with placeEncryptedFile(),...
auto copyDestination(const QString &src, const QString &dest, bool force) -> QString
The file a copy of src to dest writes: like pass cp, into an existing folder with ....
auto fullKeyListing(QString *listing) -> int override
Pass::fullKeyListing() in the calling thread's environment, so a re-encryption run's worker lists the...
bool m_reencryptActive
Set while a re-encryption run is pending or on the worker thread.
void reportUnrestorable(const QString &path, QStringList &problems)
Note for the user that a leftover is not a regular file and was left.
void startReencryptWorker(const QString &dir)
Start the worker thread once the Executor queue is idle.
auto writeGpgIdFile(const QString &gpgIdFile, const QList< UserInfo > &users, QByteArray *written=nullptr) -> bool
Write the enabled recipients to a .gpg-id, atomically: a write that fails halfway (full disk,...
auto commitArgs() -> QStringList
The start of a git commit for the store: "commit", and "-S" when git config pass.signcommits is true ...
auto verifyGpgIdForDir(const QString &file, QHash< QString, QStringList > &verified, QStringList &gpgId) -> bool
Recipients for the directory of file, from its verified .gpg-id.
void Grep(QString pattern, bool caseInsensitive) override
Search all password content by GPG-decrypting each .gpg file.
void Insert(QString file, QString newValue, bool overwrite) override
Insert new password.
auto insertWritten(const QString &err) const -> bool override
Whether the failed insert had placed its entry (see placeEncryptedFile()) before a later git step fai...
auto recipientsForDir(const QString &fileName, QHash< QString, QStringList > &verified, QStringList &gpgId, ReencryptResult &result) -> bool
The verified recipients for the folder fileName sits in.
auto gitTracks(const QString &file) -> bool
Check whether git already tracks a file in the store.
void CancelGrep() override
Stop the running search (NativeGrep::cancel()).
void cancelReencryptPath()
Ask a running reencryptPath() to stop.
QStringList m_reencryptTrusted
auto execBlockingRaw(const QString &app, const QStringList &args, const QByteArray &input, QByteArray *process_out) -> int
execBlocking() on bytes (Executor::executeBlockingRaw()), for an entry's plaintext,...
ImitatePass()
Construct the backend and connect its content search.
auto listKeysFor(const QString &gpgIdPath, const QStringList &gpgId, WhoReads &who) -> const ListKeys &
The keys of the list at gpgIdPath, worked out once per run.
auto gitReady() -> bool
gitConfigured() plus a status message when git is enabled but no executable is configured.
bool m_reencryptPushing
Set while finishReencrypt() pushes, so GitPush() does not hold it.
void executeGit(PROCESS id, const QStringList &args, QString input=QString(), bool readStdout=true, bool readStderr=true)
Execute git command.
QStringList m_movedToReencrypt
void Init(QString path, const QList< UserInfo > &users) override
Initialize store.
auto loadVerifiedRecipients(const QString &gpgIdFile, QStringList *recipients, QString *why=nullptr) -> bool
Read a .gpg-id, verify its detached signature and parse the recipients from the bytes that were verif...
auto readerChangeOf(const QString &fileName, const QStringList &keys, const ListKeys &lk, WhoReads &who) -> ReaderChange
Who would gain an entry by re-encrypting it to its list, other than those this change added,...
void Copy(const QString src, const QString dest, const bool force) override
Copy password file.
QThread * m_reencryptThread
The re-encryption worker while it runs, null otherwise. The destructor sets m_reencryptCancel and joi...
void rememberUnexpected(const ReencryptResult &result)
Keep what the run named in unexpectedRecipients(), with the bytes and readers it was named for: reenc...
auto holdForAgreement(const QString &fileName, const QStringList &keys, const ReaderChange &change, const WhoReads &who, ReencryptResult &result) -> bool
Leave an entry that would gain readers for the user: named in the question after the run,...
QQueue< PendingMove > m_pendingMoves
Moves through Git, in order, each settled when its PASS_MOVE ends.
auto reencryptFiles(const QString &dir) -> ReencryptResult
Worker-thread body: scan dir and re-encrypt stale files.
auto startReencryptRun(const QString &dir, ReencryptResult &result) -> bool
The checks a run makes after its own pull, before it writes: no unfinished Git operation,...
auto encryptFor(const QString &output, const QStringList &recipients, const QByteArray &plaintext) -> bool
Encrypt plaintext to recipients, into output.
auto placeEncryptedFile(const QString &output, const QString &file, bool overwrite, QString *error) -> bool
Bring the ciphertext gpg wrote to output into the store as file (Util::copyFileReplacing): through a ...
auto settleSignature(const QString &gpgIdFile, const QByteArray &written, const GpgIdSigner &signer, bool useGit, QString *sigToCommit) -> bool
Bring the signature in line with the list just written: a new one when signing is on,...
QString m_reencryptScope
The folder the re-encryption in flight covers, for the push hold.
SimpleTransaction m_transaction
auto entryHash(const QString &file) const -> QByteArray
SHA-256 of an entry's bytes, read as a regular file without following a link.
void unexpectedRecipients(const QString &dir, const QStringList &files, const QStringList &details)
A run left files alone: re-encrypting one would let someone on its folder's list read it who cannot n...
auto settleAutoPushHold(const ReencryptResult &result, bool agreedRun) -> bool
Bring the record of entries a removed recipient still reads up to date with a run,...
auto signGpgIdFile(const QString &gpgIdFile, const QByteArray &contents) -> bool
Sign a .gpg-id with the configured key and verify the result; failures are reported through critical(...
bool m_pushAfterReencrypt
QProcessEnvironment m_reencryptEnv
void reencryptProgress(int current, int total)
Re-encryption progress: current of total files checked.
void reencryptAfterFailedCommit(const QString &path, int gitExit, const QString &gitOut, const QString &gitErr, const QString &gpgIdFile, const std::optional< PreviousList > &previous)
After Init() wrote the new list but could not commit it: report Git's failure and re-encrypt without ...
void executeMoveGit(const QString &src, const QString &destFile, bool force)
Execute git move operation.
void endReencryptPath()
A reencryptPath() run is over, whether it finished, failed, was cancelled or was refused; the main wi...
auto translatePathForWsl(const QString &path, const QString &exe) const -> QString
Translate path for the given exe when WSL-routed: wraps in wslpath substitution, otherwise returns pa...
void finished(int id, int exitCode, const QString &out, const QString &err) override
Handle process completion.
void reencryptWithoutGit(const QString &dir, const QString &gitError)
Re-encrypt dir to the .gpg-id Init() wrote although its commit failed, without any Git step (they wou...
auto addGenerationHeader(const QString &gpgIdFile, const GpgIdSigner &signer, QByteArray *contents) -> bool
Put the generation header on a list that is about to be signed: reserve a generation above what this ...
auto restoreBackup(const QString &path, QStringList &problems) -> bool
Put a 1.8.x backup back in its entry's place when the entry is missing; report it when both exist (bo...
void startMovedReencrypts()
Start the runs in m_movedToReencrypt, one at a time, while none is in flight; then send a deferred pu...
auto gitAddGpgId(const QString &gpgIdFile, const QString &gpgIdSigFile, QString *out, QString *err) -> int
Stage a .gpg-id and, when given, its .sig, and commit both in one commit, so no commit in the history...
std::optional< UncommittedGpgId > m_uncommittedGpgId
void reencryptAlso(const QString &dir, const QStringList &files, const AppSettings &settings)
Re-encrypt files in dir after the user agreed to it.
std::atomic< bool > m_reencryptCancel
void GitPull() override
Pull from remote.
void reencryptMoved(const PendingMove &move)
Queue a re-encryption of what move moved, if it moved and another .gpg-id applies where it landed; a ...
auto refuseLinkedGpgIdFolder(const QString &path) -> bool
Refuse a folder, or a .gpg-id/.gpg-id.sig in it, that is a link: writing there would reach outside th...
auto decryptEntry(const QString &fileName, QByteArray *plaintext, QString *why) -> bool
Decrypt fileName for re-encryption.
auto refuseInitBeforeWrite(const QString &gpgIdFile, const GpgIdSigner &signer) -> bool
The checks Init() runs before it writes anything: no re-encryption running, the signing key's secret ...
void reportReencryptOutcome(const ReencryptResult &result, bool stillRead)
The status line for a run, and the push after it when one is due and nothing holds it.
auto isTrustedEntry(const QString &fileName, const QSet< QString > &listNow) const -> bool
Whether an entry that would gain readers is taken without a question: the user moved or copied it in,...
void Show(QString file) override
Show decrypted password.
std::optional< WrittenGpgId > m_writtenGpgId
auto pgpg(const QString &path) const -> QString
Translate path for gpg when WSL-routed: wraps in wslpath substitution, otherwise returns path unchang...
static auto namedReaders(const QSet< QString > &fprs, const QHash< QString, QString > &names) -> QString
The names of fprs for a question or a failure, sorted.
auto entriesToReencrypt(const QString &dir, QStringList *failed) -> QStringList
The entries under dir a run considers, telling the user about anything skipped for not being a regula...
auto storeGit(const QStringList &args, QString *out) -> bool override
Run git with -C <store> in the store, blocking.
QQueue< PendingInsert > m_pendingInserts
The inserts whose gpg step has not ended yet, oldest first.
void GitPull_b(int timeoutMs) override
Run git pull in the store and wait for it, at most timeoutMs.
auto readersAnEditWouldAdd(const QString &file) -> EditReaders override
Who saving over an existing entry would let read it who may not now.
QHash< QString, QSet< QString > > m_removedReaders
auto ciphertextHolds(const QString &ciphertext, const QByteArray &plaintext) -> bool
Decrypt ciphertext again and compare it with plaintext, byte for byte, so nothing replaces an entry u...
NativeGrep m_grep
Background search over the decrypted store; relays to finishedGrep.
auto resolveMoveDestination(const QString &src, const QString &dest, bool force) -> QString
Resolve destination for move operation.
auto recoverReencryptLeftovers(const QString &dir) -> bool
Deal with what a crashed or failed earlier run left under dir before touching anything: stale tempora...
void GitPush() override
Push to remote. While a re-encryption runs the push is held (Users ▸ OK and a copy ask for it as soon...
void Move(const QString src, const QString dest, const bool force) override
Move password file.
void sendDeferredPush()
Make the push GitPush() deferred, once no run is in flight and no move is waiting; an automatic one o...
void dropStaleTemporary(const QString &path)
Remove a stale temporary a crashed run left, unless it was modified within the hour: on a shared stor...
bool m_deferredPushByHand
std::optional< PreviousList > m_previousList
void startReencryptPath()
A reencryptPath() run is about to start its worker thread.
void reportFailedEntries(const QStringList &failed)
Tell the user which entries a run could not re-encrypt, the first few by name.
auto getKeysFromFile(const QString &fileName) -> QStringList
Read recipients from file.
auto commitName(const QString &path) const -> QString
How a commit message names a file of the store: relative to the store, without .gpg ("work/bank",...
auto reencryptUsesGit() const -> bool
gitConfigured(), unless the current run is one reencryptWithoutGit() started.
auto gitConfigured() const -> bool
Git is enabled and an executable is configured.
void reencryptPath(const QString &dir)
Re-encrypt entire directory.
auto pgit(const QString &path) const -> QString
Translate path for git when WSL-routed: wraps in wslpath substitution, otherwise returns path unchang...
void keepPreviousList(const QString &gpgIdFile, const std::optional< PreviousList > &previous)
Take previous as the PreviousList of the run Init() starts for gpgIdFile, unless a run is active or a...
auto pullBeforeReencrypt() -> bool
Pull before a run, when the store is a Git repository and automatic pulling is on.
void gitCommit(const QString &file, const QString &msg)
Commit one path to git.
void beforeExecute(PROCESS id) override
Open a transaction for every execution.
auto gpgIdSigner() -> GpgIdSigner
The signer for this store's .gpg-id, bound to the configured gpg and signing keys and to execBlocking...
Full-text search over a password store without pass grep: every .gpg file is decrypted with gpg on a ...
Definition nativegrep.h:31
void cancel()
Ask running searches to stop without waiting for them: the walk ends at the next file and a gpg that ...
Enums::PROCESS PROCESS
Alias for Enums::PROCESS used throughout this class.
Definition pass.h:154
Pass()
Construct a Pass instance.
Definition pass.cpp:83
Tracks a sequence of processes that should be treated as one atomic operation.
void transactionStart()
Open a transaction: the processes added until the matching transactionEnd() are reported as one opera...
void transactionEnd(Enums::PROCESS process)
Close the transaction opened by the matching transactionStart().
GpgIdSigner, which signs a store's .gpg-id and verifies an existing .gpg-id.sig against the configure...
NativeGrep, the content search that decrypts every entry on a worker thread instead of running pass g...
Pass, the abstract password-store backend that RealPass and ImitatePass implement,...
PROCESS
Identifies different subprocess operations used in QtPass.
Definition enums.h:43
SimpleTransaction, the bookkeeping that lets ImitatePass report several queued processes as one finis...
Plain value-object holding all flat QtPass configuration.
Definition appsettings.h:36
What the user was shown for an entry: its bytes and its folder's keys.
QSet< QString > readers
The primary keys its list encrypted to.
QByteArray hash
SHA-256 of the entry's bytes.
QString file
The entry's path in the store, where output goes.
std::shared_ptr< QTemporaryDir > scratch
The private directory gpg writes into; removed with this.
bool overwrite
Whether an entry already at file may be replaced.
QString output
The ciphertext file gpg writes, inside scratch.
A move whose re-encryption is decided once it has run.
QString src
What was moved.
QString destFile
Where to: the entry's .gpg file, or the folder.
std::optional< bool > landed
Whether its git mv succeeded, once that has run (finished()).
The list a folder had before Init() replaced it, for the run it starts. It tells whom the change adde...
QString gpgIdFile
The list Init() wrote, which now applies.
QStringList recipients
The lines that applied there before.
How re-encrypting one entry changes who can read it.
Outcome of one reencryptPath() run; filled on the worker thread and consumed by finishReencrypt() on ...
A .gpg-id Init() wrote but could not commit.
QString folder
The folder whose recipients changed.
QString gitError
What Git said when the commit failed.
The .gpg-id Init() wrote for the run it starts: the recipients the user ticked, as written.
QString file
The list's path.
QByteArray bytes
What Init() wrote there.