Skip to main content

KeyStateRecord

Struct KeyStateRecord 

Source
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: Prefix

Identifier prefix (the AID this state describes).

§s: String

Sequence number of the latest event, lowercase-hex.

§p: String

SAID of the prior event (empty at inception).

§d: Said

SAID of the latest event.

§f: String

First-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: String

Controller-asserted timestamp (RFC 3339).

§et: String

Latest establishment event type (icp/rot/dip/drt).

§kt: Threshold

Current signing threshold (KERI hex/clause string).

§k: Vec<CesrKey>

Current signing key(s), CESR-encoded.

§nt: Threshold

Next-key threshold (KERI hex/clause string).

§n: Vec<Said>

Next-key commitment digest(s).

§bt: Threshold

Backer (witness) threshold (bt, hex string).

§b: Vec<Prefix>

Current backer (witness) list.

§c: Vec<ConfigTrait>

Configuration traits.

§ee: LatestEstablishmentEvent

Latest establishment event summary ({s, d, br, ba}).

§di: String

Delegator AID (empty string when not delegated).

Implementations§

Source§

impl KeyStateRecord

Source

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 current KeyState (from replay).
  • dt: An RFC-3339 timestamp (injected now).
Source

pub fn sequence(&self) -> u128

The sequence number this record notices (the latest event’s s, decoded from its lowercase-hex wire form).

Source

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

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

Source§

fn clone(&self) -> KeyStateRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeyStateRecord

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for KeyStateRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for KeyStateRecord

Source§

impl PartialEq for KeyStateRecord

Source§

fn eq(&self, other: &KeyStateRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for KeyStateRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for KeyStateRecord

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.