Struct olm_rs::sas::OlmSas[][src]

pub struct OlmSas { /* fields omitted */ }

Implementations

impl OlmSas[src]

pub fn new() -> Self[src]

pub fn public_key(&self) -> String[src]

Get the public key for the SAS object.

This returns the public key of the SAS object that can then be shared with another user to perform the authentication process.

pub fn set_their_public_key(
    &mut self,
    public_key: String
) -> Result<(), OlmSasError>
[src]

Set the public key of the other user.

This sets the public key of the other user, it needs to be set before bytes can be generated for the authentication string and a MAC can be calculated.

Returns an error if the public key was too short or invalid.

Arguments

  • public_key - The public key of the other user.

pub fn generate_bytes(
    &self,
    extra_info: &str,
    length: usize
) -> Result<Vec<u8>, OlmSasError>
[src]

Generate bytes to use for the short authentication string.

Note the other public key needs to be set for this method to work. Returns an error if it isn't set.

Arguments

  • extra_info - Extra information to mix in when generating the bytes.

  • length - The number of bytes to generate.

pub fn calculate_mac(
    &self,
    message: &str,
    extra_info: &str
) -> Result<String, OlmSasError>
[src]

Generate a message authentication code based on the shared secret.

Note the other public key needs to be set for this method to work. Returns an error if it isn't set.

Arguments

  • message - The message to produce the authentication code for.

  • extra_info - Extra information to mix in when generating the MAC.

Trait Implementations

impl Default for OlmSas[src]

impl Drop for OlmSas[src]

impl Send for OlmSas[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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.