matrix_sdk_qrcode

Struct SelfVerificationNoMasterKey

Source
pub struct SelfVerificationNoMasterKey { /* private fields */ }
Expand description

The non-encoded data for the third mode of QR code verification.

This mode is used for verification between two devices of the same user where this device, that is creating this QR code, is not trusting the cross signing master key.

Implementations§

Source§

impl SelfVerificationNoMasterKey

Source

pub fn new( transaction_id: String, device_key: Ed25519PublicKey, master_key: Ed25519PublicKey, shared_secret: Base64, ) -> Self

Create a new SelfVerificationData struct that can be encoded as a QR code.

§Arguments
  • transaction_id - The transaction id of this verification flow, the transaction id was sent by the m.key.verification.request event that initiated the verification flow this QR code should be part of.

  • device_key - The ed25519 key of our own device.

  • master_key - Our own cross signing master key.

  • shared_secret - A random bytestring encoded as unpadded base64, needs to be at least 8 bytes long.

Source

pub fn to_bytes(&self) -> Result<Vec<u8>, EncodingError>

Encode the SelfVerificationNoMasterKey into a vector of bytes that can be encoded as a QR code.

The encoding can fail if the keys that should be encoded are not valid base64.

§Examples
let data = b"MATRIX\
             \x02\x02\x00\x06\
             FLOWID\
             kS /\x92i\x1e6\xcd'g\xf9#\x11\xd8\x8a\xa2\xf61\x05\x1b6\xef\xfc\xa4%\x80\x1a\x0c\xd2\xe8\x04\
             \xbdR|\xf8n\x07\xa4\x1f\xb4\xcc3\x0eBT\xe7[~\xfd\x87\xd06B\xdfoVv%\x9b\x86\xae\xbcM\
             SHARED_SECRET";

let result = QrVerificationData::from_bytes(data)?;
if let QrVerificationData::SelfVerificationNoMasterKey(decoded) = result {
    let encoded = decoded.to_bytes().unwrap();
    assert_eq!(data.as_ref(), encoded.as_slice());
} else {
    panic!("Data was encoded as an incorrect mode");
}
Source

pub fn to_qr_code(&self) -> Result<QrCode, EncodingError>

Encode the SelfVerificationNoMasterKey into a QrCode.

This method turns the SelfVerificationNoMasterKey into a QR code that can be rendered and presented to be scanned.

The encoding can fail if the data doesn’t fit into a QR code or if the keys that should be encoded into the QR code are not valid base64.

Trait Implementations§

Source§

impl Clone for SelfVerificationNoMasterKey

Source§

fn clone(&self) -> SelfVerificationNoMasterKey

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SelfVerificationNoMasterKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<SelfVerificationNoMasterKey> for QrVerificationData

Source§

fn from(data: SelfVerificationNoMasterKey) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for SelfVerificationNoMasterKey

Source§

fn eq(&self, other: &SelfVerificationNoMasterKey) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SelfVerificationNoMasterKey

Source§

impl StructuralPartialEq for SelfVerificationNoMasterKey

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T