QtPass 1.4.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
pass.h
Go to the documentation of this file.
1#ifndef PASS_H
2#define PASS_H
3
4#include "enums.h"
5#include "executor.h"
6#include "userinfo.h"
7
8#include <QProcess>
9#include <QQueue>
10#include <QString>
11#include <cassert>
12#include <map>
13
18class Pass : public QObject {
19 Q_OBJECT
20
21 bool wrapperRunning;
22 QStringList env;
23
24protected:
26
28
29public:
30 Pass();
31 void init();
32
33 virtual ~Pass() {}
34 virtual void GitInit() = 0;
35 virtual void GitPull() = 0;
36 virtual void GitPull_b() = 0;
37 virtual void GitPush() = 0;
38 virtual void Show(QString file) = 0;
39 virtual void OtpGenerate(QString file) = 0;
40 virtual void Insert(QString file, QString value, bool force) = 0;
41 virtual void Remove(QString file, bool isDir) = 0;
42 virtual void Move(const QString srcDir, const QString dest,
43 const bool force = false) = 0;
44 virtual void Copy(const QString srcDir, const QString dest,
45 const bool force = false) = 0;
46 virtual void Init(QString path, const QList<UserInfo> &users) = 0;
47 virtual QString Generate_b(unsigned int length, const QString &charset);
48
49 void GenerateGPGKeys(QString batch);
50 QList<UserInfo> listKeys(QStringList keystrings, bool secret = false);
51 QList<UserInfo> listKeys(QString keystring = "", bool secret = false);
52 void updateEnv();
53 static QString getGpgIdPath(QString for_file);
54 static QStringList getRecipientList(QString for_file);
55 // TODO(bezet): getRecipientString is useless, refactor
56 static QStringList getRecipientString(QString for_file,
57 QString separator = " ",
58 int *count = NULL);
59
60protected:
61 void executeWrapper(PROCESS id, const QString &app, const QStringList &args,
62 bool readStdout = true, bool readStderr = true);
63 QString generateRandomPassword(const QString &charset, unsigned int length);
64 quint32 boundedRandom(quint32 bound);
65
66 virtual void executeWrapper(PROCESS id, const QString &app,
67 const QStringList &args, QString input,
68 bool readStdout = true, bool readStderr = true);
69
70protected slots:
71 virtual void finished(int id, int exitCode, const QString &out,
72 const QString &err);
73
74signals:
75 void error(QProcess::ProcessError);
77 void statusMsg(QString, int);
78 void critical(QString, QString);
79
80 void processErrorExit(int exitCode, const QString &err);
81
82 void finishedAny(const QString &, const QString &);
83 void finishedGitInit(const QString &, const QString &);
84 void finishedGitPull(const QString &, const QString &);
85 void finishedGitPush(const QString &, const QString &);
86 void finishedShow(const QString &);
87 void finishedOtpGenerate(const QString &);
88 void finishedInsert(const QString &, const QString &);
89 void finishedRemove(const QString &, const QString &);
90 void finishedInit(const QString &, const QString &);
91 void finishedMove(const QString &, const QString &);
92 void finishedCopy(const QString &, const QString &);
93 void finishedGenerate(const QString &, const QString &);
94 void finishedGenerateGPGKeys(const QString &, const QString &);
95};
96
97#endif // PASS_H
Executes external commands for handleing password, git and other data.
Definition: executor.h:12
Acts as an abstraction for pass or pass imitation.
Definition: pass.h:18
QString generateRandomPassword(const QString &charset, unsigned int length)
Definition: pass.cpp:364
void init()
Definition: pass.cpp:47
void startingExecuteWrapper()
void GenerateGPGKeys(QString batch)
Pass::GenerateGPGKeys internal gpg keypair generator . .
Definition: pass.cpp:116
virtual void Copy(const QString srcDir, const QString dest, const bool force=false)=0
void finishedCopy(const QString &, const QString &)
void finishedShow(const QString &)
void finishedRemove(const QString &, const QString &)
virtual void GitInit()=0
virtual void GitPull()=0
void finishedMove(const QString &, const QString &)
void statusMsg(QString, int)
static QStringList getRecipientString(QString for_file, QString separator=" ", int *count=NULL)
Pass::getRecipientString formated string for use with GPG.
Definition: pass.cpp:339
void critical(QString, QString)
void finishedGitInit(const QString &, const QString &)
virtual void Remove(QString file, bool isDir)=0
Pass()
Pass::Pass wrapper for using either pass or the pass imitation.
Definition: pass.cpp:17
virtual void Show(QString file)=0
void executeWrapper(PROCESS id, const QString &app, const QStringList &args, bool readStdout=true, bool readStderr=true)
Definition: pass.cpp:31
void finishedAny(const QString &, const QString &)
Enums::PROCESS PROCESS
Definition: pass.h:27
static QStringList getRecipientList(QString for_file)
Pass::getRecipientList return list of gpg-id's to encrypt for.
Definition: pass.cpp:318
void finishedInsert(const QString &, const QString &)
virtual void GitPull_b()=0
void finishedInit(const QString &, const QString &)
virtual void GitPush()=0
virtual void Insert(QString file, QString value, bool force)=0
void finishedOtpGenerate(const QString &)
virtual ~Pass()
Definition: pass.h:33
Executor exec
Definition: pass.h:25
virtual QString Generate_b(unsigned int length, const QString &charset)
Pass::Generate use either pwgen or internal password generator.
Definition: pass.cpp:71
static QString getGpgIdPath(QString for_file)
Pass::getGpgIdPath return gpgid file path for some file (folder).
Definition: pass.cpp:290
void processErrorExit(int exitCode, const QString &err)
quint32 boundedRandom(quint32 bound)
Definition: pass.cpp:349
void finishedGitPull(const QString &, const QString &)
void finishedGitPush(const QString &, const QString &)
virtual void Move(const QString srcDir, const QString dest, const bool force=false)=0
void finishedGenerate(const QString &, const QString &)
virtual void OtpGenerate(QString file)=0
QList< UserInfo > listKeys(QStringList keystrings, bool secret=false)
Pass::listKeys list users.
Definition: pass.cpp:130
void updateEnv()
Pass::updateEnv update the execution environment (used when switching profiles)
Definition: pass.cpp:248
void error(QProcess::ProcessError)
virtual void finished(int id, int exitCode, const QString &out, const QString &err)
Pass::processFinished reemits specific signal based on what process has finished.
Definition: pass.cpp:195
void finishedGenerateGPGKeys(const QString &, const QString &)
virtual void Init(QString path, const QList< UserInfo > &users)=0
PROCESS
Definition: enums.h:16