aegis-keys · recovery
Declared module signatures, types, configuration, and source documentation.
Source: aegis/aegis-keys/src/recovery.rs. SHA-256: 036f0e6d4f999ac13319be0ac49b2584670a98441175ad504dda798b518bb14d.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
recovery::RecoveryCeremony
A recovery ceremony state machine (AEGIS Spec SS6.7).
Recovery is a multi-phase process:
- Ceremony is initiated with a
RecoveryConfigspecifying guardians and threshold. - Guardians provide signed authorizations, each adding their weight.
- Once total weight reaches the threshold, the ceremony is "threshold met."
- A mandatory timelock period must also elapse before execution is permitted.
- Only when BOTH conditions are met (
can_execute()) may recovery proceed.
The timelock prevents immediate recovery, giving the legitimate key holder time to detect and abort unauthorized recovery attempts.
#[derive(Debug)]
pub struct RecoveryCeremony {
/// Unique identifier for this recovery ceremony.
pub ceremony_id: String,
/// Recovery configuration (guardians, threshold, timelock).
pub config: RecoveryConfig,
/// Accumulated guardian authorizations.
pub authorizations: Vec<GuardianAuthorization>,
/// When the ceremony was initiated.
pub initiated_at: DateTime<Utc>,
/// Timestamp before which recovery cannot execute (timelock expiry).
pub timelock_until: DateTime<Utc>
}Source line: 25.
recovery::GuardianAuthorization
A signed authorization from a recovery guardian.
#[derive(Debug, Clone)]
pub struct GuardianAuthorization {
/// The guardian providing authorization.
pub guardian: Guardian,
/// When the authorization was provided.
pub authorized_at: DateTime<Utc>,
/// Cryptographic signature proving the guardian's consent.
pub signature: String
}Source line: 40.
recovery::RecoveryCeremony::new
Create a new recovery ceremony.
Initializes the ceremony with a unique ID, records the initiation time, and computes the timelock expiry based on the config's timelock duration.
Arguments
config- The recovery configuration specifying guardians, threshold, and timelock.
Returns
A new RecoveryCeremony with no authorizations accumulated.
pub fn new(config: RecoveryConfig) -> Self;Source line: 62.
recovery::RecoveryCeremony::add_authorization
Add a guardian's authorization to the ceremony.
The guardian must be listed in the recovery config. Duplicate authorizations from the same guardian are rejected.
Arguments
auth- The guardian's signed authorization.
Errors
Returns KeyError::RecoveryFailed if:
- The guardian is not in the recovery config
- The guardian has already authorized
pub fn add_authorization(&mut self, auth: GuardianAuthorization) -> Result<(), KeyError>;Source line: 90.
recovery::RecoveryCeremony::is_threshold_met
Check whether the accumulated guardian weight meets the threshold.
Each guardian has a weight; this returns true when the sum of
weights from authorized guardians reaches or exceeds the configured threshold.
pub fn is_threshold_met(&self) -> bool;Source line: 130.
recovery::RecoveryCeremony::is_timelock_expired
Check whether the mandatory timelock period has expired.
The timelock prevents immediate recovery execution, giving the legitimate owner time to detect and abort unauthorized attempts.
pub fn is_timelock_expired(&self) -> bool;Source line: 140.
recovery::RecoveryCeremony::can_execute
Check whether recovery can proceed.
Recovery requires BOTH conditions to be met:
- The accumulated guardian weight reaches the threshold.
- The timelock period has elapsed.
pub fn can_execute(&self) -> bool;Source line: 149.
recovery::RecoveryCeremony::accumulated_weight
Returns the total accumulated authorization weight.
pub fn accumulated_weight(&self) -> u32;Source line: 154.
recovery::RecoveryCeremony::authorization_count
Returns the number of guardians who have authorized.
pub fn authorization_count(&self) -> usize;Source line: 159.