Skip to main content

Kevery

Struct Kevery 

Source
pub struct Kevery {
    pub db: Arc<Baser>,
    pub cues: VecDeque<Cue>,
    pub rvy: Option<Rvy>,
    pub lax: bool,
    pub local: bool,
    pub cloned: bool,
    pub direct: bool,
    pub check: bool,
    pub kevers: HashMap<String, Kever>,
    pub locals: Locals,
}
Expand description

Kevery (Key Event Message Processing Facility) processes an incoming message stream composed of KERI key event related messages and attachments. Kevery acts a Kever (key event verifier) factory for managing key state of KERI identifier prefixes.

Only supports current version VERSION

Fields§

§db: Arc<Baser>

Database instance for KERI event storage

§cues: VecDeque<Cue>

Notices of events needing receipt or requests needing response

§rvy: Option<Rvy>

Optional recovery module

§lax: bool

True means operate in promiscuous (unrestricted) mode, False means operate in nonpromiscuous (restricted) mode as determined by local and prefixes

§local: bool

True means event source is local (protected) for validation False means event source is remote (unprotected) for validation

§cloned: bool

True means cloned message stream so use attached datetimes from clone source not own False means use current datetime

§direct: bool

True means direct mode so cue notices for receipts etc False means indirect mode so don’t cue notices

§check: bool

True means 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.

§kevers: HashMap<String, Kever>

Cache of kevers indexed by prefix

§locals: Locals

Identifiers controlled locally (own AIDs and group AIDs). Owned here, not in Baser, so there is exactly one copy; passed to Kever during validation.

Implementations§

Source§

impl Kevery

Source

pub const TIMEOUT_OOE: u64 = 1200

Timeout constants (in seconds)

Source

pub const TIMEOUT_PSE: u64 = 3600

Source

pub const TIMEOUT_PWE: u64 = 3600

Source

pub const TIMEOUT_LDE: u64 = 3600

Source

pub const TIMEOUT_UWE: u64 = 3600

Source

pub const TIMEOUT_URE: u64 = 3600

Source

pub const TIMEOUT_VRE: u64 = 3600

Source

pub const TIMEOUT_KSN: u64 = 3600

Source

pub const TIMEOUT_QNF: u64 = 300

Source

pub fn new( cues: Option<VecDeque<Cue>>, db: Arc<Baser>, rvy: Option<Rvy>, lax: Option<bool>, local: Option<bool>, cloned: Option<bool>, direct: Option<bool>, check: Option<bool>, ) -> Result<Self, KERIError>

Initialize a new Kevery instance

§Parameters
  • cues - Optional cues to initialize with
  • db - Database instance
  • rvy - Optional recovery module
  • lax - True means operate in promiscuous (unrestricted) mode
  • local - True means event source is local (protected) for validation
  • cloned - True means cloned message stream so use attached datetimes from clone source
  • direct - True means direct mode so cue notices for receipts etc
  • check - True means do not update the database in any non-idempotent way
Source

pub fn kevers(&self) -> &HashMap<String, Kever>

Get a reference to the kevers dictionary

Source

pub fn kevers_mut(&mut self) -> &mut HashMap<String, Kever>

Get a mutable reference to the kevers dictionary

Source

pub fn prefixes(&self) -> &IndexSet<String>

Get the prefixes as an ordered set

Source

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

Process one event serder with attached indexed signatures sigers

§Parameters
  • serder - Instance of event to process
  • sigers - Instances of attached controller indexed sigs
  • wigers - Instances of attached witness indexed sigs, otherwise None
  • delseqner - Instance of delegating event sequence number. If this event is not delegated then seqner is ignored
  • delsaider - Instance of delegating event SAID. If this event is not delegated then saider is ignored
  • firner - Instance of cloned first seen ordinal. If cloned mode then firner maybe provided (not None)
  • dater - Instance of cloned replay datetime. If cloned mode then dater maybe provided (not None)
  • eager - True means try harder to find validate events by walking KELs. False means only use pre-existing information if any.
  • local - True means local (protected) event source. False means remote (unprotected). None means use default .local.
Source

pub fn process_escrows(&mut self)

Run every escrow that is implemented, once each: out of order, partial signatures, unverified witness and non-transferable receipts, partial witnesses, then likely duplicitous. Out of order runs first so an event whose prior event just arrived moves on to the signature escrows in the same pass; unverified receipts run before partial witnesses so receipts that arrived ahead of their event can complete it in the same pass. keripy’s order differs only in running partial signatures after partial witnesses (keripy: core/eventing.py Kevery.processEscrows).

Source

pub fn process_escrow_partial_sigs(&mut self) -> Result<usize, KERIError>

Retry events escrowed for missing signatures (keripy processEscrowPartialSigs). Each escrowed event is reprocessed with every signature stored for it so far. It stays escrowed while still short of signatures, and leaves the escrow once accepted, stale (older than Self::TIMEOUT_PSE) or invalid for any other reason. An event that becomes fully signed but is short of witness signatures moves to the partially witnessed escrow.

Returns the number of events accepted.

Source

pub fn process_escrow_partial_wigs(&mut self) -> Result<usize, KERIError>

Retry events escrowed for missing witness signatures (keripy processEscrowPartialWigs), the same way as Self::process_escrow_partial_sigs with Self::TIMEOUT_PWE.

Source

pub fn process_escrow_out_of_orders(&mut self) -> Result<usize, KERIError>

Retry events escrowed because their prior event wasn’t accepted yet (keripy processEscrowOutOfOrders). An entry stays while its prior event is still missing, and leaves once accepted, stale (older than Self::TIMEOUT_OOE) or invalid. One that now lacks only signatures or witness signatures moves to that escrow.

Source

pub fn process_escrow_duplicitous(&mut self) -> Result<usize, KERIError>

Retry events escrowed as likely duplicitous (keripy processEscrowDuplicitous). An entry stays while it still conflicts with the accepted event at its sn, which in practice is until it is older than Self::TIMEOUT_LDE; until then it is kept, with its signatures, as evidence of the conflicting event. It leaves early only if it becomes valid or turns out invalid for another reason.

Source

pub fn process_escrow_unver_nontrans(&mut self) -> Result<usize, KERIError>

Retry non-transferable receipts whose event was not yet known (keripy processEscrowUnverNonTrans). A receipt for an event waiting in the partially witnessed escrow adds its witness signature there; one for an accepted event is stored as a wig or receipt couple.

Source

pub fn process_escrow_unver_witness(&mut self) -> Result<usize, KERIError>

Retry indexed witness receipts whose event was not yet known (keripy processEscrowUnverWitness). They can only complete an event waiting in the partially witnessed escrow.

Source

pub fn process_receipt_witness( &self, serder: SerderKERI, wigers: Vec<Siger>, local: Option<bool>, ) -> Result<(), KERIError>

Process one witness receipt serder with attached witness wigers (indexed signatures)

§Parameters
  • serder - Instance of serialized receipt message (not receipted event)
  • wigers - Instances that with witness indexed signatures. Index is offset into witness list of latest establishment event for receipted event. Signature uses key pair derived from nontrans witness prefix in associated witness list.
  • local - True means local (protected) event source. False means remote (unprotected). None means use default .local.

Receipt dict labels

  • vs - version string
  • pre - qb64 prefix
  • sn - hex string sequence number
  • ilk - rct
  • dig - qb64 digest of receipted event
Source

pub fn process_attached_receipt_couples( &mut self, _serder: SerderKERI, _firner: Option<Seqner>, _cigars: Vec<Cigar>, ) -> Result<(), KERIError>

Source

pub fn process_attached_receipt_quadruples( &mut self, _serder: SerderKERI, _trqs: Vec<Trqs>, _firner: Option<Seqner>, _local: Option<bool>, ) -> Result<(), KERIError>

Source

pub fn process_receipt( &mut self, serder: SerderKERI, cigars: Vec<Cigar>, local: Option<bool>, ) -> Result<(), KERIError>

Process one receipt serder with attached cigars may or may not be a witness receipt. If prefix matches witness then promote to indexed witness signature and store appropriately. Otherwise signature is nontrans nonwitness endorser (watcher etc)

§Parameters
  • serder - Receipt instance of serialized receipt message
  • cigars - Instances that contain receipt couple signature in .raw and public key in .verfer
  • local - True means local (protected) event source. False means remote (unprotected). None means use default .local.

Receipt dict labels

  • vs - version string
  • pre - qb64 prefix
  • sn - hex string sequence number
  • ilk - rct
  • dig - qb64 digest of receipted event
Source

pub fn process_query( &mut self, serder: SerderKERI, source: Option<Prefixer>, sigers: Option<Vec<Siger>>, cigars: Option<Vec<Cigar>>, ) -> Result<(), KERIError>

Process query mode replay message for collective or single element query. Assume promiscuous mode for now.

§Parameters
  • serder - Query message serder
  • source - Identifier prefix of querier (optional)
  • sigers - List of Siger instances of attached controller indexed sigs (optional)
  • cigars - List of Cigar instances of attached non-trans sigs (optional)
Source

pub fn fully_witnessed(&self, serder: &SerderKERI) -> bool

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.

§

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