pub struct Sas { /* private fields */ }
Expand description
The m.sas.v1
verification flow.
Implementations§
Source§impl Sas
impl Sas
Sourcepub fn other_user_id(&self) -> String
pub fn other_user_id(&self) -> String
Get the user id of the other side.
Sourcepub fn other_device_id(&self) -> String
pub fn other_device_id(&self) -> String
Get the device ID of the other side.
Sourcepub fn room_id(&self) -> Option<String>
pub fn room_id(&self) -> Option<String>
Get the room id if the verification is happening inside a room.
Sourcepub fn we_started(&self) -> bool
pub fn we_started(&self) -> bool
Did we initiate the verification flow.
Sourcepub fn accept(&self) -> Option<OutgoingVerificationRequest>
pub fn accept(&self) -> Option<OutgoingVerificationRequest>
Accept that we’re going forward with the short auth string verification.
Sourcepub fn confirm(
&self,
) -> Result<Option<ConfirmVerificationResult>, CryptoStoreError>
pub fn confirm( &self, ) -> Result<Option<ConfirmVerificationResult>, CryptoStoreError>
Confirm a verification was successful.
This method should be called if a short auth string should be confirmed as matching.
Sourcepub fn cancel(&self, cancel_code: String) -> Option<OutgoingVerificationRequest>
pub fn cancel(&self, cancel_code: String) -> Option<OutgoingVerificationRequest>
Sourcepub fn get_emoji_indices(&self) -> Option<Vec<i32>>
pub fn get_emoji_indices(&self) -> Option<Vec<i32>>
Get a list of emoji indices of the emoji representation of the short auth string.
Note: A SAS verification needs to be started and in the presentable
state for this to return the list of emoji indices, otherwise returns
None
.
Sourcepub fn get_decimals(&self) -> Option<Vec<i32>>
pub fn get_decimals(&self) -> Option<Vec<i32>>
Get the decimal representation of the short auth string.
Note: A SAS verification needs to be started and in the presentable
state for this to return the list of decimals, otherwise returns
None
.
Sourcepub fn set_changes_listener(&self, listener: Box<dyn SasListener>)
pub fn set_changes_listener(&self, listener: Box<dyn SasListener>)
Set a listener for changes in the SAS verification process.
The given callback will be called whenever the state changes.
This method can be used to react to changes in the state of the verification process, or rather the method can be used to handle each step of the verification process.
This method will spawn a tokio task on the Rust side, once we reach the Done or Cancelled state, the task will stop listening for changes.
§Flowchart
The flow of the verification process is pictured bellow. Please note that the process can be cancelled at each step of the process. Either side can cancel the process.
┌───────┐
│Started│
└───┬───┘
│
┌────⌄───┐
│Accepted│
└────┬───┘
│
┌───────⌄──────┐
│Keys Exchanged│
└───────┬──────┘
│
________⌄________
╱ ╲ ┌─────────┐
╱ Does the short ╲______│Cancelled│
╲ auth string match ╱ no └─────────┘
╲_________________╱
│yes
│
┌────⌄────┐
│Confirmed│
└────┬────┘
│
┌───⌄───┐
│ Done │
└───────┘
Trait Implementations§
Source§impl<UT> LowerError<UT> for Sas
impl<UT> LowerError<UT> for Sas
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for Sas
impl<UT> LowerReturn<UT> for Sas
Source§type ReturnType = <Arc<Sas> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<Sas> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustBuffer>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustBuffer>
Source§impl<UT> TypeId<UT> for Sas
impl<UT> TypeId<UT> for Sas
const TYPE_ID_META: MetadataBuffer = _
Auto Trait Implementations§
impl Freeze for Sas
impl !RefUnwindSafe for Sas
impl Send for Sas
impl Sync for Sas
impl Unpin for Sas
impl !UnwindSafe for Sas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more