7#ifndef _KWALLETFREEDESKTOPSERVICE_H_
8#define _KWALLETFREEDESKTOPSERVICE_H_
11#include <QDBusArgument>
12#include <QDBusServiceWatcher>
18#include "kwalletdbuscontext.h"
20#define FDO_APPID QString()
21#define FDO_SECRETS_SERVICE_OBJECT "/org/freedesktop/secrets"
22#define FDO_ALIAS_PATH "/org/freedesktop/secrets/aliases/"
24static inline constexpr size_t FDO_SECRETS_CIPHER_KEY_SIZE = 16;
25static inline constexpr int FDO_DH_PUBLIC_KEY_SIZE = 128;
29class FreedesktopSecret
32 FreedesktopSecret() =
default;
35 : session(std::
move(iSession))
37 , mimeType(std::
move(iMimeType))
55 static EntryLocation fromUniqueLabel(
const struct FdoUniqueLabel &uniqLabel);
56 struct FdoUniqueLabel toUniqueLabel() const;
58 bool operator==(
const EntryLocation &rhs)
const
60 return folder == rhs.folder && key == rhs.key;
63 bool operator!=(
const EntryLocation &rhs)
const
65 return !(*
this == rhs);
72struct FdoUniqueLabel {
73 static FdoUniqueLabel fromEntryLocation(
const EntryLocation &entryLocation);
74 static FdoUniqueLabel fromName(
const QString &name);
77 bool operator==(
const FdoUniqueLabel &rhs)
const
79 return copyId == rhs.copyId && label == rhs.label;
82 bool operator!=(
const FdoUniqueLabel &rhs)
const
84 return !(*
this == rhs);
88 EntryLocation toEntryLocation()
const;
97Q_DECLARE_METATYPE(FreedesktopSecret)
99Q_DECLARE_METATYPE(PropertiesMap)
103class KWalletFreedesktopSession;
104class KWalletFreedesktopSessionAlgorithm;
105class KWalletFreedesktopCollection;
106class KWalletFreedesktopPrompt;
107class KWalletFreedesktopItem;
109class KWalletFreedesktopService :
public QObject,
protected FDO_DBUS_CONTEXT
119 explicit KWalletFreedesktopService(KWalletD *
parent);
120 ~KWalletFreedesktopService();
122 KWalletFreedesktopService(
const KWalletFreedesktopService &) =
delete;
123 KWalletFreedesktopService &operator=(
const KWalletFreedesktopService &) =
delete;
125 KWalletFreedesktopService(KWalletFreedesktopService &&) =
delete;
126 KWalletFreedesktopService &operator=(KWalletFreedesktopService &&) =
delete;
131 KWalletD *backend()
const;
134 bool desecret(
const QDBusMessage &message, FreedesktopSecret &secret);
135 bool ensecret(
const QDBusMessage &message, FreedesktopSecret &secret);
136 KWalletFreedesktopItem *getItemByObjectPath(
const QDBusObjectPath &path)
const;
137 KWalletFreedesktopCollection *getCollectionByWalletName(
const QString &walletName)
const;
138 KWalletFreedesktopPrompt *getPromptByObjectPath(
const QDBusObjectPath &path)
const;
140 FdoUniqueLabel makeUniqueCollectionLabel(
const QString &label);
146 void createCollectionAlias(
const QString &alias, KWalletFreedesktopCollection *collection);
147 void createCollectionAlias(
const QString &alias,
const QString &walletName);
148 void updateCollectionAlias(
const QString &alias,
const QString &walletName);
149 void removeAlias(
const QString &alias);
151 void deletePrompt(
const QString &objectPath);
152 void deleteSession(
const QString &objectPath);
159 void onPropertiesChanged(
const QVariantMap &properties);
162 void lockCollection(
const QString &name);
166 void walletDeleted(
const QString &walletName);
167 void walletCreated(
const QString &walletCreated);
174 std::unique_ptr<KWalletFreedesktopSessionAlgorithm> createSessionAlgorithmPlain()
const;
175 std::unique_ptr<KWalletFreedesktopSessionAlgorithm> createSessionAlgorithmDhAes(
const QByteArray &clientKey)
const;
176 QString createSession(std::unique_ptr<KWalletFreedesktopSessionAlgorithm> algorithm);
180 std::map<QString, std::unique_ptr<KWalletFreedesktopSession>> m_sessions;
181 std::map<QString, std::unique_ptr<KWalletFreedesktopCollection>> m_collections;
182 std::map<QString, std::unique_ptr<KWalletFreedesktopPrompt>> m_prompts;
184 uint64_t m_session_counter = 0;
224void explicit_zero_mem(
void *data,
size_t size);
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
KIOCORE_EXPORT CopyJob * move(const QList< QUrl > &src, const QUrl &dest, JobFlags flags=DefaultFlags)
QObject * parent() const const