QtPass 1.6.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
RealPass Class Reference

Implementation of Pass that wraps the 'pass' command-line tool. More...

#include <realpass.h>

Inheritance diagram for RealPass:
Collaboration diagram for RealPass:

Public Member Functions

 RealPass ()
 Construct a RealPass instance.
 ~RealPass () override=default
 Destructor.
void GitInit () override
 Initialize Git repository in password store.
void GitPull () override
 Pull changes from remote.
void GitPull_b () override
 Pull with rebase.
void GitPush () override
 Push changes to remote.
void Show (QString file) override
 Show decrypted password.
void OtpGenerate (QString file) override
 Generate OTP code.
void Insert (QString file, QString newValue, bool overwrite=false) override
 Insert new password.
void Remove (QString file, bool isDir=false) override
 Remove password or directory.
void Init (QString path, const QList< UserInfo > &users) override
 Initialize password store.
void Move (const QString src, const QString dest, const bool force=false) override
 Move password file or directory.
void Copy (const QString src, const QString dest, const bool force=false) override
 Copy password file or directory.
Public Member Functions inherited from Pass
 Pass ()
 Construct a Pass instance.
void init ()
 Initialize the Pass instance.
 ~Pass () override=default
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.

Additional Inherited Members

Signals inherited from Pass
void error (QProcess::ProcessError)
 Emitted when a process error occurs.
void startingExecuteWrapper ()
 Emitted before executing a command.
void statusMsg (const QString &, int)
 Emit status message.
void critical (const QString &, const QString &)
 Emit critical error.
void processErrorExit (int exitCode, const QString &err)
 Emitted on process error exit.
void finishedAny (const QString &, const QString &)
 Emitted when any operation finishes.
void finishedGitInit (const QString &, const QString &)
 Emitted when Git init finishes.
void finishedGitPull (const QString &, const QString &)
 Emitted when Git pull finishes.
void finishedGitPush (const QString &, const QString &)
 Emitted when Git push finishes.
void finishedShow (const QString &)
 Emitted when show finishes.
void finishedOtpGenerate (const QString &)
 Emitted when OTP generation finishes.
void finishedInsert (const QString &, const QString &)
 Emitted when insert finishes.
void finishedRemove (const QString &, const QString &)
 Emitted when remove finishes.
void finishedInit (const QString &, const QString &)
 Emitted when init finishes.
void finishedMove (const QString &, const QString &)
 Emitted when move finishes.
void finishedCopy (const QString &, const QString &)
 Emitted when copy finishes.
void finishedGenerate (const QString &, const QString &)
 Emitted when generate finishes.
void finishedGenerateGPGKeys (const QString &, const QString &)
 Emitted when GPG key generation finishes.
Static Public Member Functions inherited from Pass
static bool gpgSupportsEd25519 ()
 Check if GPG supports Ed25519 encryption.
static QString getDefaultKeyTemplate ()
 Get default key template for new GPG keys.
static auto resolveGpgconfCommand (const QString &gpgPath) -> ResolvedGpgconfCommand
 Resolve the gpgconf command to kill agents.
static auto getGpgIdPath (const QString &for_file) -> QString
 Get .gpg-id file path for a password file.
static auto getRecipientList (const QString &for_file) -> QStringList
 Get list of recipients for a password file.
static auto getRecipientString (const QString &for_file, const QString &separator=" ", int *count=nullptr) -> QStringList
 Get recipients as string.
Protected Types inherited from Pass
using PROCESS = Enums::PROCESS
Protected Slots inherited from Pass
virtual void finished (int id, int exitCode, const QString &out, const QString &err)
 Handle process completion.
Protected Member Functions inherited from Pass
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.
virtual void executeWrapper (PROCESS id, const QString &app, const QStringList &args, QString input, bool readStdout=true, bool readStderr=true)
 Execute wrapper with input.
Protected Attributes inherited from Pass
Executor exec

Detailed Description

Implementation of Pass that wraps the 'pass' command-line tool.

RealPass delegates all password store operations to the external 'pass' utility. It provides a Qt-native interface while handling:

  • Git integration (init, pull, push)
  • Password CRUD (show, insert, remove, move, copy)
  • OTP generation
  • Store initialization with GPG keys

This is the primary implementation when 'pass' is available on the system.

Examples
/home/annejan/Projects/QtPass/src/qtpasssettings.cpp.

Definition at line 21 of file realpass.h.

Constructor & Destructor Documentation

◆ RealPass()

RealPass::RealPass ( )
default

Construct a RealPass instance.

◆ ~RealPass()

RealPass::~RealPass ( )
overridedefault

Destructor.

Member Function Documentation

◆ Copy()

void RealPass::Copy ( const QString src,
const QString dest,
const bool force = false )
overridevirtual

Copy password file or directory.

RealPass::Copy copy a file (or folder).

Parameters
srcSource path.
destDestination path.
forceOverwrite existing.
srcsource file or folder
destdestination file or folder
forceoverwrite

Implements Pass.

Definition at line 162 of file realpass.cpp.

Here is the call graph for this function:

◆ GitInit()

void RealPass::GitInit ( )
overridevirtual

Initialize Git repository in password store.

RealPass::GitInit pass git init wrapper.

Implements Pass.

Definition at line 29 of file realpass.cpp.

◆ GitPull()

void RealPass::GitPull ( )
overridevirtual

Pull changes from remote.

RealPass::GitPull pass git pull wrapper.

Implements Pass.

Definition at line 48 of file realpass.cpp.

◆ GitPull_b()

void RealPass::GitPull_b ( )
overridevirtual

Pull with rebase.

RealPass::GitInit pass git pull wrapper which blocks until process finishes.

Implements Pass.

Definition at line 35 of file realpass.cpp.

Here is the call graph for this function:

◆ GitPush()

void RealPass::GitPush ( )
overridevirtual

Push changes to remote.

RealPass::GitPush pass git push wrapper.

Implements Pass.

Definition at line 53 of file realpass.cpp.

◆ Init()

void RealPass::Init ( QString path,
const QList< UserInfo > & users )
overridevirtual

Initialize password store.

RealPass::Init initialize pass repository.

Parameters
pathStore root path.
usersGPG recipients.
pathAbsolute path to new password-store
userslist of users with ability to decrypt new password-store

Implements Pass.

Definition at line 101 of file realpass.cpp.

Here is the call graph for this function:

◆ Insert()

void RealPass::Insert ( QString file,
QString newValue,
bool overwrite = false )
overridevirtual

Insert new password.

RealPass::Insert pass insert.

Parameters
filePath to password file.
newValuePassword content.
overwritetrue to overwrite existing.

Implements Pass.

Definition at line 79 of file realpass.cpp.

◆ Move()

void RealPass::Move ( const QString src,
const QString dest,
const bool force = false )
overridevirtual

Move password file or directory.

RealPass::Move move a file (or folder).

Parameters
srcSource path.
destDestination path.
forceOverwrite existing.
srcsource file or folder
destdestination file or folder
forceoverwrite

Implements Pass.

Definition at line 122 of file realpass.cpp.

Here is the call graph for this function:

◆ OtpGenerate()

void RealPass::OtpGenerate ( QString file)
overridevirtual

Generate OTP code.

RealPass::OtpGenerate pass otp.

Parameters
filePath to password file with OTP.
filefile containing OTP uri

Implements Pass.

Definition at line 72 of file realpass.cpp.

◆ Remove()

void RealPass::Remove ( QString file,
bool isDir = false )
overridevirtual

Remove password or directory.

RealPass::Remove pass remove wrapper.

Parameters
filePath to remove.
isDirtrue if removing directory.

Implements Pass.

Definition at line 91 of file realpass.cpp.

◆ Show()

void RealPass::Show ( QString file)
overridevirtual

Show decrypted password.

RealPass::Show pass show.

Parameters
filePath to password file.
filefile to decrypt
Returns
if block is set, returns exit status of internal decryption process otherwise returns QProcess::NormalExit

Implements Pass.

Definition at line 64 of file realpass.cpp.


The documentation for this class was generated from the following files: