mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
FdoSecrets: Major Refactor and Code Consolidation (#5747)
* Fixes #3837 * Change objects to use DBusMgr rather than separate adaptors - Update all DBus invokable methods to new parameter order - Change all usage of DBusReturn to simpler DBusResult - Use DBusMgr to handle path and service registration - Remove adaptor/* - Set path in DBusObject - Unregister service when service is destroyed - Restore handling of invalid QVariant in prompt complete signal - Clean up meta type registration - Move dbus related file together - Convert to QSharedPointer as much as possible - Fix mapping of the Delete method - Handle dbus property get all * Add per-client states - Move cipher negotiation to DBusClient - Show list of clients instead of sessions in the settings page - Add settings for confirmation of accessing items - Fix infinite recursion when client disconnected - Use optional explicit DBusClient parameter instead. This makes accessing the client info in an async context explicit, and thus prevent accidental assertions in prompts. * Improve User Interface - Add per-item access confirmation (if enabled) - Remove the "disable for site" button for the access control dialog - Improve the text on the settings page to be more consistent - Fix disconnect buttons in settings page not working - Make the unlock prompt method nonblocking * Fix and cleanup unit tests - Use QTRY_COMPARE when checking signal spies, as dbus signals are threaded - Fixes in meta type registration and type conversion - Remove QStringLiteral in COMPARE macros, making diff output readable - Add testing for remembering auth decision
This commit is contained in:
@@ -20,13 +20,13 @@
|
||||
#include "TestGlobal.h"
|
||||
|
||||
#include "core/EntrySearcher.h"
|
||||
#include "crypto/Crypto.h"
|
||||
#include "fdosecrets/GcryptMPI.h"
|
||||
#include "fdosecrets/dbus/DBusMgr.h"
|
||||
#include "fdosecrets/objects/Collection.h"
|
||||
#include "fdosecrets/objects/Item.h"
|
||||
#include "fdosecrets/objects/SessionCipher.h"
|
||||
|
||||
#include "crypto/Crypto.h"
|
||||
|
||||
QTEST_GUILESS_MAIN(TestFdoSecrets)
|
||||
|
||||
void TestFdoSecrets::initTestCase()
|
||||
@@ -144,3 +144,39 @@ void TestFdoSecrets::testSpecialCharsInAttributeValue()
|
||||
QCOMPARE(res[0]->title(), QStringLiteral("titleB"));
|
||||
}
|
||||
}
|
||||
|
||||
void TestFdoSecrets::testDBusPathParse()
|
||||
{
|
||||
using FdoSecrets::DBusMgr;
|
||||
using PathType = FdoSecrets::DBusMgr::PathType;
|
||||
|
||||
auto parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/secrets"));
|
||||
QCOMPARE(parsed.type, PathType::Service);
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/secrets/collection/xxx"));
|
||||
QCOMPARE(parsed.type, PathType::Collection);
|
||||
QCOMPARE(parsed.id, QStringLiteral("xxx"));
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/secrets/collection/xxx/yyy"));
|
||||
QCOMPARE(parsed.type, PathType::Item);
|
||||
QCOMPARE(parsed.id, QStringLiteral("yyy"));
|
||||
QCOMPARE(parsed.parentId, QStringLiteral("xxx"));
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/secrets/aliases/xxx"));
|
||||
QCOMPARE(parsed.type, PathType::Aliases);
|
||||
QCOMPARE(parsed.id, QStringLiteral("xxx"));
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/secrets/session/xxx"));
|
||||
QCOMPARE(parsed.type, PathType::Session);
|
||||
QCOMPARE(parsed.id, QStringLiteral("xxx"));
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/secrets/prompt/xxx"));
|
||||
QCOMPARE(parsed.type, PathType::Prompt);
|
||||
QCOMPARE(parsed.id, QStringLiteral("xxx"));
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org/freedesktop/other/prompt/xxx"));
|
||||
QCOMPARE(parsed.type, PathType::Unknown);
|
||||
|
||||
parsed = DBusMgr::parsePath(QStringLiteral("/org"));
|
||||
QCOMPARE(parsed.type, PathType::Unknown);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ private slots:
|
||||
void testDhIetf1024Sha256Aes128CbcPkcs7();
|
||||
void testCrazyAttributeKey();
|
||||
void testSpecialCharsInAttributeValue();
|
||||
void testDBusPathParse();
|
||||
};
|
||||
|
||||
#endif // KEEPASSXC_TESTFDOSECRETS_H
|
||||
|
||||
Binary file not shown.
@@ -1,33 +0,0 @@
|
||||
<interface name="org.freedesktop.Secret.Collection">
|
||||
<property name="Items" type="ao" access="read"/>
|
||||
<property name="Label" type="s" access="readwrite"/>
|
||||
<property name="Locked" type="b" access="read"/>
|
||||
<property name="Created" type="t" access="read"/>
|
||||
<property name="Modified" type="t" access="read"/>
|
||||
<signal name="ItemCreated">
|
||||
<arg name="item" type="o" direction="out"/>
|
||||
</signal>
|
||||
<signal name="ItemDeleted">
|
||||
<arg name="item" type="o" direction="out"/>
|
||||
</signal>
|
||||
<signal name="ItemChanged">
|
||||
<arg name="item" type="o" direction="out"/>
|
||||
</signal>
|
||||
<method name="Delete">
|
||||
<arg type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="SearchItems">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="attributes" type="a{ss}" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="StringStringMap"/>
|
||||
</method>
|
||||
<method name="CreateItem">
|
||||
<arg type="o" direction="out"/>
|
||||
<arg name="properties" type="a{sv}" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
<arg name="secret" type="(oayays)" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="FdoSecrets::SecretStruct"/>
|
||||
<arg name="replace" type="b" direction="in"/>
|
||||
<arg name="prompt" type="o" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
@@ -1,21 +0,0 @@
|
||||
<interface name="org.freedesktop.Secret.Item">
|
||||
<property name="Locked" type="b" access="read"/>
|
||||
<property name="Attributes" type="a{ss}" access="readwrite">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="StringStringMap"/>
|
||||
</property>
|
||||
<property name="Label" type="s" access="readwrite"/>
|
||||
<property name="Created" type="t" access="read"/>
|
||||
<property name="Modified" type="t" access="read"/>
|
||||
<method name="Delete">
|
||||
<arg type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="GetSecret">
|
||||
<arg type="(oayays)" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="FdoSecrets::SecretStruct"/>
|
||||
<arg name="session" type="o" direction="in"/>
|
||||
</method>
|
||||
<method name="SetSecret">
|
||||
<arg name="secret" type="(oayays)" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="FdoSecrets::SecretStruct"/>
|
||||
</method>
|
||||
</interface>
|
||||
@@ -1,11 +0,0 @@
|
||||
<interface name="org.freedesktop.Secret.Prompt">
|
||||
<signal name="Completed">
|
||||
<arg name="dismissed" type="b" direction="out"/>
|
||||
<arg name="result" type="v" direction="out"/>
|
||||
</signal>
|
||||
<method name="Prompt">
|
||||
<arg name="windowId" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="Dismiss">
|
||||
</method>
|
||||
</interface>
|
||||
@@ -1,55 +0,0 @@
|
||||
<interface name="org.freedesktop.Secret.Service">
|
||||
<property name="Collections" type="ao" access="read"/>
|
||||
<signal name="CollectionCreated">
|
||||
<arg name="collection" type="o" direction="out"/>
|
||||
</signal>
|
||||
<signal name="CollectionDeleted">
|
||||
<arg name="collection" type="o" direction="out"/>
|
||||
</signal>
|
||||
<signal name="CollectionChanged">
|
||||
<arg name="collection" type="o" direction="out"/>
|
||||
</signal>
|
||||
<method name="OpenSession">
|
||||
<arg type="v" direction="out"/>
|
||||
<arg name="algorithm" type="s" direction="in"/>
|
||||
<arg name="input" type="v" direction="in"/>
|
||||
<arg name="result" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="CreateCollection">
|
||||
<arg type="o" direction="out"/>
|
||||
<arg name="properties" type="a{sv}" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
|
||||
<arg name="alias" type="s" direction="in"/>
|
||||
<arg name="prompt" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="SearchItems">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="attributes" type="a{ss}" direction="in"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="StringStringMap"/>
|
||||
<arg name="locked" type="ao" direction="out"/>
|
||||
</method>
|
||||
<method name="Unlock">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="paths" type="ao" direction="in"/>
|
||||
<arg name="prompt" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="Lock">
|
||||
<arg type="ao" direction="out"/>
|
||||
<arg name="paths" type="ao" direction="in"/>
|
||||
<arg name="prompt" type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="GetSecrets">
|
||||
<arg type="a{o(oayays)}" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ObjectPathSecretMap"/>
|
||||
<arg name="items" type="ao" direction="in"/>
|
||||
<arg name="session" type="o" direction="in"/>
|
||||
</method>
|
||||
<method name="ReadAlias">
|
||||
<arg type="o" direction="out"/>
|
||||
<arg name="name" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="SetAlias">
|
||||
<arg name="name" type="s" direction="in"/>
|
||||
<arg name="collection" type="o" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
@@ -1,4 +0,0 @@
|
||||
<interface name="org.freedesktop.Secret.Session">
|
||||
<method name="Close">
|
||||
</method>
|
||||
</interface>
|
||||
@@ -24,7 +24,7 @@ endif()
|
||||
|
||||
if(WITH_XC_FDOSECRETS)
|
||||
add_unit_test(NAME testguifdosecrets
|
||||
SOURCES TestGuiFdoSecrets.cpp ../util/TemporaryFile.cpp
|
||||
SOURCES TestGuiFdoSecrets.cpp ../util/TemporaryFile.cpp ../util/FdoSecretsProxy.cpp
|
||||
LIBS ${TEST_LIBRARIES}
|
||||
# The following doesn't work because dbus-run-session expects execname to be in PATH
|
||||
# dbus-run-session -- execname
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,14 +19,14 @@
|
||||
#define KEEPASSXC_TESTGUIFDOSECRETS_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
#include <QDBusConnection>
|
||||
#include <QPointer>
|
||||
#include <QScopedPointer>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
|
||||
#include "fdosecrets/GcryptMPI.h"
|
||||
#include "fdosecrets/objects/DBusTypes.h"
|
||||
#include "fdosecrets/dbus/DBusTypes.h"
|
||||
|
||||
class MainWindow;
|
||||
class Database;
|
||||
@@ -42,7 +42,13 @@ namespace FdoSecrets
|
||||
class Item;
|
||||
class Prompt;
|
||||
class DhIetf1024Sha256Aes128CbcPkcs7;
|
||||
class DBusClient;
|
||||
} // namespace FdoSecrets
|
||||
class ServiceProxy;
|
||||
class CollectionProxy;
|
||||
class ItemProxy;
|
||||
class SessionProxy;
|
||||
class PromptProxy;
|
||||
|
||||
class QAbstractItemView;
|
||||
|
||||
@@ -59,12 +65,11 @@ private slots:
|
||||
void cleanup();
|
||||
void cleanupTestCase();
|
||||
|
||||
void testDBusSpec();
|
||||
|
||||
void testServiceEnable();
|
||||
void testServiceEnableNoExposedDatabase();
|
||||
void testServiceSearch();
|
||||
void testServiceUnlock();
|
||||
void testServiceUnlockItems();
|
||||
void testServiceLock();
|
||||
|
||||
void testSessionOpen();
|
||||
@@ -72,11 +77,15 @@ private slots:
|
||||
|
||||
void testCollectionCreate();
|
||||
void testCollectionDelete();
|
||||
void testCollectionChange();
|
||||
|
||||
void testItemCreate();
|
||||
void testItemChange();
|
||||
void testItemReplace();
|
||||
void testItemReplaceExistingLocked();
|
||||
void testItemSecret();
|
||||
void testItemDelete();
|
||||
void testItemLockState();
|
||||
|
||||
void testAlias();
|
||||
void testDefaultAliasAlwaysPresent();
|
||||
@@ -88,21 +97,38 @@ private slots:
|
||||
void testDuplicateName();
|
||||
|
||||
protected slots:
|
||||
void createDatabaseCallback();
|
||||
void driveNewDatabaseWizard();
|
||||
bool driveAccessControlDialog(bool remember = true);
|
||||
|
||||
private:
|
||||
void lockDatabaseInBackend();
|
||||
void unlockDatabaseInBackend();
|
||||
QPointer<FdoSecrets::Service> enableService();
|
||||
QPointer<FdoSecrets::Session> openSession(FdoSecrets::Service* service, const QString& algo);
|
||||
QPointer<FdoSecrets::Collection> getDefaultCollection(FdoSecrets::Service* service);
|
||||
QPointer<FdoSecrets::Item> getFirstItem(FdoSecrets::Collection* coll);
|
||||
QPointer<FdoSecrets::Item> createItem(FdoSecrets::Session* sess,
|
||||
FdoSecrets::Collection* coll,
|
||||
const QString& label,
|
||||
const QString& pass,
|
||||
const StringStringMap& attr,
|
||||
bool replace);
|
||||
QSharedPointer<ServiceProxy> enableService();
|
||||
QSharedPointer<SessionProxy> openSession(const QSharedPointer<ServiceProxy>& service, const QString& algo);
|
||||
QSharedPointer<CollectionProxy> getDefaultCollection(const QSharedPointer<ServiceProxy>& service);
|
||||
QSharedPointer<ItemProxy> getFirstItem(const QSharedPointer<CollectionProxy>& coll);
|
||||
QSharedPointer<ItemProxy> createItem(const QSharedPointer<SessionProxy>& sess,
|
||||
const QSharedPointer<CollectionProxy>& coll,
|
||||
const QString& label,
|
||||
const QString& pass,
|
||||
const FdoSecrets::wire::StringStringMap& attr,
|
||||
bool replace,
|
||||
bool expectPrompt = false);
|
||||
template <typename Proxy> QSharedPointer<Proxy> getProxy(const QDBusObjectPath& path) const
|
||||
{
|
||||
auto ret = QSharedPointer<Proxy>{
|
||||
new Proxy(QStringLiteral("org.freedesktop.secrets"), path.path(), QDBusConnection::sessionBus())};
|
||||
if (!ret->isValid()) {
|
||||
return {};
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
template <typename T> T getSignalVariantArgument(const QVariant& arg)
|
||||
{
|
||||
const auto& in = arg.value<QDBusVariant>().variant();
|
||||
return qdbus_cast<T>(in);
|
||||
}
|
||||
|
||||
private:
|
||||
QScopedPointer<MainWindow> m_mainWindow;
|
||||
@@ -111,6 +137,7 @@ private:
|
||||
QSharedPointer<Database> m_db;
|
||||
|
||||
QPointer<FdoSecretsPlugin> m_plugin;
|
||||
QSharedPointer<FdoSecrets::DBusClient> m_client;
|
||||
|
||||
// For DH session tests
|
||||
GcryptMPI m_serverPrivate;
|
||||
|
||||
34
tests/util/FdoSecretsProxy.cpp
Normal file
34
tests/util/FdoSecretsProxy.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Aetf <aetf@unlimitedcodeworks.xyz>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 or (at your option)
|
||||
* version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "FdoSecretsProxy.h"
|
||||
|
||||
#define IMPL_PROXY(name) \
|
||||
name##Proxy::name##Proxy( \
|
||||
const QString& service, const QString& path, const QDBusConnection& connection, QObject* parent) \
|
||||
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) \
|
||||
{ \
|
||||
} \
|
||||
name##Proxy::~name##Proxy() = default;
|
||||
|
||||
IMPL_PROXY(Service)
|
||||
IMPL_PROXY(Collection)
|
||||
IMPL_PROXY(Item)
|
||||
IMPL_PROXY(Session)
|
||||
IMPL_PROXY(Prompt)
|
||||
|
||||
#undef IMPL_PROXY
|
||||
402
tests/util/FdoSecretsProxy.h
Normal file
402
tests/util/FdoSecretsProxy.h
Normal file
@@ -0,0 +1,402 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Aetf <aetf@unlimitedcodeworks.xyz>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 or (at your option)
|
||||
* version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef KEEPASSXC_FDOSECRETSPROXY_H
|
||||
#define KEEPASSXC_FDOSECRETSPROXY_H
|
||||
|
||||
#include "fdosecrets/dbus/DBusTypes.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QtDBus>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
/**
|
||||
* Mimic the interface of QDBusPendingReply so the same code can be used in test
|
||||
*/
|
||||
template <typename T> class PropertyReply
|
||||
{
|
||||
QDBusPendingReply<QDBusVariant> m_reply;
|
||||
|
||||
public:
|
||||
/*implicit*/ PropertyReply(const QDBusMessage& reply)
|
||||
: m_reply(reply)
|
||||
{
|
||||
}
|
||||
bool isFinished() const
|
||||
{
|
||||
return m_reply.isFinished();
|
||||
}
|
||||
bool isValid() const
|
||||
{
|
||||
return m_reply.isValid();
|
||||
}
|
||||
bool isError() const
|
||||
{
|
||||
return m_reply.isError();
|
||||
}
|
||||
QDBusError error() const
|
||||
{
|
||||
return m_reply.error();
|
||||
}
|
||||
T value() const
|
||||
{
|
||||
return qdbus_cast<T>(m_reply.value().variant());
|
||||
}
|
||||
template <int> T argumentAt() const
|
||||
{
|
||||
return value();
|
||||
}
|
||||
};
|
||||
|
||||
#define IMPL_GET_PROPERTY(name) \
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall( \
|
||||
service(), path(), QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("Get")); \
|
||||
msg << interface() << QStringLiteral(#name); \
|
||||
return \
|
||||
{ \
|
||||
connection().call(msg, QDBus::BlockWithGui) \
|
||||
}
|
||||
|
||||
#define IMPL_SET_PROPERTY(name, value) \
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall( \
|
||||
service(), path(), QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("Set")); \
|
||||
msg << interface() << QStringLiteral(#name) << QVariant::fromValue(QDBusVariant(QVariant::fromValue(value))); \
|
||||
return \
|
||||
{ \
|
||||
connection().call(msg, QDBus::BlockWithGui) \
|
||||
}
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.freedesktop.Secret.Service
|
||||
*/
|
||||
class ServiceProxy : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static inline const char* staticInterfaceName()
|
||||
{
|
||||
return "org.freedesktop.Secret.Service";
|
||||
}
|
||||
|
||||
public:
|
||||
ServiceProxy(const QString& service,
|
||||
const QString& path,
|
||||
const QDBusConnection& connection,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
~ServiceProxy() override;
|
||||
|
||||
inline PropertyReply<QList<QDBusObjectPath>> collections() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Collections);
|
||||
}
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<QDBusObjectPath, QDBusObjectPath> CreateCollection(const QVariantMap& properties,
|
||||
const QString& alias)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(properties) << QVariant::fromValue(alias);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("CreateCollection"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<FdoSecrets::wire::ObjectPathSecretMap> GetSecrets(const QList<QDBusObjectPath>& items,
|
||||
const QDBusObjectPath& session)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(items) << QVariant::fromValue(session);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("GetSecrets"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QList<QDBusObjectPath>, QDBusObjectPath> Lock(const QList<QDBusObjectPath>& paths)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(paths);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Lock"), argumentList)};
|
||||
}
|
||||
inline QDBusPendingReply<QDBusVariant, QDBusObjectPath> OpenSession(const QString& algorithm,
|
||||
const QDBusVariant& input)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(algorithm) << QVariant::fromValue(input);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("OpenSession"), argumentList)};
|
||||
}
|
||||
inline QDBusPendingReply<QDBusObjectPath> ReadAlias(const QString& name)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(name);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("ReadAlias"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QList<QDBusObjectPath>, QList<QDBusObjectPath>>
|
||||
SearchItems(FdoSecrets::wire::StringStringMap attributes)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(attributes);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("SearchItems"), argumentList)};
|
||||
}
|
||||
inline QDBusPendingReply<> SetAlias(const QString& name, const QDBusObjectPath& collection)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(name) << QVariant::fromValue(collection);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("SetAlias"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QList<QDBusObjectPath>, QDBusObjectPath> Unlock(const QList<QDBusObjectPath>& paths)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(paths);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Unlock"), argumentList)};
|
||||
}
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void CollectionChanged(const QDBusObjectPath& collection);
|
||||
void CollectionCreated(const QDBusObjectPath& collection);
|
||||
void CollectionDeleted(const QDBusObjectPath& collection);
|
||||
};
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.freedesktop.Secret.Collection
|
||||
*/
|
||||
class CollectionProxy : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static inline const char* staticInterfaceName()
|
||||
{
|
||||
return "org.freedesktop.Secret.Collection";
|
||||
}
|
||||
|
||||
public:
|
||||
CollectionProxy(const QString& service,
|
||||
const QString& path,
|
||||
const QDBusConnection& connection,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
~CollectionProxy() override;
|
||||
|
||||
inline PropertyReply<qulonglong> created() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Created);
|
||||
}
|
||||
|
||||
inline PropertyReply<QList<QDBusObjectPath>> items() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Items);
|
||||
}
|
||||
|
||||
inline PropertyReply<QString> label() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Label);
|
||||
}
|
||||
inline QDBusPendingReply<> setLabel(const QString& value)
|
||||
{
|
||||
IMPL_SET_PROPERTY(Label, value);
|
||||
}
|
||||
|
||||
inline PropertyReply<bool> locked() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Locked);
|
||||
}
|
||||
|
||||
inline PropertyReply<qulonglong> modified() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Modified);
|
||||
}
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<QDBusObjectPath, QDBusObjectPath>
|
||||
CreateItem(const QVariantMap& properties, FdoSecrets::wire::Secret secret, bool replace)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(properties) << QVariant::fromValue(secret) << QVariant::fromValue(replace);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("CreateItem"), argumentList)};
|
||||
}
|
||||
inline QDBusPendingReply<QDBusObjectPath> Delete()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Delete"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QList<QDBusObjectPath>> SearchItems(FdoSecrets::wire::StringStringMap attributes)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(attributes);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("SearchItems"), argumentList)};
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void ItemChanged(const QDBusObjectPath& item);
|
||||
void ItemCreated(const QDBusObjectPath& item);
|
||||
void ItemDeleted(const QDBusObjectPath& item);
|
||||
};
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.freedesktop.Secret.Item
|
||||
*/
|
||||
class ItemProxy : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static inline const char* staticInterfaceName()
|
||||
{
|
||||
return "org.freedesktop.Secret.Item";
|
||||
}
|
||||
|
||||
public:
|
||||
ItemProxy(const QString& service,
|
||||
const QString& path,
|
||||
const QDBusConnection& connection,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
~ItemProxy() override;
|
||||
|
||||
inline PropertyReply<FdoSecrets::wire::StringStringMap> attributes() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Attributes);
|
||||
}
|
||||
inline QDBusPendingReply<> setAttributes(FdoSecrets::wire::StringStringMap value)
|
||||
{
|
||||
IMPL_SET_PROPERTY(Attributes, value);
|
||||
}
|
||||
|
||||
inline PropertyReply<qulonglong> created() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Created);
|
||||
}
|
||||
|
||||
inline PropertyReply<QString> label() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Label);
|
||||
}
|
||||
inline QDBusPendingReply<> setLabel(const QString& value)
|
||||
{
|
||||
IMPL_SET_PROPERTY(Label, value);
|
||||
}
|
||||
|
||||
inline PropertyReply<bool> locked() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Locked);
|
||||
}
|
||||
|
||||
inline PropertyReply<qulonglong> modified() const
|
||||
{
|
||||
IMPL_GET_PROPERTY(Modified);
|
||||
}
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<QDBusObjectPath> Delete()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Delete"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<FdoSecrets::wire::Secret> GetSecret(const QDBusObjectPath& session)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(session);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("GetSecret"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetSecret(FdoSecrets::wire::Secret secret)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(secret);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("SetSecret"), argumentList)};
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
};
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.freedesktop.Secret.Session
|
||||
*/
|
||||
class SessionProxy : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static inline const char* staticInterfaceName()
|
||||
{
|
||||
return "org.freedesktop.Secret.Session";
|
||||
}
|
||||
|
||||
public:
|
||||
SessionProxy(const QString& service,
|
||||
const QString& path,
|
||||
const QDBusConnection& connection,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
~SessionProxy() override;
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> Close()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Close"), argumentList)};
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
};
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.freedesktop.Secret.Prompt
|
||||
*/
|
||||
class PromptProxy : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static inline const char* staticInterfaceName()
|
||||
{
|
||||
return "org.freedesktop.Secret.Prompt";
|
||||
}
|
||||
|
||||
public:
|
||||
PromptProxy(const QString& service,
|
||||
const QString& path,
|
||||
const QDBusConnection& connection,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
~PromptProxy() override;
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> Dismiss()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Dismiss"), argumentList)};
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Prompt(const QString& windowId)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(windowId);
|
||||
return {callWithArgumentList(QDBus::BlockWithGui, QStringLiteral("Prompt"), argumentList)};
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void Completed(bool dismissed, const QDBusVariant& result);
|
||||
};
|
||||
|
||||
#undef IMPL_GET_PROPERTY
|
||||
#undef IMPL_SET_PROPERTY
|
||||
|
||||
#endif // KEEPASSXC_FDOSECRETSPROXY_H
|
||||
Reference in New Issue
Block a user