libQuotient
A Qt library for building matrix clients
Quotient::QOlmAccount Class Reference

#include <qolmaccount.h>

Inheritance diagram for Quotient::QOlmAccount:
Collaboration diagram for Quotient::QOlmAccount:

Signals

void needsSave ()
 

Public Member Functions

 QOlmAccount (QString userId, QString deviceId, QObject *parent=nullptr)
 
void setupNewAccount ()
 
OlmErrorCode unpickle (QByteArray &&pickled, const PicklingKey &key)
 
QByteArray pickle (const PicklingKey &key) const
 Serialises an OlmAccount to encrypted Base64. More...
 
IdentityKeys identityKeys () const
 Returns the account's public identity keys already formatted as JSON. More...
 
QByteArray sign (const QByteArray &message) const
 Returns the signature of the supplied message. More...
 
QByteArray sign (const QJsonObject &message) const
 
QByteArray signIdentityKeys () const
 Sign identity keys. More...
 
size_t maxNumberOfOneTimeKeys () const
 
size_t generateOneTimeKeys (size_t numberOfKeys)
 Generates the supplied number of one time keys. More...
 
UnsignedOneTimeKeys oneTimeKeys () const
 Gets the OlmAccount's one time keys formatted as JSON. More...
 
OneTimeKeys signOneTimeKeys (const UnsignedOneTimeKeys &keys) const
 Sign all one time keys. More...
 
UploadKeysJobcreateUploadKeyRequest (const UnsignedOneTimeKeys &oneTimeKeys) const
 
DeviceKeys deviceKeys () const
 
OlmErrorCode removeOneTimeKeys (const QOlmSession &session)
 Remove the one time key used to create the supplied session. More...
 
QOlmExpected< QOlmSessioncreateInboundSession (const QOlmMessage &preKeyMessage) const
 
QOlmExpected< QOlmSessioncreateInboundSessionFrom (const QByteArray &theirIdentityKey, const QOlmMessage &preKeyMessage) const
 
QOlmExpected< QOlmSessioncreateOutboundSession (const QByteArray &theirIdentityKey, const QByteArray &theirOneTimeKey) const
 
void markKeysAsPublished ()
 
OlmErrorCode lastErrorCode () const
 
const char * lastError () const
 

Detailed Description

An olm account manages all cryptographic keys used on a device.

const auto olmAccount = new QOlmAccount(this);
QOlmAccount(QString userId, QString deviceId, QObject *parent=nullptr)

Definition at line 25 of file qolmaccount.h.

Constructor & Destructor Documentation

◆ QOlmAccount()

Quotient::QOlmAccount::QOlmAccount ( QString  userId,
QString  deviceId,
QObject *  parent = nullptr 
)

Member Function Documentation

◆ createInboundSession()

QOlmExpected<QOlmSession> Quotient::QOlmAccount::createInboundSession ( const QOlmMessage preKeyMessage) const

Creates an inbound session for sending/receiving messages from a received 'prekey' message.

Parameters
preKeyMessageAn Olm pre-key message that was encrypted for this account.

◆ createInboundSessionFrom()

QOlmExpected<QOlmSession> Quotient::QOlmAccount::createInboundSessionFrom ( const QByteArray &  theirIdentityKey,
const QOlmMessage preKeyMessage 
) const

Creates an inbound session for sending/receiving messages from a received 'prekey' message.

Parameters
theirIdentityKey- The identity key of the Olm account that encrypted this Olm message.

◆ createOutboundSession()

QOlmExpected<QOlmSession> Quotient::QOlmAccount::createOutboundSession ( const QByteArray &  theirIdentityKey,
const QByteArray &  theirOneTimeKey 
) const

Creates an outbound session for sending messages to a specific identity and one time key.

◆ createUploadKeyRequest()

UploadKeysJob* Quotient::QOlmAccount::createUploadKeyRequest ( const UnsignedOneTimeKeys oneTimeKeys) const

◆ deviceKeys()

DeviceKeys Quotient::QOlmAccount::deviceKeys ( ) const

◆ generateOneTimeKeys()

size_t Quotient::QOlmAccount::generateOneTimeKeys ( size_t  numberOfKeys)

Generates the supplied number of one time keys.

◆ identityKeys()

IdentityKeys Quotient::QOlmAccount::identityKeys ( ) const

Returns the account's public identity keys already formatted as JSON.

◆ lastError()

const char* Quotient::QOlmAccount::lastError ( ) const

◆ lastErrorCode()

OlmErrorCode Quotient::QOlmAccount::lastErrorCode ( ) const

◆ markKeysAsPublished()

void Quotient::QOlmAccount::markKeysAsPublished ( )

◆ maxNumberOfOneTimeKeys()

size_t Quotient::QOlmAccount::maxNumberOfOneTimeKeys ( ) const

Maximum number of one time keys that this OlmAccount can currently hold.

◆ needsSave

void Quotient::QOlmAccount::needsSave ( )
signal

◆ oneTimeKeys()

UnsignedOneTimeKeys Quotient::QOlmAccount::oneTimeKeys ( ) const

Gets the OlmAccount's one time keys formatted as JSON.

◆ pickle()

QByteArray Quotient::QOlmAccount::pickle ( const PicklingKey key) const

Serialises an OlmAccount to encrypted Base64.

◆ removeOneTimeKeys()

OlmErrorCode Quotient::QOlmAccount::removeOneTimeKeys ( const QOlmSession session)

Remove the one time key used to create the supplied session.

◆ setupNewAccount()

void Quotient::QOlmAccount::setupNewAccount ( )

Creates a new instance of OlmAccount. During the instantiation the Ed25519 fingerprint key pair and the Curve25519 identity key pair are generated.

See also
https://matrix.org/docs/guides/e2e_implementation.html#keys-used-in-end-to-end-encryption
Note
This needs to be called before any other action or use unpickle() instead.

◆ sign() [1/2]

QByteArray Quotient::QOlmAccount::sign ( const QByteArray &  message) const

Returns the signature of the supplied message.

◆ sign() [2/2]

QByteArray Quotient::QOlmAccount::sign ( const QJsonObject &  message) const

◆ signIdentityKeys()

QByteArray Quotient::QOlmAccount::signIdentityKeys ( ) const

Sign identity keys.

◆ signOneTimeKeys()

OneTimeKeys Quotient::QOlmAccount::signOneTimeKeys ( const UnsignedOneTimeKeys keys) const

Sign all one time keys.

◆ unpickle()

OlmErrorCode Quotient::QOlmAccount::unpickle ( QByteArray &&  pickled,
const PicklingKey key 
)

Deserialises from encrypted Base64 that was previously obtained by pickling a QOlmAccount.

Note
This needs to be called before any other action or use setupNewAccount() instead.

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