[][src]Struct matrix_sdk_crypto::olm::Session

pub struct Session { /* fields omitted */ }

Cryptographic session that enables secure communication between two Accounts

Implementations

impl Session[src]

pub async fn decrypt(
    &mut self,
    message: OlmMessage
) -> Result<String, OlmSessionError>
[src]

Decrypt the given Olm message.

Returns the decrypted plaintext or an OlmSessionError if decryption failed.

Arguments

  • message - The Olm message that should be decrypted.

pub async fn encrypt(
    &mut self,
    recipient_device: &ReadOnlyDevice,
    event_type: EventType,
    content: Value
) -> Result<EncryptedEventContent, OlmError>
[src]

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.

  • event_type - The type of the event.

  • content - The content of the event.

pub async fn matches(
    &self,
    their_identity_key: &str,
    message: PreKeyMessage
) -> Result<bool, OlmSessionError>
[src]

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.

pub fn session_id(&self) -> &str[src]

Returns the unique identifier for this session.

pub async fn pickle(&self, pickle_mode: PicklingMode) -> PickledSession[src]

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<Box<DeviceId>>,
    our_identity_keys: Arc<IdentityKeys>,
    pickle: PickledSession,
    pickle_mode: PicklingMode
) -> Result<Self, SessionUnpicklingError>
[src]

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 the Session.

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

Trait Implementations

impl Clone for Session[src]

impl Debug for Session[src]

impl PartialEq<Session> for Session[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsyncTraitDeps for T where
    T: Send + Sync + Debug
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,