Struct matrix_sdk::encryption::verification::SasVerification
source · [−]pub struct SasVerification { /* private fields */ }e2e-encryption only.Expand description
An object controlling the short auth string verification flow.
Implementations
sourceimpl SasVerification
impl SasVerification
sourcepub async fn accept_with_settings(&self, settings: AcceptSettings) -> Result<()>
pub async fn accept_with_settings(&self, settings: AcceptSettings) -> Result<()>
Accept the interactive verification flow with specific settings.
Arguments
settings- specific customizations to the verification flow.
Examples
use matrix_sdk::{
encryption::verification::{AcceptSettings, SasVerification},
ruma::events::key::verification::ShortAuthenticationString,
};
let sas = client
.encryption()
.get_verification(&user_id, flow_id)
.await
.and_then(|v| v.sas());
if let Some(sas) = sas {
let only_decimal = AcceptSettings::with_allowed_methods(vec![
ShortAuthenticationString::Decimal,
]);
sas.accept_with_settings(only_decimal).await?;
}sourcepub async fn confirm(&self) -> Result<()>
pub async fn confirm(&self) -> Result<()>
Confirm that the short auth strings match on both sides.
sourcepub async fn mismatch(&self) -> Result<()>
pub async fn mismatch(&self) -> Result<()>
Cancel the interactive verification flow because the short auth strings didn’t match on both sides.
sourcepub fn emoji(&self) -> Option<[Emoji; 7]>
pub fn emoji(&self) -> Option<[Emoji; 7]>
Get the emoji version of the short auth string.
Examples
use matrix_sdk::{
encryption::verification::{AcceptSettings, SasVerification},
ruma::events::key::verification::ShortAuthenticationString,
};
let sas_verification = client
.encryption()
.get_verification(&user_id, flow_id)
.await
.and_then(|v| v.sas());
if let Some(emojis) = sas_verification.and_then(|s| s.emoji()) {
let emoji_string = emojis
.iter()
.map(|e| format!("{:^12}", e.symbol))
.collect::<Vec<_>>()
.join("");
let description = emojis
.iter()
.map(|e| format!("{:^12}", e.description))
.collect::<Vec<_>>()
.join("");
println!("Do the emojis match?\n{emoji_string}\n{description}");
}sourcepub fn decimals(&self) -> Option<(u16, u16, u16)>
pub fn decimals(&self) -> Option<(u16, u16, u16)>
Get the decimal version of the short auth string.
sourcepub fn supports_emoji(&self) -> bool
pub fn supports_emoji(&self) -> bool
Does this verification flow support emoji for the short authentication string.
sourcepub fn can_be_presented(&self) -> bool
pub fn can_be_presented(&self) -> bool
Are we in a state where we can show the short auth string.
sourcepub fn we_started(&self) -> bool
pub fn we_started(&self) -> bool
Did we initiate the verification flow.
sourcepub fn cancel_info(&self) -> Option<CancelInfo>
pub fn cancel_info(&self) -> Option<CancelInfo>
Get info about the cancellation if the verification flow has been cancelled.
sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Is the verification process canceled.
sourcepub fn other_device(&self) -> &ReadOnlyDevice
pub fn other_device(&self) -> &ReadOnlyDevice
Get the other users device that we’re verifying.
sourcepub fn started_from_request(&self) -> bool
pub fn started_from_request(&self) -> bool
Did this verification flow start from a verification request.
sourcepub fn is_self_verification(&self) -> bool
pub fn is_self_verification(&self) -> bool
Is this a verification that is veryfying one of our own devices.
sourcepub fn own_user_id(&self) -> &UserId
pub fn own_user_id(&self) -> &UserId
Get our own user id.
sourcepub fn other_user_id(&self) -> &UserId
pub fn other_user_id(&self) -> &UserId
Get the user id of the other user participating in this verification flow.
Trait Implementations
sourceimpl Clone for SasVerification
impl Clone for SasVerification
sourcefn clone(&self) -> SasVerification
fn clone(&self) -> SasVerification
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more