pub struct KeyStateRecord {Show 17 fields
pub vn: [u32; 2],
pub i: Prefix,
pub s: String,
pub p: String,
pub d: Said,
pub f: String,
pub dt: String,
pub et: String,
pub kt: Threshold,
pub k: Vec<CesrKey>,
pub nt: Threshold,
pub n: Vec<Said>,
pub bt: Threshold,
pub b: Vec<Prefix>,
pub c: Vec<ConfigTrait>,
pub ee: LatestEstablishmentEvent,
pub di: String,
}Expand description
A KERI-conformant key-state notice — the wire record keripy emits as a
ksn/rpy reply and persists as KeyStateRecord.
This is the byte-interoperable counterpart to the auths-internal
KeyStateNotice: where KeyStateNotice is an auths-only envelope around a
KeyState, KeyStateRecord is the canonical KERI shape a peer (keripy,
keriox) produces and consumes — field order and labels
{vn, i, s, p, d, f, dt, et, kt, k, nt, n, bt, b, c, ee, di}, sequence
numbers as lowercase hex, thresholds as KERI hex/clause strings.
It is a parsed type: holding one means the labels and shapes already
matched the KERI form, so KeyStateRecord::into_key_state is total. Build
one from an auths KEL with KeyStateRecord::from_kel (emit a record a peer
can read); accept one from a peer by deserializing then
into_key_state (consume a keripy KSN).
Fields§
§vn: [u32; 2]Protocol version [major, minor] — [1, 0] for the KERI10 generation.
i: PrefixIdentifier prefix (the AID this state describes).
s: StringSequence number of the latest event, lowercase-hex.
p: StringSAID of the prior event (empty at inception).
d: SaidSAID of the latest event.
f: StringFirst-seen ordinal. auths does not maintain a first-seen log separate from
the KEL, so this mirrors s (the latest sequence) — truthful for a
single-source replay, where first-seen order is event order.
dt: StringController-asserted timestamp (RFC 3339).
et: StringLatest establishment event type (icp/rot/dip/drt).
kt: ThresholdCurrent signing threshold (KERI hex/clause string).
k: Vec<CesrKey>Current signing key(s), CESR-encoded.
nt: ThresholdNext-key threshold (KERI hex/clause string).
n: Vec<Said>Next-key commitment digest(s).
bt: ThresholdBacker (witness) threshold (bt, hex string).
b: Vec<Prefix>Current backer (witness) list.
c: Vec<ConfigTrait>Configuration traits.
ee: LatestEstablishmentEventLatest establishment event summary ({s, d, br, ba}).
di: StringDelegator AID (empty string when not delegated).
Implementations§
Source§impl KeyStateRecord
impl KeyStateRecord
Sourcepub fn from_kel(
events: &[Event],
state: &KeyState,
dt: impl Into<String>,
) -> Option<Self>
pub fn from_kel( events: &[Event], state: &KeyState, dt: impl Into<String>, ) -> Option<Self>
Build a KERI key-state record by replaying a validated KEL into its
current state, stamped at dt.
events is the full, in-order KEL (inception first); the record’s s/d
come from the last event and p/ee/et from its latest establishment
event. Returns None only if events is empty (no inception to anchor a
state) — the caller has nothing to notice.
Args:
events: The replayed KEL, in sequence order.state: The resolved currentKeyState(fromreplay).dt: An RFC-3339 timestamp (injectednow).
Sourcepub fn sequence(&self) -> u128
pub fn sequence(&self) -> u128
The sequence number this record notices (the latest event’s s, decoded
from its lowercase-hex wire form).
Sourcepub fn check_not_stale(&self, last_seen_seq: u128) -> Result<(), KsnError>
pub fn check_not_stale(&self, last_seen_seq: u128) -> Result<(), KsnError>
Reject this notice if it is older than a state the verifier already trusts.
A key-state notice is a snapshot; a thin client that has already seen
sequence last_seen_seq (e.g. it holds a fresher witness receipt) must not
accept a notice that rewinds below it — that is a stale or replayed view of
the identity. Returns KsnError::Stale when self.sequence() < last_seen_seq; equal-or-newer is fine.
Args:
last_seen_seq: The highest sequence the verifier already trusts.
Sourcepub fn into_key_state(self) -> KeyState
pub fn into_key_state(self) -> KeyState
Project this KERI record back to the auths KeyState the rest of the
platform reasons over (a thin client ingesting a peer’s published state).
Total: a parsed KeyStateRecord already carries the labels and shapes a
KeyState needs, so no field can be missing or mistyped here.
Trait Implementations§
Source§impl Clone for KeyStateRecord
impl Clone for KeyStateRecord
Source§fn clone(&self) -> KeyStateRecord
fn clone(&self) -> KeyStateRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeyStateRecord
impl Debug for KeyStateRecord
Source§impl<'de> Deserialize<'de> for KeyStateRecord
impl<'de> Deserialize<'de> for KeyStateRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for KeyStateRecord
Source§impl PartialEq for KeyStateRecord
impl PartialEq for KeyStateRecord
Source§impl Serialize for KeyStateRecord
impl Serialize for KeyStateRecord
impl StructuralPartialEq for KeyStateRecord
Auto Trait Implementations§
impl Freeze for KeyStateRecord
impl RefUnwindSafe for KeyStateRecord
impl Send for KeyStateRecord
impl Sync for KeyStateRecord
impl Unpin for KeyStateRecord
impl UnsafeUnpin for KeyStateRecord
impl UnwindSafe for KeyStateRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.