crypto: Improve doc of SAS accept settings
Document arguments explicitly. Adapt to changed implementation. Provide example call.master
parent
587c09e700
commit
42c8c42150
|
@ -33,7 +33,22 @@ impl Sas {
|
|||
|
||||
/// Accept the interactive verification flow with specific settings.
|
||||
///
|
||||
/// Pass `settings` to customizes the accept-request before sending it.
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `settings` - specific customizations to the verification flow.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```ignore
|
||||
/// use matrix_sdk::Sas;
|
||||
/// use matrix_sdk_base::crypto::AcceptSettings;
|
||||
/// use matrix_sdk::events::key::verification::ShortAuthenticationString;
|
||||
///
|
||||
/// let only_decimal = AcceptSettings::with_allowed_methods(
|
||||
/// vec![ShortAuthenticationString::Decimal]
|
||||
/// );
|
||||
/// sas.accept_with_settings(only_decimal);
|
||||
/// ```
|
||||
pub async fn accept_with_settings(&self, settings: AcceptSettings) -> Result<()> {
|
||||
if let Some(req) = self.inner.accept_with_settings(settings) {
|
||||
match req {
|
||||
|
|
|
@ -682,6 +682,7 @@ pub struct AcceptSettings {
|
|||
}
|
||||
|
||||
impl Default for AcceptSettings {
|
||||
/// All methods are allowed
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
allowed_methods: vec![
|
||||
|
@ -693,7 +694,11 @@ impl Default for AcceptSettings {
|
|||
}
|
||||
|
||||
impl AcceptSettings {
|
||||
/// Create settings with exactly the specified SAS methods
|
||||
/// Create settings restricting the allowed SAS methods
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `methods` - The methods this client allows at most
|
||||
pub fn with_allowed_methods(methods: Vec<ShortAuthenticationString>) -> Self {
|
||||
Self {
|
||||
allowed_methods: methods,
|
||||
|
|
Loading…
Reference in New Issue