Struct matrix_sdk_crypto::olm::Session [−][src]
pub struct Session { /* fields omitted */ }Expand description
Cryptographic session that enables secure communication between two
Accounts
Implementations
Decrypt the given Olm message.
Returns the decrypted plaintext or an OlmSessionError if decryption
failed.
Arguments
message- The Olm message that should be decrypted.
Get the sender key that was used to establish this Session.
pub async fn encrypt(
&mut self,
recipient_device: &ReadOnlyDevice,
content: AnyToDeviceEventContent
) -> Result<EncryptedToDeviceEventContent, OlmError>
pub async fn encrypt(
&mut self,
recipient_device: &ReadOnlyDevice,
content: AnyToDeviceEventContent
) -> Result<EncryptedToDeviceEventContent, OlmError>
Encrypt the given event content content as an m.room.encrypted event content.
Arguments
-
recipient_device- The device for which this message is going to be encrypted, this needs to be the device that was used to create this session with. -
content- The content of the event.
pub async fn matches(
&self,
their_identity_key: &str,
message: PreKeyMessage
) -> Result<bool, OlmSessionError>
pub async fn matches(
&self,
their_identity_key: &str,
message: PreKeyMessage
) -> Result<bool, OlmSessionError>
Check if a pre-key Olm message was encrypted for this session.
Returns true if it matches, false if not and a OlmSessionError if there was an error checking if it matches.
Arguments
-
their_identity_key- The identity/curve25519 key of the account that encrypted this Olm message. -
message- The pre-key Olm message that should be checked.
Returns the unique identifier for this session.
Store the session as a base64 encoded string.
Arguments
pickle_mode- The mode that was used to pickle the session, either an unencrypted mode or an encrypted using passphrase.
pub fn from_pickle(
user_id: Arc<UserId>,
device_id: Arc<DeviceId>,
our_identity_keys: Arc<IdentityKeys>,
pickle: PickledSession,
pickle_mode: PicklingMode
) -> Result<Self, SessionUnpicklingError>
pub fn from_pickle(
user_id: Arc<UserId>,
device_id: Arc<DeviceId>,
our_identity_keys: Arc<IdentityKeys>,
pickle: PickledSession,
pickle_mode: PicklingMode
) -> Result<Self, SessionUnpicklingError>
Restore a Session from a previously pickled string.
Returns the restored Olm Session or a SessionUnpicklingError if there
was an error.
Arguments
-
user_id- Our own user id that the session belongs to. -
device_id- Our own device id that the session belongs to. -
our_idenity_keys- An clone of the Arc to our own identity keys. -
pickle- The pickled version of theSession. -
pickle_mode- The mode that was used to pickle the session, either an unencrypted mode or an encrypted using passphrase.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more