QXmpp: QXmppTrustManager Class Reference

QXmpp Version: 1.14.3

Loading...
Searching...
No Matches
QXmppTrustManager Class Reference
Managers

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

Inheritance diagram for QXmppTrustManager:

## Public Member Functions
| QXmppTrustManager (QXmppTrustStorage *trustStorage)
QXmppTask< void > | setSecurityPolicy (const QString &encryption, QXmpp::TrustSecurityPolicy securityPolicy)
QXmppTask< void > | resetSecurityPolicy (const QString &encryption)
QXmppTask< QXmpp::TrustSecurityPolicy > | securityPolicy (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::TrustLevel > | trustLevel (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< QXmppDiscoIdentity > | discoveryIdentities () const
virtual bool | handleStanza (const QDomElement &stanza)
| You need to implement this method to process incoming XMPP stanzas.
virtual bool | handleStanza (const QDomElement &stanza, const std::optional< QXmppE2eeMetadata > &e2eeMetadata)
| You need to implement this method to process incoming XMPP stanzas.
Public Member Functions inherited from QXmppLoggable
| QXmppLoggable (QObject *parent=nullptr)
Q_SIGNAL void | setGauge (const QString &gauge, double value)
| Sets the given gauge to value.
Q_SIGNAL void | logMessage (QXmppLogger::MessageType type, const QString &msg)
| This signal is emitted to send logging messages.
Q_SIGNAL void | updateCounter (const QString &counter, qint64 amount=1)
| Updates the given counter by amount.

## Additional Inherited Members
Protected Member Functions inherited from QXmppClientExtension
QXmppClient * | client () 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)
| Logs a debugging message.
void | info (const QString &message)
| Logs an informational message.
void | warning (const QString &message)
| Logs a warning message.
void | logReceived (const QString &message)
| Logs a received packet.
void | logSent (const QString &message)
| Logs a sent packet.

## Detailed Description

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

Since
  QXmpp 1.5

## Constructor & Destructor Documentation

## ◆ QXmppTrustManager()

QXmppTrustManager::QXmppTrustManager | ( | QXmppTrustStorage * | trustStorage | ) |

Constructs a trust manager.

Parameters

  trustStorage | trust 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

  encryption | encryption protocol namespace
  keyOwnerJid | key owner's bare JID
  keyIds | IDs of the keys
  trustLevel | trust 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

  encryption | encryption protocol namespace
  keyOwnerJid | key owner's bare JID
  trustLevels | possible 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

  encryption | encryption protocol namespace
  keyOwnerJids | key owners' bare JIDs
  trustLevels | trust 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

  encryption | encryption protocol namespace
  trustLevels | trust 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

  encryption | encryption 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

  encryption | encryption protocol namespace

## ◆ removeKeys() [2/3]

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

Removes keys.

Parameters

  encryption | encryption protocol namespace
  keyIds | IDs of the keys

## ◆ removeKeys() [3/3]

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

Removes all keys of a key owner.

Parameters

  encryption | encryption protocol namespace
  keyOwnerJid | key owner's bare JID

## ◆ resetAll()

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

Resets all data for encryption.

Parameters

  encryption | encryption 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

  encryption | encryption protocol namespace

## ◆ resetSecurityPolicy()

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

Resets the security policy for an encryption protocol.

Parameters

  encryption | encryption protocol namespace

## ◆ securityPolicy()

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

Returns the security policy for an encryption protocol.

Parameters

  encryption | encryption 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

  encryption | encryption protocol namespace
  keyId | ID of the key

## ◆ setSecurityPolicy()

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

Sets the security policy for an encryption protocol.

Parameters

  encryption | encryption protocol namespace
  securityPolicy | security 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

  encryption | encryption protocol namespace
  keyOwnerJids | key owners' bare JIDs
  oldTrustLevel | trust level being changed
  newTrustLevel | trust 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

  encryption | encryption protocol namespace
  keyIds | key owners' bare JIDs mapped to the IDs of their keys
  trustLevel | trust 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

  encryption | encryption protocol namespace
  keyOwnerJid | key owner's bare JID
  keyId | ID of the key

Returns
  the key's trust level

## ◆ trustLevelsChanged()

Q_SIGNAL void 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

  modifiedKeys | key owners' bare JIDs mapped to their modified keys for specific encryption protocol namespaces

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

- QXmppTrustManager.h
- QXmppTrustManager.cpp