sigil-core · recovery
Source declarations, signatures and documentation for recovery.
Source: sigil/node/sigil-core/src/recovery.rs. SHA-256: 59158fff11c66cbc0e1c0e9cb897a9ef017cf7037d8ebcb61a0eec09e681a980.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
recovery::BLOCKS_PER_DAY
Approximate blocks per day at 4-second block time.
pub const BLOCKS_PER_DAY: u64;Source line: 37.
recovery::MIN_RECOVERY_TIMELOCK_BLOCKS
Minimum recovery timelock (7 days). User-tunable down to this floor.
pub const MIN_RECOVERY_TIMELOCK_BLOCKS: u64;Source line: 40.
recovery::MAX_RECOVERY_TIMELOCK_BLOCKS
Maximum recovery timelock (90 days).
pub const MAX_RECOVERY_TIMELOCK_BLOCKS: u64;Source line: 43.
recovery::DEFAULT_RECOVERY_TIMELOCK_BLOCKS
Default recovery timelock (30 days). Recommended baseline; deviates from the agent-06 brief (7 days) per pushback C7.
pub const DEFAULT_RECOVERY_TIMELOCK_BLOCKS: u64;Source line: 47.
recovery::MAX_RECOVERY_GUARDIANS
Hard cap on guardian count per recovery group.
pub const MAX_RECOVERY_GUARDIANS: usize;Source line: 50.
recovery::MIN_RECOVERY_GUARDIANS
Minimum guardian count.
pub const MIN_RECOVERY_GUARDIANS: usize;Source line: 52.
recovery::RECOVERY_DOMAIN_TAG
Domain separator for canonical recovery-authorization signatures.
pub const RECOVERY_DOMAIN_TAG: &[u8];Source line: 55.
recovery::RecoveryGuardian
One member of a recovery group.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RecoveryGuardian {
pub guardian_did: String,
/// 32-byte Ed25519 public key, hex-encoded (no `0x` prefix).
pub guardian_pubkey_hex: String,
/// Vote weight. Default 1; weighted thresholds support tiered guardians
/// (e.g. 1 spouse weight 2 + 3 friends weight 1, threshold 3).
pub weight: u32
}Source line: 63.
recovery::RecoveryConfig
Per-DID recovery configuration. Single registration per subject DID; re-registration replaces the prior config.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RecoveryConfig {
pub subject_did: String,
pub guardians: Vec<RecoveryGuardian>,
/// Total weight required to authorize a recovery. Must be ≥ 1 and
/// ≤ sum(guardians.weight). Recommended floor: ⌈sum × 0.6⌉.
pub threshold: u32,
/// Number of blocks the timelock holds open after `InitiateRecovery`.
pub timelock_blocks: u64,
/// 32-byte Ed25519 public key (hex) of the panic-abort key. The user
/// holds the corresponding private key offline.
pub panic_pubkey_hex: String,
pub registered_at_height: u64
}Source line: 75.
recovery::RecoveryStatus
Status of a RecoveryCeremony.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum RecoveryStatus {
/// Initiated; collecting guardian authorizations and waiting for timelock.
Pending,
/// Threshold met AND timelock elapsed; ready to finalize.
Ready,
/// Pubkey has been rotated; ceremony archived.
Finalized,
/// Aborted by the panic key, the original owner, or by guardian
/// revocation. No further state changes.
Aborted { reason: AbortReason },
}Source line: 91.
recovery::AbortReason
Why a ceremony was aborted.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum AbortReason {
PanicKey,
OriginalOwner,
GuardianRevocation,
}Source line: 105.
recovery::GuardianAuthorization
One signed authorization from a guardian.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct GuardianAuthorization {
pub guardian_did: String,
pub guardian_pubkey_hex: String,
/// 64-byte Ed25519 signature over the canonical payload (hex).
pub signature_hex: String,
pub recorded_at_height: u64
}Source line: 113.
recovery::RecoveryCeremony
An open recovery ceremony.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RecoveryCeremony {
pub ceremony_id: String,
pub subject_did: String,
pub initiated_at_height: u64,
/// Earliest block at which `FinalizeRecovery` may succeed.
pub finalize_after_height: u64,
/// 32-byte Ed25519 public key (hex) that will replace the subject's
/// current pubkey on finalize.
pub new_pubkey_hex: String,
pub authorizations: Vec<GuardianAuthorization>,
pub status: RecoveryStatus
}Source line: 123.
recovery::RecoveryCeremony::accumulated_weight
Total accumulated guardian weight from authorizations, looking up
each guardian in config.guardians. Authorizations whose
guardian_did is not in the config contribute 0.
pub fn accumulated_weight(&self, config: &RecoveryConfig) -> u32;Source line: 140.
recovery::RecoveryCeremony::threshold_met
True if the threshold weight has been accumulated.
pub fn threshold_met(&self, config: &RecoveryConfig) -> bool;Source line: 154.
recovery::RecoveryCeremony::timelock_expired_at
True if the timelock has elapsed at the given block height.
pub fn timelock_expired_at(&self, current_height: u64) -> bool;Source line: 159.
recovery::RecoveryCeremony::finalizable_at
True if the ceremony is finalizable at current_height: status is
still Pending, threshold met, and timelock elapsed.
pub fn finalizable_at(&self, current_height: u64, config: &RecoveryConfig) -> bool;Source line: 165.
recovery::RegisterRecoveryData
Register or replace a recovery group for subject_did (the sender).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RegisterRecoveryData {
pub subject_did: String,
pub guardians: Vec<RecoveryGuardian>,
pub threshold: u32,
pub timelock_blocks: u64,
pub panic_pubkey_hex: String
}Source line: 178.
recovery::InitiateRecoveryData
Initiate a new recovery ceremony for subject_did.
The sender (gas payer) need NOT be the subject — typically the subject has lost their key and uses a fresh device. The new public key must be generated client-side and supplied here.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct InitiateRecoveryData {
pub subject_did: String,
pub new_pubkey_hex: String
}Source line: 192.
recovery::AddRecoveryAuthorizationData
Add one guardian's authorization to an open ceremony.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AddRecoveryAuthorizationData {
pub ceremony_id: String,
pub guardian_did: String,
pub guardian_pubkey_hex: String,
/// 64-byte Ed25519 signature over `recovery_signing_bytes(ceremony_id,
/// subject_did, new_pubkey_hex)`. Hex-encoded.
pub signature_hex: String
}Source line: 199.
recovery::AbortRecoveryData
Abort an open ceremony. The signature must come from EITHER the panic key or the subject's current (pre-rotation) pubkey.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AbortRecoveryData {
pub ceremony_id: String,
/// The Ed25519 public key that signed the abort. The executor checks
/// this matches either the registered panic key or the subject's
/// current pubkey.
pub aborter_pubkey_hex: String,
pub signature_hex: String
}Source line: 211.
recovery::FinalizeRecoveryData
Finalize a Ready ceremony — rotates the subject's on-chain pubkey.
Permissionless: any DID can pay gas to finalize.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FinalizeRecoveryData {
pub ceremony_id: String
}Source line: 224.
recovery::recovery_signing_bytes
Build the canonical payload that guardians sign for an authorization.
Format:
RECOVERY_DOMAIN_TAG || ceremony_id || '|' || subject_did || '|' || new_pubkey_hex
The 32-byte BLAKE3 of this payload is what the Ed25519 key actually signs. Including the new_pubkey_hex prevents an authorized signature from being replayed against a different new_pubkey.
pub fn recovery_signing_bytes(
ceremony_id: &str,
subject_did: &str,
new_pubkey_hex: &str,
) -> Vec<u8>;Source line: 240.
recovery::abort_signing_bytes
Build the abort signing payload. Aborters sign over a different canonical message than guardians so an authorization can never be replayed as an abort or vice-versa.
pub fn abort_signing_bytes(ceremony_id: &str) -> Vec<u8>;Source line: 265.
recovery::compute_ceremony_id
Compute the deterministic ceremony_id for (subject_did, initiated_at_height).
Returns a 32-character hex string (16 bytes of BLAKE3 output). Two ceremonies for the same subject MUST land at different block heights; the per-block tx ordering enforces this in practice.
pub fn compute_ceremony_id(subject_did: &str, initiated_at_height: u64) -> String;Source line: 280.
recovery::validate_recovery_config
Validate a RecoveryConfig's structural invariants before commit.
Used both at RegisterRecovery time and as a defensive check before
any state mutation. Returns Ok(()) if valid; otherwise Err.
pub fn validate_recovery_config(config: &RecoveryConfig) -> Result<(), CoreError>;Source line: 296.