Struct matrix_sdk_crypto::UserIdentity
source · pub struct UserIdentity { /* private fields */ }
Expand description
Struct representing a cross signing identity of a user.
This is the user identity of a user that isn’t our own. Other users will only contain a master key and a self signing key, meaning that only device signatures can be checked with this identity.
This struct wraps a read-only version of the struct and allows verifications to be requested to verify our own device with the user identity.
Implementations§
source§impl UserIdentity
impl UserIdentity
sourcepub fn is_verified(&self) -> bool
pub fn is_verified(&self) -> bool
Is this user identity verified.
sourcepub async fn verify(&self) -> Result<SignatureUploadRequest, SignatureError>
pub async fn verify(&self) -> Result<SignatureUploadRequest, SignatureError>
Manually verify this user.
This method will attempt to sign the user identity using our private cross signing key.
This method fails if we don’t have the private part of our user-signing key.
Returns a request that needs to be sent out for the user to be marked as verified.
sourcepub fn request_verification(
&self,
room_id: &RoomId,
request_event_id: &EventId,
methods: Option<Vec<VerificationMethod>>,
) -> VerificationRequest
pub fn request_verification( &self, room_id: &RoomId, request_event_id: &EventId, methods: Option<Vec<VerificationMethod>>, ) -> VerificationRequest
Create a VerificationRequest
object after the verification request
content has been sent out.
sourcepub fn verification_request_content(
&self,
methods: Option<Vec<VerificationMethod>>,
) -> KeyVerificationRequestEventContent
pub fn verification_request_content( &self, methods: Option<Vec<VerificationMethod>>, ) -> KeyVerificationRequestEventContent
Send a verification request to the given user.
The returned content needs to be sent out into a DM room with the given user.
After the content has been sent out a VerificationRequest
can be
started with the request_verification()
method.
sourcepub async fn pin_current_master_key(&self) -> Result<(), CryptoStoreError>
pub async fn pin_current_master_key(&self) -> Result<(), CryptoStoreError>
Pin the current identity (public part of the master signing key).
sourcepub fn identity_needs_user_approval(&self) -> bool
pub fn identity_needs_user_approval(&self) -> bool
Did the identity change after an initial observation in a way that requires approval from the user?
A user identity needs approval if it changed after the crypto machine has already observed (“pinned”) a different identity for that user and it is not an explicitly verified identity (using for example interactive verification).
Such a change is to be considered a pinning violation which the application should report to the local user, and can be resolved by:
- Verifying the new identity with
UserIdentity::request_verification
- Or by updating the pin to the new identity with
UserIdentity::pin_current_master_key
.
sourcepub async fn withdraw_verification(&self) -> Result<(), CryptoStoreError>
pub async fn withdraw_verification(&self) -> Result<(), CryptoStoreError>
Remove the requirement for this identity to be verified.
sourcepub fn has_verification_violation(&self) -> bool
pub fn has_verification_violation(&self) -> bool
Was this identity verified since initial observation and is not anymore?
Such a violation should be reported to the local user by the application, and resolved by
- Verifying the new identity with
UserIdentity::request_verification
- Or by withdrawing the verification requirement
UserIdentity::withdraw_verification
.
Methods from Deref<Target = OtherUserIdentityData>§
sourcepub fn master_key(&self) -> &MasterPubkey
pub fn master_key(&self) -> &MasterPubkey
Get the public master key of the identity.
sourcepub fn self_signing_key(&self) -> &SelfSigningPubkey
pub fn self_signing_key(&self) -> &SelfSigningPubkey
Get the public self-signing key of the identity.
sourcepub fn was_previously_verified(&self) -> bool
pub fn was_previously_verified(&self) -> bool
True if we verified this identity (with any own identity, at any point).
To pass this latch back to false, one must call
OtherUserIdentityData::withdraw_verification()
.
sourcepub fn withdraw_verification(&self)
pub fn withdraw_verification(&self)
Remove the requirement for this identity to be verified.
If an identity was previously verified and is not anymore it will be reported to the user. In order to remove this notice users have to verify again or to withdraw the verification requirement.
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 Deref for UserIdentity
impl Deref for UserIdentity
source§impl From<UserIdentity> for UserIdentities
impl From<UserIdentity> for UserIdentities
source§fn from(i: UserIdentity) -> Self
fn from(i: UserIdentity) -> 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
)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