File indexing completed on 2024-05-19 05:06:55
0001 /* 0002 SPDX-FileCopyrightText: 2021 Igor Bugaev <freedbrt@gmail.com> 0003 SPDX-FileCopyrightText: 2022 Dawid Wróbel <me@dawidwrobel.com> 0004 SPDX-License-Identifier: BSD-3-Clause 0005 */ 0006 0007 #ifndef KMMKEYCHAIN_H 0008 #define KMMKEYCHAIN_H 0009 0010 #include <QObject> 0011 0012 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0013 #include <qt5keychain/keychain.h> 0014 #else 0015 #include <qt6keychain/keychain.h> 0016 #endif 0017 0018 #include "kmm_keychain_export.h" 0019 0020 class KMM_KEYCHAIN_EXPORT KMMKeychain : public QObject 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit KMMKeychain(QObject* parent = nullptr); 0025 0026 void readKey(const QString& key); 0027 QString readKeySynchronous(const QString& key); 0028 0029 void writeKey(const QString& key, const QString& value); 0030 0031 void deleteKey(const QString& key); 0032 0033 Q_SIGNALS: 0034 void keyStored(const QString& key); 0035 void keyRestored(const QString& key, const QString& value); 0036 void keyDeleted(const QString& key); 0037 void error(const QString& errorText); 0038 0039 private: 0040 QKeychain::ReadPasswordJob m_readCredentialJob; 0041 QKeychain::WritePasswordJob m_writeCredentialJob; 0042 QKeychain::DeletePasswordJob m_deleteCredentialJob; 0043 }; 0044 0045 #endif // KMMKEYCHAIN_H