Skip to main content

Kever

Struct Kever 

Source
pub struct Kever {
    pub db: Arc<Baser>,
    pub delpre: Option<String>,
    pub verfers: Option<Vec<Verfer>>,
    pub ndigers: Option<Vec<Diger>>,
    /* private fields */
}

Fields§

§db: Arc<Baser>§delpre: Option<String>§verfers: Option<Vec<Verfer>>§ndigers: Option<Vec<Diger>>

Implementations§

Source§

impl Kever

Source

pub fn new( db: Arc<Baser>, locals: &Locals, state: Option<KeyStateRecord>, serder: Option<SerderKERI>, sigers: Option<Vec<Siger>>, wigers: Option<Vec<Siger>>, est_only: Option<bool>, delseqner: Option<Seqner>, delsaider: Option<Saider>, firner: Option<Seqner>, dater: Option<Dater>, eager: Option<bool>, local: Option<bool>, check: Option<bool>, ) -> Result<Self, KERIError>

Create a new Kever instance for an inception event

§Arguments
  • state - Optional key state record
  • serder - Optional serialized event data
  • sigers - Optional list of indexed controller signatures
  • wigers - Optional list of indexed witness signatures
  • db - LMDB database instance
  • est_only - Optional boolean, True means establishment only events allowed
  • delseqner - Optional delegating event sequence number
  • delsaider - Optional delegating event SAID
  • firner - Optional first seen ordinal number
  • dater - Optional first seen timestamp
  • cues - Optional queue for notices or requests
  • eager - Optional boolean for eager validation
  • local - Optional boolean for event source validation logic
  • check - Optional boolean for database update control
§Returns
  • Result<Self, KERIError> - New Kever instance or error
Source

pub fn reload(db: Arc<Baser>, state: KeyStateRecord) -> Result<Self, KERIError>

Reload Kever attributes (aka its state) from state (KeyStateRecord)

§Arguments
  • state - Instance of KeyStateRecord containing key state information
§Returns
  • Result<Self, KERIError> - New Kever instance initialized from state or error
Source

pub fn locally_witnessed( &self, locals: &Locals, wits: Option<&[String]>, serder: Option<&SerderKERI>, ) -> bool

Returns true if a local controller is a witness of this Kever’s KEL or the provided witness list

§Arguments
  • wits - Optional list of qb64 witness prefixes. If None, uses the current witnesses for this Kever
  • serder - Optional SerderKERI instance. If provided, derives witnesses from it instead of current state
§Returns

true if any of the prefixes in self.prefixes is also in the witness list; false otherwise

Source

pub fn derive_backs( &self, serder: &SerderKERI, ) -> Result<(Vec<String>, Vec<String>, Vec<String>), KERIError>

Derives and returns tuple of (wits, cuts, adds) for backers given current set and any changes provided by serder.

§Arguments
  • serder - Instance of current event
§Returns

A tuple containing:

  • wits - List of witness prefixes (full list of backers)
  • cuts - List of witnesses removed in latest establishment event
  • adds - List of witnesses added in latest establishment event
§Errors

Returns ValidationError if there are invalid combinations of witnesses, cuts, or adds

Source

pub fn verfers(&self) -> Option<Vec<Verfer>>

Source

pub fn sner(&self) -> Option<Number>

Source

pub fn last_est(&self) -> Option<LastEstLoc>

Source§

impl Kever

Source

pub fn update( &mut self, locals: &Locals, serder: SerderKERI, sigers: Vec<Siger>, wigers: Option<Vec<Siger>>, delseqner: Option<Seqner>, delsaider: Option<Saider>, firner: Option<Seqner>, dater: Option<Dater>, eager: bool, local: bool, check: bool, ) -> Result<(), KERIError>

Not an inception event. Verify event serder and indexed signatures in sigers and update state

§Arguments
  • serder - Instance of event
  • sigers - List of SigMat instances of indexed signatures of controller signatures of event. Index is offset into keys list from latest est event and when provided index is offset into key digest list from prior next est event to latest est event.
  • wigers - Optional list of Siger instances of indexed witness signatures of event. Index is offset into wits list from latest est event
  • delseqner - Optional instance of delegating event sequence number. If this event is not delegated then seqner is ignored
  • delsaider - Optional instance of delegating event said. If this event is not delegated then diger is ignored
  • firner - Optional Seqner instance of cloned first seen ordinal If cloned mode then firner maybe provided (not None) When firner provided then compare fn of dater and database and first seen if not match then log and add cue notify problem
  • dater - Optional Dater instance of cloned replay datetime If cloned mode then dater maybe provided (not None) When dater provided then use dater for first seen datetime
  • eager - If true, try harder to find validate events by walking KELs. Enables only being eager in escrow processing not initial parsing. If false, only use pre-existing information if any.
  • local - Event source for validation logic. True means event source is local (protected). False means event source is remote (unprotected).
  • check - If true, do not update the database in any non-idempotent way. Useful for reinitializing the Kevers from a persisted KEL without updating non-idempotent first seen .fels and timestamps.
§Returns
  • Result<(), KERIError> - Ok if successful, Error otherwise
Source

pub fn rotate( &self, serder: &SerderKERI, ) -> Result<(Tholder, Number, Vec<String>, Vec<String>, Vec<String>), KERIError>

Generic Rotate Operation Validation Processing Validates provisional rotation Same logic for both ‘rot’ and ‘drt’ (plain and delegated rotation)

§Arguments
  • serder - Instance of rotation (‘rot’ or ‘drt’) event.
§Returns

A tuple (tholder, toader, wits, cuts, adds) of provisional results of rotation subject to additional validation

§Errors
  • ValidationError - if the rotation event is invalid
  • ValueError - if the toad value is invalid
Source

pub fn log_event( &self, locals: &Locals, serder: SerderKERI, sigers: Vec<Siger>, wigers: Option<Vec<Siger>>, wits: Option<Vec<String>>, first: bool, seqner: Option<Seqner>, saider: Option<Saider>, _firner: Option<Seqner>, dater: Option<Dater>, local: bool, ) -> Result<(Option<u64>, DateTime<Utc>), KERIError>

Source

pub fn state(&self) -> Result<KeyStateRecord, KERIError>

Returns KeyStateRecord instance of current key state

Source

pub fn toader(&self) -> Option<Number>

Source

pub fn wits(&self) -> Vec<String>

Source

pub fn prefixer(&self) -> Option<Prefixer>

Source

pub fn serder(&self) -> Option<SerderKERI>

Source

pub fn delpre(&self) -> Option<String>

Source

pub fn fetch_prior_digers( &self, sn: Option<u64>, ) -> Result<Option<Vec<Diger>>, KERIError>

Returns either the most recent prior list of digers before .last_est or None

Starts searching at sn or if sn is None at sn = .last_est.s - 1

Returns list of Digers instances at the most recent prior est event relative to the given sequence number (sn) otherwise returns None. Walks backwards to the more recent prior establishment event before the .sn if any. If sn represents an interaction event (ixn) then the result will be the current valid list of digers. If sn represents an establishment event then the result will be the list of digers immediately prior to the current list.

§Arguments
  • sn - Optional sequence number to start searching. If None then start at .last_est.s - 1
§Returns
  • Result<Option<Vec<Diger>>, KERIError> - Vector of Diger instances or None if no prior est evt to current .last_est
Source

pub fn transferable(&self) -> bool

Auto Trait Implementations§

§

impl Freeze for Kever

§

impl RefUnwindSafe for Kever

§

impl Send for Kever

§

impl Sync for Kever

§

impl Unpin for Kever

§

impl UnsafeUnpin for Kever

§

impl UnwindSafe for Kever

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more