pub struct IdentityLog { /* private fields */ }Expand description
The identity itself: an append-only log plus the membership it implies.
Implementations§
Source§impl IdentityLog
impl IdentityLog
Sourcepub fn create(
founder: &SigningIdentity,
label: &str,
recovery: &VerifyingIdentity,
) -> Result<Self, IdentityError>
pub fn create( founder: &SigningIdentity, label: &str, recovery: &VerifyingIdentity, ) -> Result<Self, IdentityError>
Starts an identity. The founding device signs its own creation, which is the one place a signature is not checked against prior membership.
Sourcepub fn enrol(
&mut self,
author: &SigningIdentity,
device: &VerifyingIdentity,
label: &str,
) -> Result<Sequence, IdentityError>
pub fn enrol( &mut self, author: &SigningIdentity, device: &VerifyingIdentity, label: &str, ) -> Result<Sequence, IdentityError>
Adds a device. The author must be trusted right now.
Sourcepub fn revoke(
&mut self,
author: &SigningIdentity,
device: DeviceId,
) -> Result<Sequence, IdentityError>
pub fn revoke( &mut self, author: &SigningIdentity, device: DeviceId, ) -> Result<Sequence, IdentityError>
Removes a device. A device may revoke itself — that is what “log out this phone” does — but may not revoke the last one.
Sourcepub fn recover(
&mut self,
recovery_key: &SigningIdentity,
device: &VerifyingIdentity,
label: &str,
) -> Result<Sequence, IdentityError>
pub fn recover( &mut self, recovery_key: &SigningIdentity, device: &VerifyingIdentity, label: &str, ) -> Result<Sequence, IdentityError>
Replaces every device with one new device. Only the recovery key may sign this, which is why that key is kept offline.
Sourcepub fn from_entries(
entries: Vec<Entry>,
recovery: VerifyingIdentity,
) -> Result<Self, IdentityError>
pub fn from_entries( entries: Vec<Entry>, recovery: VerifyingIdentity, ) -> Result<Self, IdentityError>
Rebuilds a log from entries received elsewhere. Verified first, so an invalid history can never become an appendable one.
pub fn entries(&self) -> &[Entry]
Sourcepub fn head(&self) -> [u8; 32]
pub fn head(&self) -> [u8; 32]
The head link, which identifies this exact history in one 32-byte value.
Sourcepub fn root(&self) -> [u8; 32]
pub fn root(&self) -> [u8; 32]
The root link: entry 0’s link. It never changes as the log grows, so it is the identity’s stable 32-byte name, the value a relying party pins (spec §16.1).
Sourcepub fn recovery_key(&self) -> &VerifyingIdentity
pub fn recovery_key(&self) -> &VerifyingIdentity
The recovery key this log was constructed with.
Sourcepub fn membership(&self) -> Membership
pub fn membership(&self) -> Membership
The devices trusted now.
Sourcepub fn verify(
entries: &[Entry],
recovery: &VerifyingIdentity,
) -> Result<Membership, IdentityError>
pub fn verify( entries: &[Entry], recovery: &VerifyingIdentity, ) -> Result<Membership, IdentityError>
Replays a log received from elsewhere, checking every signature, link and authority decision. This is the function a verifier actually runs.