Struct matrix_sdk_crypto::OtherUserIdentity
source · pub struct OtherUserIdentity { /* 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 OtherUserIdentity
impl OtherUserIdentity
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 OtherUserIdentity::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
Has the identity changed 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, unless it is an explicitly verified identity (using for example interactive verification).
This situation can be resolved by:
- Verifying the new identity with
OtherUserIdentity::request_verification
, or: - Updating the pin to the new identity with
OtherUserIdentity::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
OtherUserIdentity::request_verification
- Or by withdrawing the verification requirement
OtherUserIdentity::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 set this latch back to false, 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 OtherUserIdentity
impl Clone for OtherUserIdentity
source§fn clone(&self) -> OtherUserIdentity
fn clone(&self) -> OtherUserIdentity
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OtherUserIdentity
impl Debug for OtherUserIdentity
source§impl Deref for OtherUserIdentity
impl Deref for OtherUserIdentity
source§impl DerefMut for OtherUserIdentity
impl DerefMut for OtherUserIdentity
source§impl From<OtherUserIdentity> for UserIdentity
impl From<OtherUserIdentity> for UserIdentity
source§fn from(i: OtherUserIdentity) -> Self
fn from(i: OtherUserIdentity) -> Self
Auto Trait Implementations§
impl Freeze for OtherUserIdentity
impl !RefUnwindSafe for OtherUserIdentity
impl Send for OtherUserIdentity
impl Sync for OtherUserIdentity
impl Unpin for OtherUserIdentity
impl !UnwindSafe for OtherUserIdentity
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