pub struct ReadOnlyAccount {
    pub user_id: Arc<UserId>,
    pub device_id: Arc<DeviceId>,
    pub identity_keys: Arc<IdentityKeys>,
    /* private fields */
}
Expand description

Account holding identity keys for which sessions can be created.

An account is the central identity for encrypted communication between two devices.

Fields

user_id: Arc<UserId>

The user_id this account belongs to

device_id: Arc<DeviceId>

The device_id of this entry

identity_keys: Arc<IdentityKeys>

The associated identity keys

Implementations

Create a fresh new account, this will generate the identity key-pair.

Get the user id of the owner of the account.

Get the device ID that owns this account.

Get the public parts of the identity keys for the account.

Get the key ID of our Ed25519 signing key.

Update the uploaded key count.

Arguments
  • new_count - The new count that was reported by the server.

Get the currently known uploaded key count.

Has the account been shared with the server.

Mark the account as shared.

Messages shouldn’t be encrypted with the session before it has been shared.

Get the one-time keys of the account.

This can be empty, keys need to be generated first.

Generate count number of one-time keys.

Get the maximum number of one-time keys the account can hold.

Generate new one-time keys that need to be uploaded to the server.

Returns None if no keys need to be uploaded, otherwise the number of newly generated one-time keys. May return 0 if some one-time keys are already generated but weren’t uploaded.

Generally Some means that keys should be uploaded, while None means that keys should not be uploaded.

Get a tuple of device, one-time, and fallback keys that need to be uploaded.

If no keys need to be uploaded the DeviceKeys will be None and the one-time and fallback keys maps will be empty.

Mark the current set of one-time keys as being published.

Sign the given string using the accounts signing key.

Returns the signature as a base64 encoded string.

Get a serializeable version of the Account so it can be persisted.

Restore an account from a previously pickled one.

Arguments
  • pickle - The pickled version of the Account.

  • pickle_mode - The mode that was used to pickle the account, either an unencrypted mode or an encrypted using passphrase.

Generate the unsigned DeviceKeys from this ReadOnlyAccount

Sign the device keys of the account and return them so they can be uploaded.

Bootstrap Cross-Signing

Sign the given CrossSigning Key in place

Sign the given Master Key

Convert a JSON value to the canonical representation and sign the JSON string.

Arguments
  • json - The value that should be converted into a canonical JSON string.

Generate, sign and prepare one-time keys to be uploaded.

If no one-time keys need to be uploaded returns an empty BTreeMap.

Sign and prepare fallback keys to be uploaded.

If no fallback keys need to be uploaded returns an empty BTreeMap.

Create a new session with another account given a one-time key.

Returns the newly created session or a OlmSessionError if creating a session failed.

Arguments
  • their_identity_key - The other account’s identity/curve25519 key.

  • their_one_time_key - A signed one-time key that the other account created and shared with us.

Create a new session with another account given a one-time key and a device.

Returns the newly created session or a OlmSessionError if creating a session failed.

Arguments
  • device - The other account’s device.

  • key_map - A map from the algorithm and device ID to the one-time key that the other account created and shared with us.

Create a new session with another account given a pre-key Olm message.

Returns the newly created session or a OlmSessionError if creating a session failed.

Arguments
  • their_identity_key - The other account’s identity/curve25519 key.

  • message - A pre-key Olm message that was sent to us by the other account.

Create a group session pair.

This session pair can be used to encrypt and decrypt messages meant for a large group of participants.

The outbound session is used to encrypt messages while the inbound one is used to decrypt messages encrypted by the outbound one.

Arguments
  • room_id - The ID of the room where the group session will be used.

  • settings - Settings determining the algorithm and rotation period of the outbound group session.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more