Skip to main content

IdentityLog

Struct IdentityLog 

Source
pub struct IdentityLog { /* private fields */ }
Expand description

The identity itself: an append-only log plus the membership it implies.

Implementations§

Source§

impl IdentityLog

Source

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.

Source

pub fn enrol( &mut self, author: &SigningIdentity, device: &VerifyingIdentity, label: &str, ) -> Result<Sequence, IdentityError>

Adds a device. The author must be trusted right now.

Source

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.

Source

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.

Source

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.

Source

pub fn entries(&self) -> &[Entry]

Source

pub fn head(&self) -> [u8; 32]

The head link, which identifies this exact history in one 32-byte value.

Source

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).

Source

pub fn recovery_key(&self) -> &VerifyingIdentity

The recovery key this log was constructed with.

Source

pub fn membership(&self) -> Membership

The devices trusted now.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.