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§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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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