libquentier 0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
IKeychainService.h
1/*
2 * Copyright 2018-2020 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIB_QUENTIER_UTILITY_I_KEYCHAIN_SERVICE_H
20#define LIB_QUENTIER_UTILITY_I_KEYCHAIN_SERVICE_H
21
22#include <quentier/types/ErrorString.h>
23#include <quentier/utility/ForwardDeclarations.h>
24#include <quentier/utility/Linkage.h>
25
26#include <QObject>
27#include <QUuid>
28
29#include <memory>
30
31QT_FORWARD_DECLARE_CLASS(QDebug)
32
33namespace quentier {
34
40class QUENTIER_EXPORT IKeychainService : public QObject
41{
42 Q_OBJECT
43protected:
44 explicit IKeychainService(QObject * parent = nullptr);
45
46public:
47 virtual ~IKeychainService() {}
48
52 enum class ErrorCode
53 {
57 NoError,
61 EntryNotFound,
65 CouldNotDeleteEntry,
69 AccessDeniedByUser,
73 AccessDenied,
77 NoBackendAvailable,
81 NotImplemented,
85 OtherError
86 };
87
88 friend QTextStream & operator<<(
89 QTextStream & strm, const ErrorCode errorCode);
90
91 friend QDebug & operator<<(QDebug & dbg, const ErrorCode errorCode);
92
93public:
107 const QString & service, const QString & key,
108 const QString & password) = 0;
109
121 virtual QUuid startReadPasswordJob(
122 const QString & service, const QString & key) = 0;
123
136 const QString & service, const QString & key) = 0;
137
138Q_SIGNALS:
152 QUuid requestId, ErrorCode errorCode, ErrorString errorDescription);
153
168 QUuid requestId, ErrorCode errorCode, ErrorString errorDescription,
169 QString password);
170
184 QUuid requestId, ErrorCode errorCode, ErrorString errorDescription);
185
186private:
187 Q_DISABLE_COPY(IKeychainService);
188};
189
190QUENTIER_EXPORT IKeychainServicePtr
191newQtKeychainService(QObject * parent = nullptr);
192
193QUENTIER_EXPORT IKeychainServicePtr
194newObfuscatingKeychainService(QObject * parent = nullptr);
195
196QUENTIER_EXPORT IKeychainServicePtr newCompositeKeychainService(
197 QString name, IKeychainServicePtr primaryKeychain,
198 IKeychainServicePtr secondaryKeychain, QObject * parent = nullptr);
199
200QUENTIER_EXPORT IKeychainServicePtr newMigratingKeychainService(
201 IKeychainServicePtr sourceKeychain, IKeychainServicePtr sinkKeychain,
202 QObject * parent = nullptr);
203
204} // namespace quentier
205
206#endif // LIB_QUENTIER_UTILITY_I_KEYCHAIN_SERVICE_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition ErrorString.h:44
The IKeychainService interface provides methods intended to start potentially asynchronous interactio...
Definition IKeychainService.h:41
virtual QUuid startWritePasswordJob(const QString &service, const QString &key, const QString &password)=0
virtual QUuid startDeletePasswordJob(const QString &service, const QString &key)=0
void readPasswordJobFinished(QUuid requestId, ErrorCode errorCode, ErrorString errorDescription, QString password)
void deletePasswordJobFinished(QUuid requestId, ErrorCode errorCode, ErrorString errorDescription)
virtual QUuid startReadPasswordJob(const QString &service, const QString &key)=0
void writePasswordJobFinished(QUuid requestId, ErrorCode errorCode, ErrorString errorDescription)
ErrorCode
Definition IKeychainService.h:53