-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappunlockmanager.h
More file actions
29 lines (21 loc) · 816 Bytes
/
appunlockmanager.h
File metadata and controls
29 lines (21 loc) · 816 Bytes
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
#ifndef APPUNLOCKMANAGER_H
#define APPUNLOCKMANAGER_H
#include <QObject>
class AppUnlockManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool hasPassword READ hasPassword NOTIFY hasPasswordChanged)
public:
explicit AppUnlockManager(QObject *parent = nullptr);
Q_INVOKABLE bool storeUnlockToken(const QString &password, const QString &token);
Q_INVOKABLE QString loadUnlockToken(const QString &password);
Q_INVOKABLE bool clearPassword(const QString &password); // new method
bool hasPassword() const; // property getter
signals:
void hasPasswordChanged();
private:
QByteArray generateKey(const QString &password, const QByteArray &salt);
QByteArray xorData(const QByteArray &data, const QByteArray &key);
QString storagePath() const;
};
#endif // APPUNLOCKMANAGER_H