Enum matrix_sdk_crypto::UserIdentity
source · pub enum UserIdentity {
Own(OwnUserIdentity),
Other(OtherUserIdentity),
}
Expand description
Enum over the different user identity types we can have.
Variants§
Own(OwnUserIdentity)
Our own user identity.
Other(OtherUserIdentity)
An identity belonging to another user.
Implementations§
source§impl UserIdentity
impl UserIdentity
sourcepub fn own(self) -> Option<OwnUserIdentity>
pub fn own(self) -> Option<OwnUserIdentity>
Destructure the enum into an OwnUserIdentity
if it’s of the correct
type.
sourcepub fn other(self) -> Option<OtherUserIdentity>
pub fn other(self) -> Option<OtherUserIdentity>
Destructure the enum into an OtherUserIdentity
if it’s of the
correct type.
sourcepub fn is_verified(&self) -> bool
pub fn is_verified(&self) -> bool
Check if this user identity is verified.
For our own identity, this means either that we have checked the public
keys in the identity against the private keys; or that the identity
has been manually marked as verified via
OwnUserIdentity::verify
.
For another user’s identity, it means that we have verified our own identity as above, and that the other user’s identity has been signed by our own user-signing key.
sourcepub fn was_previously_verified(&self) -> bool
pub fn was_previously_verified(&self) -> bool
True if we verified this identity at some point in the past.
To reset this latch back to false
, one must call
UserIdentity::withdraw_verification()
.
sourcepub async fn withdraw_verification(&self) -> Result<(), CryptoStoreError>
pub async fn withdraw_verification(&self) -> Result<(), CryptoStoreError>
Reset the flag that records that the identity has been verified, thus
clearing UserIdentity::was_previously_verified
and
UserIdentity::has_verification_violation
.
sourcepub async fn pin(&self) -> Result<(), CryptoStoreError>
pub async fn pin(&self) -> Result<(), CryptoStoreError>
Remember this identity, ensuring it does not result in a pin violation.
When we first see a user, we assume their cryptographic identity has not been tampered with by the homeserver or another entity with man-in-the-middle capabilities. We remember this identity and call this action “pinning”.
If the identity presented for the user changes later on, the newly presented identity is considered to be in “pin violation”. This method explicitly accepts the new identity, allowing it to replace the previously pinned one and bringing it out of pin violation.
UIs should display a warning to the user when encountering an identity
which is not verified and is in pin violation. See
OtherUserIdentity::identity_needs_user_approval
.
sourcepub fn has_verification_violation(&self) -> bool
pub fn has_verification_violation(&self) -> bool
Was this identity previously verified, and is no longer?
Trait Implementations§
source§impl Clone for UserIdentity
impl Clone for UserIdentity
source§fn clone(&self) -> UserIdentity
fn clone(&self) -> UserIdentity
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for UserIdentity
impl Debug for UserIdentity
source§impl From<OtherUserIdentity> for UserIdentity
impl From<OtherUserIdentity> for UserIdentity
source§fn from(i: OtherUserIdentity) -> Self
fn from(i: OtherUserIdentity) -> Self
source§impl From<OwnUserIdentity> for UserIdentity
impl From<OwnUserIdentity> for UserIdentity
source§fn from(i: OwnUserIdentity) -> Self
fn from(i: OwnUserIdentity) -> Self
Auto Trait Implementations§
impl Freeze for UserIdentity
impl !RefUnwindSafe for UserIdentity
impl Send for UserIdentity
impl Sync for UserIdentity
impl Unpin for UserIdentity
impl !UnwindSafe for UserIdentity
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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