File indexing completed on 2025-03-09 04:54:13

0001 /*
0002    SPDX-FileCopyrightText: 2020 Sandro Knauß <knauss@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "messagecore_export.h"
0010 
0011 #include "autocryptrecipient.h"
0012 
0013 #include <QSharedPointer>
0014 
0015 class AutocryptStorageTest;
0016 class AutocryptUtilsTest;
0017 
0018 namespace MessageCore
0019 {
0020 class AutocryptStoragePrivate;
0021 
0022 class MESSAGECORE_EXPORT AutocryptStorage
0023 {
0024 public:
0025     using Ptr = QSharedPointer<AutocryptStorage>;
0026     static AutocryptStorage::Ptr self();
0027 
0028     AutocryptRecipient::Ptr getRecipient(const QByteArray &addr);
0029     void save();
0030     AutocryptRecipient::Ptr addRecipient(const QByteArray &addr);
0031     void deleteRecipient(const QByteArray &addr);
0032 
0033 private:
0034     MESSAGECORE_NO_EXPORT AutocryptStorage();
0035     static AutocryptStorage::Ptr mSelf;
0036 
0037 private:
0038     std::unique_ptr<AutocryptStoragePrivate> d_ptr;
0039     Q_DECLARE_PRIVATE(AutocryptStorage)
0040 
0041     friend class ::AutocryptStorageTest;
0042     friend class ::AutocryptUtilsTest;
0043 };
0044 }