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
16struct AppSettings;
17struct UserInfo;
18
30class ProfileInit {
31 Q_DECLARE_TR_FUNCTIONS(ProfileInit)
32
33public:
41 static auto gpgEnvironment(const AppSettings &s) -> QProcessEnvironment;
47 static auto needsInit(const QString &path) -> bool;
48
66 static auto initialise(const QString &dir, const QList<UserInfo> &users,
67 const AppSettings &s, bool useGit, QString *note)
68 -> bool;
69
80 static auto initGit(const QString &dir, const AppSettings &s, QString *note)
81 -> bool;
82
90 static auto gitIdentityConfigured(const QString &dir, const AppSettings &s)
91 -> bool;
92
93private:
94 ProfileInit() = default;
106 static auto writeGpgId(const QString &gpgIdFile, const QList<UserInfo> &users,
107 bool signed_, QString *note,
108 QByteArray *written = nullptr) -> bool;
118 static auto signGpgId(const QString &gpgIdFile, const QByteArray &contents,
119 const AppSettings &s, QString *note) -> bool;
131 static auto commitGpgId(const QString &dir, const QString &gpgIdFile,
132 const QString &sigFile, const AppSettings &s,
133 QString *note) -> bool;
134};
135
136#endif // SRC_PROFILEINIT_H_
static auto needsInit(const QString &path) -> bool
Check if a profile path needs initialization.
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 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 initialise(const QString &dir, const QList< UserInfo > &users, const AppSettings &s, bool useGit, QString *note) -> bool
Write the recipients and, if wanted, put the folder under git.
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:19