QtPass 2.0.0
Developer documentation
Loading...
Searching...
No Matches
profileinit.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
8#ifndef SRC_PROFILEINIT_H_
9#define SRC_PROFILEINIT_H_
10
11#include <QCoreApplication>
12#include <QList>
13#include <QProcessEnvironment>
14#include <QString>
15
16class QProcess;
17struct AppSettings;
18struct UserInfo;
19
31class ProfileInit {
32 Q_DECLARE_TR_FUNCTIONS(ProfileInit)
33
34public:
42 static auto gpgEnvironment(const AppSettings &s) -> QProcessEnvironment;
48 static auto needsInit(const QString &path) -> bool;
49
69 static auto initialise(const QString &dir, const QList<UserInfo> &users,
70 const AppSettings &settings, bool useGit,
71 QString *note) -> bool;
72
83 static auto initGit(const QString &dir, const AppSettings &s, QString *note)
84 -> bool;
85
93 static auto gitIdentityConfigured(const QString &dir, const AppSettings &s)
94 -> bool;
95
96private:
97 ProfileInit() = default;
108 static auto signingKeyUnavailable(const AppSettings &s, QString *note)
109 -> bool;
119 static auto entriesOnThisList(const QString &dir, bool viaPass)
120 -> QStringList;
132 static auto writeGpgId(const QString &gpgIdFile, const QList<UserInfo> &users,
133 bool signed_, QString *note,
134 QByteArray *written = nullptr) -> bool;
144 static auto signGpgId(const QString &gpgIdFile, const QByteArray &contents,
145 const AppSettings &s, QString *note) -> bool;
157 static auto commitGpgId(const QString &dir, const QString &gpgIdFile,
158 const QString &sigFile, const AppSettings &s,
159 QString *note) -> bool;
173 static auto runGit(QProcess &git, const AppSettings &s, const QString &dir,
174 const QStringList &args, QString *note) -> bool;
184 static auto refusedForGit(const QString &dir, const QStringList &files,
185 QString *note) -> bool;
186};
187
188#endif // SRC_PROFILEINIT_H_
static auto needsInit(const QString &path) -> bool
Check if a profile path needs initialization.
static auto refusedForGit(const QString &dir, const QStringList &files, QString *note) -> bool
Whether staging files in dir is refused because git could wait on something there for good: a ....
static auto initialise(const QString &dir, const QList< UserInfo > &users, const AppSettings &settings, bool useGit, QString *note) -> bool
Write the recipients and, if wanted, put the folder under git.
static auto entriesOnThisList(const QString &dir, bool viaPass) -> QStringList
The encrypted entries under dir that the new root list covers: visible regular .gpg files,...
static auto initGit(const QString &dir, const AppSettings &s, QString *note) -> bool
Put an existing store under Git: git init, stage the .gpg entries and the .gpg-id files (nothing else...
static auto commitGpgId(const QString &dir, const QString &gpgIdFile, const QString &sigFile, const AppSettings &s, QString *note) -> bool
git init in dir, stage the .gpg-id and its signature, and commit them (signed when pass....
static auto runGit(QProcess &git, const AppSettings &s, const QString &dir, const QStringList &args, QString *note) -> bool
Run one set-up git command on git and wait for it: init and add, which read what lies in the folder,...
static auto signingKeyUnavailable(const AppSettings &s, QString *note) -> bool
Whether the profile has a signing key whose secret key gpg does not hold, so no list may be written: ...
static auto gpgEnvironment(const AppSettings &s) -> QProcessEnvironment
The environment QtPass runs gpg in outside the active store's backend: the system's,...
static auto gitIdentityConfigured(const QString &dir, const AppSettings &s) -> bool
Whether git has a name and e-mail to commit with, i.e. user.name and user.email resolve (globally or ...
static auto writeGpgId(const QString &gpgIdFile, const QList< UserInfo > &users, bool signed_, QString *note, QByteArray *written=nullptr) -> bool
Write the enabled recipients to gpgIdFile, whole or not at all; with signed_ the list carries the gen...
static auto signGpgId(const QString &gpgIdFile, const QByteArray &contents, const AppSettings &s, QString *note) -> bool
Sign the list just written as gpgIdFile, over the bytes contents that were written.
Plain value-object holding all flat QtPass configuration.
Definition appsettings.h:36
Stores GPG key info including validity, creation date, and more.
Definition userinfo.h:20