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_key(&mut self) -> Result<()>; fn get_secret_key(&self) -> Result<Secret>; fn get_public_key(&self) -> 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
fn identifier(&self) -> Result<ProfileIdentifier>
fn identifier(&self) -> Result<ProfileIdentifier>
Return unique [Profile
] identifier, which is equal to sha256 of the root public key
fn rotate_key(&mut self) -> Result<()>
fn rotate_key(&mut self) -> Result<()>
Rotate existing key.
fn get_secret_key(&self) -> Result<Secret>
fn get_secret_key(&self) -> Result<Secret>
Get Secret
key.
fn get_public_key(&self) -> Result<PublicKey>
fn get_public_key(&self) -> Result<PublicKey>
Get PublicKey
.
fn create_auth_proof<S: AsRef<[u8]>>(
&mut self,
state_slice: S
) -> Result<AuthenticationProof>
fn create_auth_proof<S: AsRef<[u8]>>(
&mut self,
state_slice: S
) -> Result<AuthenticationProof>
Create an authentication proof based on the given state
Verify a proof based on the given state, proof and profile.
fn add_change(&mut self, change_event: ProfileChangeEvent) -> Result<()>
fn add_change(&mut self, change_event: ProfileChangeEvent) -> Result<()>
Add a change event.
fn get_changes(&self) -> Result<Changes>
fn get_changes(&self) -> Result<Changes>
Return change history chain
fn verify_changes(&mut self) -> Result<bool>
fn verify_changes(&mut self) -> Result<bool>
Verify the whole change event chain
fn as_contact(&mut self) -> Result<Contact>
fn as_contact(&mut self) -> Result<Contact>
Convert [Profile
] to Contact
fn get_contact(
&mut self,
contact_id: &ProfileIdentifier
) -> Result<Option<Contact>>
fn get_contact(
&mut self,
contact_id: &ProfileIdentifier
) -> Result<Option<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
fn verify_and_update_contact<C: AsRef<[ProfileChangeEvent]>>(
&mut self,
contact_id: &ProfileIdentifier,
change_events: C
) -> Result<bool>
fn verify_and_update_contact<C: AsRef<[ProfileChangeEvent]>>(
&mut self,
contact_id: &ProfileIdentifier,
change_events: C
) -> Result<bool>
Verify and update known Contact
with new ProfileChangeEvent
s