pub struct Contact { /* private fields */ }
Expand description
Contact is an abstraction responsible for storing user’s public data (mainly - public keys).
It is designed to share users’ public keys in cryptographically verifiable way.
Public keys together with metadata are organised into verifiable events chain exactly like crate::Identity
.
There are two ways to get Contact:
- From another user (in this case Contact will be cryptographically verified)
- Generate one from user’s own
Identity
Public keys from Contact can be used for many purposes, e.g. running key exchange, or signing&encrypting data.
Examples
Creating Contact
from Identity
TODO
Implementations
sourceimpl Contact
impl Contact
sourcepub fn identifier(&self) -> &IdentityIdentifier
pub fn identifier(&self) -> &IdentityIdentifier
Return unique identifier, which equals to Identity
’s identifier
sourcepub fn change_events(&self) -> &[IdentityChangeEvent]
pub fn change_events(&self) -> &[IdentityChangeEvent]
Return change history chain
sourceimpl Contact
impl Contact
sourcepub fn new(
identifier: IdentityIdentifier,
change_events: Vec<IdentityChangeEvent, Global>
) -> Contact
pub fn new(
identifier: IdentityIdentifier,
change_events: Vec<IdentityChangeEvent, Global>
) -> Contact
Create a new Contact.
sourceimpl Contact
impl Contact
sourcepub async fn verify(
&'_ self,
vault: &'_ mut impl IdentityVault
) -> Result<bool, Error>
pub async fn verify(
&'_ self,
vault: &'_ mut impl IdentityVault
) -> Result<bool, Error>
Verify cryptographically whole event chain. Also verify sequence correctness
sourcepub async fn verify_and_update<C>(
&'_ mut self,
change_events: C,
vault: &'_ mut impl IdentityVault
) -> Result<bool, Error> where
C: AsRef<[IdentityChangeEvent]>,
pub async fn verify_and_update<C>(
&'_ mut self,
change_events: C,
vault: &'_ mut impl IdentityVault
) -> Result<bool, Error> where
C: AsRef<[IdentityChangeEvent]>,
Update Contact
by using new change events
sourceimpl Contact
impl Contact
sourcepub fn get_identity_update_public_key(&self) -> Result<PublicKey, Error>
pub fn get_identity_update_public_key(&self) -> Result<PublicKey, Error>
Get crate::Identity
Update PublicKey
sourcepub fn get_public_key(&self, label: &str) -> Result<PublicKey, Error>
pub fn get_public_key(&self, label: &str) -> Result<PublicKey, Error>
Get PublicKey
. Key is uniquely identified by the specified label.
sourcepub fn get_last_event_id(&self) -> Result<EventIdentifier, Error>
pub fn get_last_event_id(&self) -> Result<EventIdentifier, Error>
Get EventIdentifier
of the last known event
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Contact
impl<'de> Deserialize<'de> for Contact
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Contact, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Contact, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for Contact
impl Serialize for Contact
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Contact
impl Send for Contact
impl Sync for Contact
impl Unpin for Contact
impl UnwindSafe for Contact
Blanket Implementations
sourceimpl<D> AsyncTryClone for D where
D: Clone + Sync,
impl<D> AsyncTryClone for D where
D: Clone + Sync,
sourcefn async_try_clone<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<D, Error>> + Send + 'async_trait, Global>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
D: 'async_trait,
fn async_try_clone<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<D, Error>> + Send + 'async_trait, Global>>ⓘNotable traits for Pin<P>impl<P> Future for Pin<P> where
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
where
'life0: 'async_trait,
D: 'async_trait,
P: DerefMut,
<P as Deref>::Target: Future, type Output = <<P as Deref>::Target as Future>::Output;
Try cloning a object and return an Err
in case of failure.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Decodable for T where
T: DeserializeOwned,
impl<T> Decodable for T where
T: DeserializeOwned,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more