emailQt/KeychainClass.hpp

31 lines
701 B
C++

#pragma once
#include <QObject>
#include <QString>
#include <qt6keychain/keychain.h>
namespace Keychain {
constexpr char url[]{"keychain.emailQt.kvuj.app"};
const QString passKey("Password");
}
class KeychainClass : public QObject {
Q_OBJECT
public:
explicit KeychainClass(QObject *parent = nullptr);
void readKey(const QString &key);
void writeKey(const QString &key, const QString &value);
void deleteKey(const QString &key);
signals:
void keyRead(const QString &key, const QString &value);
private:
QKeychain::ReadPasswordJob readCredentialJob;
QKeychain::WritePasswordJob writeCredentialJob;
QKeychain::DeletePasswordJob deleteCredentialJob;
};