libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
IKeychainService.h
1/*
2 * Copyright 2018-2025 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
24#include <quentier/utility/Fwd.h>
25#include <quentier/utility/Linkage.h>
26
27#include <QFuture>
28
29class QDebug;
30
31namespace quentier::utility {
32
37class QUENTIER_EXPORT IKeychainService
38{
39public:
40 virtual ~IKeychainService() noexcept;
41
80
81 friend QUENTIER_EXPORT QTextStream & operator<<(
82 QTextStream & strm, ErrorCode errorCode);
83
84 friend QUENTIER_EXPORT QDebug & operator<<(
85 QDebug & dbg, ErrorCode errorCode);
86
91 class QUENTIER_EXPORT Exception : public IQuentierException
92 {
93 public:
94 explicit Exception(ErrorCode errorCode) noexcept;
95
96 explicit Exception(
97 ErrorCode errorCode, ErrorString errorDescription) noexcept;
98
99 [[nodiscard]] ErrorCode errorCode() const noexcept;
100 [[nodiscard]] QString exceptionDisplayName() const override;
101
102 void raise() const override;
103 [[nodiscard]] Exception * clone() const override;
104
105 private:
106 const ErrorCode m_errorCode;
107 };
108
109public:
123 [[nodiscard]] virtual QFuture<void> writePassword(
124 QString service, QString key, QString password) = 0;
125
139 [[nodiscard]] virtual QFuture<QString> readPassword(
140 QString service, QString key) const = 0;
141
154 [[nodiscard]] virtual QFuture<void> deletePassword(
155 QString service, QString key) = 0;
156};
157
158} // namespace quentier::utility
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition ErrorString.h:43
The IKeychainService interface provides the ability to interact with the storage of sensitive data - ...
Definition IKeychainService.h:38
virtual QFuture< void > deletePassword(QString service, QString key)=0
ErrorCode
Definition IKeychainService.h:46
@ AccessDeniedByUser
Definition IKeychainService.h:62
@ OtherError
Definition IKeychainService.h:78
@ NoError
Definition IKeychainService.h:50
@ EntryNotFound
Definition IKeychainService.h:54
@ NotImplemented
Definition IKeychainService.h:74
@ AccessDenied
Definition IKeychainService.h:66
@ CouldNotDeleteEntry
Definition IKeychainService.h:58
@ NoBackendAvailable
Definition IKeychainService.h:70
virtual QFuture< void > writePassword(QString service, QString key, QString password)=0
virtual QFuture< QString > readPassword(QString service, QString key) const =0