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: boolTrue means operate in promiscuous (unrestricted) mode, False means operate in nonpromiscuous (restricted) mode as determined by local and prefixes
local: boolTrue means event source is local (protected) for validation False means event source is remote (unprotected) for validation
cloned: boolTrue means cloned message stream so use attached datetimes from clone source not own False means use current datetime
direct: boolTrue means direct mode so cue notices for receipts etc False means indirect mode so don’t cue notices
check: boolTrue 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: LocalsIdentifiers 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
impl Kevery
Sourcepub const TIMEOUT_OOE: u64 = 1200
pub const TIMEOUT_OOE: u64 = 1200
Timeout constants (in seconds)
pub const TIMEOUT_PSE: u64 = 3600
pub const TIMEOUT_PWE: u64 = 3600
pub const TIMEOUT_LDE: u64 = 3600
pub const TIMEOUT_UWE: u64 = 3600
pub const TIMEOUT_URE: u64 = 3600
pub const TIMEOUT_VRE: u64 = 3600
pub const TIMEOUT_KSN: u64 = 3600
pub const TIMEOUT_QNF: u64 = 300
Sourcepub 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>
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 withdb- Database instancervy- Optional recovery modulelax- True means operate in promiscuous (unrestricted) modelocal- True means event source is local (protected) for validationcloned- True means cloned message stream so use attached datetimes from clone sourcedirect- True means direct mode so cue notices for receipts etccheck- True means do not update the database in any non-idempotent way
Sourcepub fn kevers_mut(&mut self) -> &mut HashMap<String, Kever>
pub fn kevers_mut(&mut self) -> &mut HashMap<String, Kever>
Get a mutable reference to the kevers dictionary
Sourcepub 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>
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 processsigers- Instances of attached controller indexed sigswigers- Instances of attached witness indexed sigs, otherwise Nonedelseqner- Instance of delegating event sequence number. If this event is not delegated then seqner is ignoreddelsaider- Instance of delegating event SAID. If this event is not delegated then saider is ignoredfirner- 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.
Sourcepub fn process_escrows(&mut self)
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).
Sourcepub fn process_escrow_partial_sigs(&mut self) -> Result<usize, KERIError>
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.
Sourcepub fn process_escrow_partial_wigs(&mut self) -> Result<usize, KERIError>
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.
Sourcepub fn process_escrow_out_of_orders(&mut self) -> Result<usize, KERIError>
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.
Sourcepub fn process_escrow_duplicitous(&mut self) -> Result<usize, KERIError>
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.
Sourcepub fn process_escrow_unver_nontrans(&mut self) -> Result<usize, KERIError>
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.
Sourcepub fn process_escrow_unver_witness(&mut self) -> Result<usize, KERIError>
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.
Sourcepub fn process_receipt_witness(
&self,
serder: SerderKERI,
wigers: Vec<Siger>,
local: Option<bool>,
) -> Result<(), KERIError>
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
pub fn process_attached_receipt_couples( &mut self, _serder: SerderKERI, _firner: Option<Seqner>, _cigars: Vec<Cigar>, ) -> Result<(), KERIError>
pub fn process_attached_receipt_quadruples( &mut self, _serder: SerderKERI, _trqs: Vec<Trqs>, _firner: Option<Seqner>, _local: Option<bool>, ) -> Result<(), KERIError>
Sourcepub fn process_receipt(
&mut self,
serder: SerderKERI,
cigars: Vec<Cigar>,
local: Option<bool>,
) -> Result<(), KERIError>
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 messagecigars- Instances that contain receipt couple signature in .raw and public key in .verferlocal- 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
Sourcepub fn process_query(
&mut self,
serder: SerderKERI,
source: Option<Prefixer>,
sigers: Option<Vec<Siger>>,
cigars: Option<Vec<Cigar>>,
) -> Result<(), KERIError>
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 serdersource- 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)