Trait ockam_entity::Identity[][src]

pub trait Identity: Send + 'static {
Show methods fn identifier(&self) -> Result<ProfileIdentifier>;
fn create_key<S: Into<String>>(&mut self, label: S) -> Result<()>;
fn rotate_profile_key(&mut self) -> Result<()>;
fn get_profile_secret_key(&self) -> Result<Secret>;
fn get_secret_key<S: Into<String>>(&self, label: S) -> Result<Secret>;
fn get_profile_public_key(&self) -> Result<PublicKey>;
fn get_public_key<S: Into<String>>(&self, label: S) -> Result<PublicKey>;
fn create_auth_proof<S: AsRef<[u8]>>(
        &mut self,
        state_slice: S
    ) -> Result<AuthenticationProof>;
fn verify_auth_proof<S: AsRef<[u8]>, P: AsRef<[u8]>>(
        &mut self,
        state_slice: S,
        peer_id: &ProfileIdentifier,
        proof_slice: P
    ) -> Result<bool>;
fn add_change(&mut self, change_event: ProfileChangeEvent) -> Result<()>;
fn get_changes(&self) -> Result<Changes>;
fn verify_changes(&mut self) -> Result<bool>;
fn get_contacts(&self) -> Result<Vec<Contact>>;
fn as_contact(&mut self) -> Result<Contact>;
fn get_contact(
        &mut self,
        contact_id: &ProfileIdentifier
    ) -> Result<Option<Contact>>;
fn verify_contact<C: Into<Contact>>(&mut self, contact: C) -> Result<bool>;
fn verify_and_add_contact<C: Into<Contact>>(
        &mut self,
        contact: C
    ) -> Result<bool>;
fn verify_and_update_contact<C: AsRef<[ProfileChangeEvent]>>(
        &mut self,
        contact_id: &ProfileIdentifier,
        change_events: C
    ) -> Result<bool>;
}
Expand description

Identity

Required methods

Return unique [Profile] identifier, which is equal to sha256 of the root public key

Create new key.

Rotate existing key.

Get Secret key.

Get Secret key.

Get PublicKey.

Get PublicKey.

Create an authentication proof based on the given state

Verify a proof based on the given state, proof and profile.

Add a change event.

Return change history chain

Verify the whole change event chain

Return all known to this profile Contacts

Convert [Profile] to Contact

Return Contact with given ProfileIdentifier

Verify cryptographically whole event chain. Also verify sequence correctness

Verify and add new Contact to [Profile]’s Contact list

Verify and update known Contact with new ProfileChangeEvents

Implementors