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:

  1. From another user (in this case Contact will be cryptographically verified)
  2. 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

Update Contact by using new change events

Get PublicKey. Key is uniquely identified by label in KeyAttributes

Get EventIdentifier of the last known event

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Encode the type representation into an Encoded type.

Decode an Encoded type into the Message’s type.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.