Struct olm_rs::sas::OlmSas [−][src]
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]
&mut self,
public_key: String
) -> Result<(), OlmSasError>
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]
&self,
extra_info: &str,
length: usize
) -> Result<Vec<u8>, OlmSasError>
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]
&self,
message: &str,
extra_info: &str
) -> Result<String, OlmSasError>
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
Auto Trait Implementations
impl RefUnwindSafe for OlmSas[src]
impl !Sync for OlmSas[src]
impl Unpin for OlmSas[src]
impl UnwindSafe for OlmSas[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,