QXmpp Version: 1.10.0
Public Member Functions | List of all members
QXmppTrustManager Class Reference

The QXmppTrustManager manages end-to-end encryption trust decisions. More...

Inheritance diagram for QXmppTrustManager:
Inheritance graph
[legend]
Collaboration diagram for QXmppTrustManager:
Collaboration graph
[legend]

Public Member Functions

 QXmppTrustManager (QXmppTrustStorage *trustStorage)
 
QXmppTask< void > setSecurityPolicy (const QString &encryption, QXmpp::TrustSecurityPolicy securityPolicy)
 
QXmppTask< void > resetSecurityPolicy (const QString &encryption)
 
QXmppTask< QXmpp::TrustSecurityPolicysecurityPolicy (const QString &encryption)
 
QXmppTask< void > setOwnKey (const QString &encryption, const QByteArray &keyId)
 
QXmppTask< void > resetOwnKey (const QString &encryption)
 
QXmppTask< QByteArray > ownKey (const QString &encryption)
 
QXmppTask< void > addKeys (const QString &encryption, const QString &keyOwnerJid, const QList< QByteArray > &keyIds, QXmpp::TrustLevel trustLevel=QXmpp::TrustLevel::AutomaticallyDistrusted)
 
QXmppTask< void > removeKeys (const QString &encryption, const QList< QByteArray > &keyIds)
 
QXmppTask< void > removeKeys (const QString &encryption, const QString &keyOwnerJid)
 
QXmppTask< void > removeKeys (const QString &encryption)
 
QXmppTask< QHash< QXmpp::TrustLevel, QMultiHash< QString, QByteArray > > > keys (const QString &encryption, QXmpp::TrustLevels trustLevels={})
 
QXmppTask< QHash< QString, QHash< QByteArray, QXmpp::TrustLevel > > > keys (const QString &encryption, const QList< QString > &keyOwnerJids, QXmpp::TrustLevels trustLevels={})
 
QXmppTask< bool > hasKey (const QString &encryption, const QString &keyOwnerJid, QXmpp::TrustLevels trustLevels)
 
QXmppTask< void > setTrustLevel (const QString &encryption, const QMultiHash< QString, QByteArray > &keyIds, QXmpp::TrustLevel trustLevel)
 
QXmppTask< void > setTrustLevel (const QString &encryption, const QList< QString > &keyOwnerJids, QXmpp::TrustLevel oldTrustLevel, QXmpp::TrustLevel newTrustLevel)
 
QXmppTask< QXmpp::TrustLeveltrustLevel (const QString &encryption, const QString &keyOwnerJid, const QByteArray &keyId)
 
QXmppTask< void > resetAll (const QString &encryption)
 
Q_SIGNAL void trustLevelsChanged (const QHash< QString, QMultiHash< QString, QByteArray > > &modifiedKeys)
 
- Public Member Functions inherited from QXmppClientExtension
 QXmppClientExtension ()
 
virtual QStringList discoveryFeatures () const
 
virtual QList< QXmppDiscoveryIq::IdentitydiscoveryIdentities () const
 
virtual bool handleStanza (const QDomElement &stanza)
 You need to implement this method to process incoming XMPP stanzas. More...
 
virtual bool handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
 You need to implement this method to process incoming XMPP stanzas. More...
 
- Public Member Functions inherited from QXmppLoggable
 QXmppLoggable (QObject *parent=nullptr)
 

Additional Inherited Members

- Signals inherited from QXmppLoggable
void setGauge (const QString &gauge, double value)
 Sets the given gauge to value.
 
void logMessage (QXmppLogger::MessageType type, const QString &msg)
 This signal is emitted to send logging messages.
 
void updateCounter (const QString &counter, qint64 amount=1)
 Updates the given counter by amount.
 
- Protected Member Functions inherited from QXmppClientExtension
QXmppClientclient () const
 
virtual void setClient (QXmppClient *client)
 
virtual void onRegistered (QXmppClient *client)
 
virtual void onUnregistered (QXmppClient *client)
 
void injectIq (const QDomElement &element, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
 
bool injectMessage (QXmppMessage &&message)
 
- Protected Member Functions inherited from QXmppLoggable
void debug (const QString &message)
 
void info (const QString &message)
 
void warning (const QString &message)
 
void logReceived (const QString &message)
 
void logSent (const QString &message)
 

Detailed Description

The QXmppTrustManager manages end-to-end encryption trust decisions.

Warning
THIS API IS NOT FINALIZED YET!
Since
QXmpp 1.5

Constructor & Destructor Documentation

◆ QXmppTrustManager()

QXmppTrustManager::QXmppTrustManager ( QXmppTrustStorage trustStorage)

Constructs a trust manager.

Parameters
trustStoragetrust storage implementation

Member Function Documentation

◆ addKeys()

QXmppTask< void > QXmppTrustManager::addKeys ( const QString &  encryption,
const QString &  keyOwnerJid,
const QList< QByteArray > &  keyIds,
QXmpp::TrustLevel  trustLevel = QXmpp::TrustLevel::AutomaticallyDistrusted 
)

Adds keys.

Parameters
encryptionencryption protocol namespace
keyOwnerJidkey owner's bare JID
keyIdsIDs of the keys
trustLeveltrust level of the keys

◆ hasKey()

QXmppTask< bool > QXmppTrustManager::hasKey ( const QString &  encryption,
const QString &  keyOwnerJid,
QXmpp::TrustLevels  trustLevels 
)

Returns whether at least one key of a key owner with a specific trust level is stored.

Parameters
encryptionencryption protocol namespace
keyOwnerJidkey owner's bare JID
trustLevelspossible trust levels of the key
Returns
whether a key of the key owner with a passed trust level is stored

◆ keys() [1/2]

QXmppTask< QHash< QString, QHash< QByteArray, QXmpp::TrustLevel > > > QXmppTrustManager::keys ( const QString &  encryption,
const QList< QString > &  keyOwnerJids,
QXmpp::TrustLevels  trustLevels = {} 
)

Returns the IDs of keys mapped to their trust levels for specific key owners.

If no trust levels are passed, all keys for encryption and keyOwnerJids are returned.

Parameters
encryptionencryption protocol namespace
keyOwnerJidskey owners' bare JIDs
trustLevelstrust levels of the keys
Returns
the key IDs mapped to their trust levels for specific key owners

◆ keys() [2/2]

QXmppTask< QHash< QXmpp::TrustLevel, QMultiHash< QString, QByteArray > > > QXmppTrustManager::keys ( const QString &  encryption,
QXmpp::TrustLevels  trustLevels = {} 
)

Returns the JIDs of all key owners mapped to the IDs of their keys with specific trust levels.

If no trust levels are passed, all keys for encryption are returned.

Parameters
encryptionencryption protocol namespace
trustLevelstrust levels of the keys
Returns
the key owner JIDs mapped to their keys with specific trust levels

◆ ownKey()

QXmppTask< QByteArray > QXmppTrustManager::ownKey ( const QString &  encryption)

Returns the own key (i.e., the key used by this client instance) for an encryption protocol.

Parameters
encryptionencryption protocol namespace
Returns
the ID of the own key

◆ removeKeys() [1/3]

QXmppTask< void > QXmppTrustManager::removeKeys ( const QString &  encryption)

Removes all keys for encryption.

Parameters
encryptionencryption protocol namespace

◆ removeKeys() [2/3]

QXmppTask< void > QXmppTrustManager::removeKeys ( const QString &  encryption,
const QList< QByteArray > &  keyIds 
)

Removes keys.

Parameters
encryptionencryption protocol namespace
keyIdsIDs of the keys

◆ removeKeys() [3/3]

QXmppTask< void > QXmppTrustManager::removeKeys ( const QString &  encryption,
const QString &  keyOwnerJid 
)

Removes all keys of a key owner.

Parameters
encryptionencryption protocol namespace
keyOwnerJidkey owner's bare JID

◆ resetAll()

QXmppTask< void > QXmppTrustManager::resetAll ( const QString &  encryption)

Resets all data for encryption.

Parameters
encryptionencryption protocol namespace

◆ resetOwnKey()

QXmppTask< void > QXmppTrustManager::resetOwnKey ( const QString &  encryption)

Resets the own key (i.e., the key used by this client instance) for an encryption protocol.

Parameters
encryptionencryption protocol namespace

◆ resetSecurityPolicy()

QXmppTask< void > QXmppTrustManager::resetSecurityPolicy ( const QString &  encryption)

Resets the security policy for an encryption protocol.

Parameters
encryptionencryption protocol namespace

◆ securityPolicy()

QXmppTask< TrustSecurityPolicy > QXmppTrustManager::securityPolicy ( const QString &  encryption)

Returns the security policy for an encryption protocol.

Parameters
encryptionencryption protocol namespace
Returns
the set security policy

◆ setOwnKey()

QXmppTask< void > QXmppTrustManager::setOwnKey ( const QString &  encryption,
const QByteArray &  keyId 
)

Sets the own key (i.e., the key used by this client instance) for an encryption protocol.

Parameters
encryptionencryption protocol namespace
keyIdID of the key

◆ setSecurityPolicy()

QXmppTask< void > QXmppTrustManager::setSecurityPolicy ( const QString &  encryption,
QXmpp::TrustSecurityPolicy  securityPolicy 
)

Sets the security policy for an encryption protocol.

Parameters
encryptionencryption protocol namespace
securityPolicysecurity policy being applied

◆ setTrustLevel() [1/2]

QXmppTask< void > QXmppTrustManager::setTrustLevel ( const QString &  encryption,
const QList< QString > &  keyOwnerJids,
QXmpp::TrustLevel  oldTrustLevel,
QXmpp::TrustLevel  newTrustLevel 
)

Sets the trust level of keys specified by their key owner and trust level.

Parameters
encryptionencryption protocol namespace
keyOwnerJidskey owners' bare JIDs
oldTrustLeveltrust level being changed
newTrustLeveltrust level being set

◆ setTrustLevel() [2/2]

QXmppTask< void > QXmppTrustManager::setTrustLevel ( const QString &  encryption,
const QMultiHash< QString, QByteArray > &  keyIds,
QXmpp::TrustLevel  trustLevel 
)

Sets the trust level of keys.

If a key is not stored, it is added to the storage.

Parameters
encryptionencryption protocol namespace
keyIdskey owners' bare JIDs mapped to the IDs of their keys
trustLeveltrust level being set

◆ trustLevel()

QXmppTask< TrustLevel > QXmppTrustManager::trustLevel ( const QString &  encryption,
const QString &  keyOwnerJid,
const QByteArray &  keyId 
)

Returns the trust level of a key.

If the key is not stored, the trust in that key is undecided.

Parameters
encryptionencryption protocol namespace
keyOwnerJidkey owner's bare JID
keyIdID of the key
Returns
the key's trust level

◆ trustLevelsChanged()

QXmppTrustManager::trustLevelsChanged ( const QHash< QString, QMultiHash< QString, QByteArray > > &  modifiedKeys)

Emitted when the trust levels of keys changed because setTrustLevel() added a new key or modified an existing one.

Parameters
modifiedKeyskey owners' bare JIDs mapped to their modified keys for specific encryption protocol namespaces

The documentation for this class was generated from the following files: