Struct ockam_entity::Contact [−][src]
pub struct Contact { /* fields omitted */ }
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::Profile
.
There are two ways to get Contact:
- From another user (in this case Contact will be cryptographically verified)
- Generate one from user’s own
crate::Profile
Public keys from Contact can be used for many purposes, e.g. running key exchange, or signing&encrypting data.
Examples
Creating Contact
from crate::Profile
let vault = Vault::create(&ctx)?; let mut alice = Profile::create(&ctx, &vault).await?; let truck_key_attributes = KeyAttributes::new( "Truck management".to_string(), ); alice.create_key(truck_key_attributes.clone(), None)?; let alice_contact = alice.to_contact(); let public_key = alice.get_public_key(&truck_key_attributes)?;
Sending Contact over the network
// Send this over the network let alice_contact_binary = alice.serialize_to_contact()?;
Implementations
Return unique identifier, which equals to crate::Profile
’s identifier
Return change history chain
Create a new Contact.
Verify cryptographically whole event chain. Also verify sequence correctness
pub fn verify_and_update(
&mut self,
change_events: Vec<ProfileChangeEvent>,
vault: &mut impl ProfileVault
) -> Result<()>
pub fn verify_and_update(
&mut self,
change_events: Vec<ProfileChangeEvent>,
vault: &mut impl ProfileVault
) -> Result<()>
Update Contact
by using new change events
Get crate::Profile
Update PublicKey
Get PublicKey
. Key is uniquely identified by label in KeyAttributes
Get EventIdentifier
of the last known event
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Contact
impl UnwindSafe for Contact
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V