libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
IKeychainService.h
1/*
2 * Copyright 2018-2022 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#pragma once
20
21#include <quentier/exception/IQuentierException.h>
22#include <quentier/types/ErrorString.h>
23#include <quentier/utility/Fwd.h>
24#include <quentier/utility/Linkage.h>
25
26#include <QFuture>
27
28class QDebug;
29
30namespace quentier {
31
37{
38public:
39 virtual ~IKeychainService() noexcept;
40
44 enum class ErrorCode
45 {
49 NoError,
53 EntryNotFound,
57 CouldNotDeleteEntry,
61 AccessDeniedByUser,
65 AccessDenied,
69 NoBackendAvailable,
73 NotImplemented,
77 OtherError
78 };
79
81 QTextStream & strm, ErrorCode errorCode);
82
84 QDebug & dbg, ErrorCode errorCode);
85
91 {
92 public:
93 explicit Exception(ErrorCode errorCode) noexcept;
94
95 explicit Exception(
96 ErrorCode errorCode, ErrorString errorDescription) noexcept;
97
98 [[nodiscard]] ErrorCode errorCode() const noexcept;
99 [[nodiscard]] QString exceptionDisplayName() const override;
100
101 void raise() const override;
102 [[nodiscard]] Exception * clone() const override;
103
104 private:
105 const ErrorCode m_errorCode;
106 };
107
108public:
124
139 QString service, QString key) const = 0;
140
155};
156
157[[nodiscard]] QUENTIER_EXPORT IKeychainServicePtr newQtKeychainService();
158
159[[nodiscard]] QUENTIER_EXPORT IKeychainServicePtr
160 newObfuscatingKeychainService();
161
162[[nodiscard]] QUENTIER_EXPORT IKeychainServicePtr newCompositeKeychainService(
163 QString name, IKeychainServicePtr primaryKeychain,
164 IKeychainServicePtr secondaryKeychain);
165
166[[nodiscard]] QUENTIER_EXPORT IKeychainServicePtr newMigratingKeychainService(
167 IKeychainServicePtr sourceKeychain, IKeychainServicePtr sinkKeychain);
168
169} // namespace quentier
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition ErrorString.h:43
The IKeychainService::Exception class is the base class for exceptions returned inside QFutures from ...
Definition IKeychainService.h:91
The IKeychainService interface provides the ability to interact with the storage of sensitive data - ...
Definition IKeychainService.h:37
virtual QFuture< QString > readPassword(QString service, QString key) const =0
ErrorCode
Definition IKeychainService.h:45
virtual QFuture< void > deletePassword(QString service, QString key)=0
virtual QFuture< void > writePassword(QString service, QString key, QString password)=0
The IQuentierException class represents the interface for exceptions specific to libquentier and appl...
Definition IQuentierException.h:38
The Result template class represents the bare bones result monad implementation which either contains...
Definition Result.h:38