-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorepassword.h
72 lines (61 loc) · 2.21 KB
/
storepassword.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef STOREPASSWORD_H
#define STOREPASSWORD_H
#include <QDialog>
#include <QByteArray>
#include <QNetworkInterface>
#include <QJsonObject>
// =====================
// Namespace Declarations
// =====================
namespace Ui {
class storePassword;
}
// =====================
// Class Declaration
// =====================
class storePassword : public QDialog
{
Q_OBJECT
public:
// =========================
// Constructor & Destructor
// =========================
explicit storePassword(QWidget *parent = nullptr);
~storePassword();
signals:
// ===================
// Signal Declarations
// ===================
void requestGenPassword(); // Signal to request a new password generation
void emitBackClicked(); // Signal emitted when the back button is clicked
private slots:
// ==================
// Slot Declarations
// ==================
void on_backButton_clicked(); // Handles the back button click event
void on_genPassButton_clicked(); // Handles the generate password button click event
void on_storePassButton_clicked(); // Handles the store password button click event
private:
// =====================
// Private Members
// =====================
Ui::storePassword *ui; // UI pointer for the storePassword dialog
void closeEvent(QCloseEvent *event);
// =====================
// Encryption Functions
// =====================
QByteArray encryptData(const QByteArray &data); // Encrypts the given data
QByteArray decryptData(const QByteArray &encryptedData); // Decrypts the given data
// ============================
// Machine-Specific Key Function
// ============================
QByteArray getMachineSpecificKey(); // Generates a machine-specific key
void clearUI(); // Clears UI
// ============================
// File Handling Functions
// ============================
void saveEncryptedDataToFile(const QString &passId, const QByteArray &encryptedData); // Saves encrypted data to a file
QJsonObject loadAndDecryptDataFromFile(const QString &passId); // Loads and decrypts data from a file (for testing)
bool doesPassIdExist(const QString &passId);
};
#endif // STOREPASSWORD_H