Skip to main content

LogSet

Struct LogSet 

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

The did:webvh logs one credential verification uses, as the caller fetched them: the issuer’s, and those of delegation grant issuers.

The core keeps no state and never fetches. The caller fetches each log from log_url, gives the latest versionId it saw before for each DID (LogSet::with_seen_version_id), and afterwards remembers the latest versions the set reports (LogSet::outcomes), so a log later served rolled back or forked is refused.

A log is verified the first time a verification needs it (credential verification always uses the latest entry), against one clock read when the set is made, and its latest state is then reused for the rest of that verification, as the reference keeps one document per DID per verification. Make one set per verification.

Implementations§

Source§

impl LogSet

Source

pub fn new(clock: LogClock) -> Result<Self>

An empty set whose logs are checked against clock, read now, with the default limits.

Errors when the clock cannot be read (see LogClock::now_ns).

Source

pub fn with_limits(self, limits: Limits) -> Self

Check every log with these limits.

Source

pub fn with_log(self, did: &str, log: Vec<u8>) -> Self

The log (did.jsonl) of did, as fetched from log_url.

Source

pub fn with_seen_version_id(self, did: &str, seen: &str) -> Result<Self>

The latest versionId seen for did before. Its log must still contain it, so a log rolled back or forked since is refused.

Errors when seen is not a did:webvh versionId.

Source

pub fn now_ns(&self) -> i128

The time the logs are checked against, in nanoseconds since the Unix epoch.

Source

pub fn limits(&self) -> &Limits

The limits every log is checked with.

Source

pub fn contains(&self, did: &str) -> bool

True when the set holds a log for did.

Source

pub fn resolve(&self, did: &str) -> Option<Refusal<Resolution>>

The latest verified state of did’s log, or why the log was refused (a deactivated DID is deactivated). None when the set holds no log for did. The log is verified once; later calls reuse the answer.

Source

pub fn outcomes(&self) -> BTreeMap<String, Refusal<String>>

Every log resolved so far, by DID: its latest versionId (remember it as the version seen for that DID), or why it was refused. A log the verification never needed is not listed.

Trait Implementations§

Source§

impl Debug for LogSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for LogSet

§

impl !RefUnwindSafe for LogSet

§

impl !Sync for LogSet

§

impl Forget for LogSet

§

impl Move for LogSet

§

impl Send for LogSet
where NodeRef<Owned, String, Vec<u8>, LeafOrInternal>: Send, BoxRaw<(String, Vec<u8>)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, RefCell<BTreeMap<String, Result<Resolution, DidWebvhError>>>: Send,

§

impl Unpin for LogSet
where *const LeafNode<String, Vec<u8>> is !null: Unpin, Box<(String, Vec<u8>)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<String, Result<Resolution, DidWebvhError>> is !null: Unpin, Box<(String, Result<Resolution, DidWebvhError>)>: Unpin,

§

impl UnsafeUnpin for LogSet

§

impl UnwindSafe for LogSet

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.