pub struct KeyState {Show 14 fields
pub prefix: Prefix,
pub current_keys: Vec<CesrKey>,
pub next_commitment: Vec<Said>,
pub sequence: u128,
pub last_event_said: Said,
pub is_abandoned: bool,
pub threshold: Threshold,
pub next_threshold: Threshold,
pub backers: Vec<Prefix>,
pub backer_threshold: Threshold,
pub config_traits: Vec<ConfigTrait>,
pub is_non_transferable: bool,
pub delegator: Option<Prefix>,
pub last_establishment_sequence: u128,
}Expand description
Current key state derived from replaying a KEL.
This struct captures the complete state of a KERI identity at a given point in its event log. It is computed by walking the KEL from inception to the latest event.
Fields§
§prefix: PrefixThe KERI identifier prefix (used in did:keri:<prefix>)
current_keys: Vec<CesrKey>Current signing key(s), CESR-encoded.
next_commitment: Vec<Said>Next key commitment(s) for pre-rotation (Blake3 digests).
sequence: u128Current sequence number (0 for inception, increments with each event)
last_event_said: SaidSAID of the last processed event
is_abandoned: boolWhether this identity has been abandoned (empty next commitment in rotation)
threshold: ThresholdCurrent signing threshold
next_threshold: ThresholdNext signing threshold (committed)
backers: Vec<Prefix>Current backer/witness list
backer_threshold: ThresholdCurrent backer threshold
config_traits: Vec<ConfigTrait>Configuration traits from inception (and rotation for RB/NRB)
is_non_transferable: boolWhether this identity is non-transferable (inception n was empty)
delegator: Option<Prefix>Delegator AID (if this is a delegated identity)
last_establishment_sequence: u128Sequence number of the last establishment event (ICP or ROT). Used to locate the pre-committed next key in the keychain. IXN events do not change this value.
Implementations§
Source§impl KeyState
impl KeyState
Sourcepub fn from_inception(
prefix: Prefix,
keys: Vec<CesrKey>,
next: Vec<Said>,
threshold: Threshold,
next_threshold: Threshold,
said: Said,
backers: Vec<Prefix>,
backer_threshold: Threshold,
config_traits: Vec<ConfigTrait>,
) -> KeyState
pub fn from_inception( prefix: Prefix, keys: Vec<CesrKey>, next: Vec<Said>, threshold: Threshold, next_threshold: Threshold, said: Said, backers: Vec<Prefix>, backer_threshold: Threshold, config_traits: Vec<ConfigTrait>, ) -> KeyState
Create initial state from an inception event.
Args:
prefix- The KERI identifier (same as inception SAID)keys- The initial signing key(s)next- The next-key commitment(s)threshold- Initial signing thresholdnext_threshold- Committed next signing thresholdsaid- The inception event SAIDbackers- Initial witness/backer listbacker_threshold- Witness/backer thresholdconfig_traits- Configuration traits from inception
Sourcepub fn apply_rotation(
&mut self,
new_keys: Vec<CesrKey>,
new_next: Vec<Said>,
threshold: Threshold,
next_threshold: Threshold,
sequence: u128,
said: Said,
backers_to_remove: &[Prefix],
backers_to_add: &[Prefix],
backer_threshold: Threshold,
config_traits: Vec<ConfigTrait>,
)
pub fn apply_rotation( &mut self, new_keys: Vec<CesrKey>, new_next: Vec<Said>, threshold: Threshold, next_threshold: Threshold, sequence: u128, said: Said, backers_to_remove: &[Prefix], backers_to_add: &[Prefix], backer_threshold: Threshold, config_traits: Vec<ConfigTrait>, )
Apply a rotation event to update state.
This should only be called after verifying:
- The new key matches the previous next_commitment
- The event’s previous SAID matches last_event_said
- The sequence is exactly last_sequence + 1
Sourcepub fn apply_interaction(&mut self, sequence: u128, said: Said)
pub fn apply_interaction(&mut self, sequence: u128, said: Said)
Apply an interaction event (updates sequence and SAID only).
Interaction events anchor data but don’t change keys.
Sourcepub fn current_key(&self) -> Option<&CesrKey>
pub fn current_key(&self) -> Option<&CesrKey>
Get the current signing key (first key for single-sig).
Sourcepub fn can_rotate(&self) -> bool
pub fn can_rotate(&self) -> bool
Check if key can be rotated.
Returns false if the identity has been abandoned (empty next commitment).
Sourcepub fn can_emit_ixn(&self) -> bool
pub fn can_emit_ixn(&self) -> bool
Check if this identity can emit interaction (ixn) events.
Returns false if the identity is non-transferable (empty n[] at inception)
or establishment-only ("EO" in c[]). Both conditions prohibit ixn events
per KERI spec.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for KeyState
impl<'de> Deserialize<'de> for KeyState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for KeyState
Source§impl Serialize for KeyState
impl Serialize for KeyState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for KeyState
Auto Trait Implementations§
impl Freeze for KeyState
impl RefUnwindSafe for KeyState
impl Send for KeyState
impl Sync for KeyState
impl Unpin for KeyState
impl UnsafeUnpin for KeyState
impl UnwindSafe for KeyState
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.