Public declaration syntax from forge-rs/crates/forge-identity/src/error.rs Original source SHA-256: 61fd83dc1e7edbeb21cd24433915ca3d33a8c6199df7a52e99a673a59dff2e5b Function bodies and constant values are omitted. This is not the complete implementation. Source line 44 #[derive(Debug, Error)] pub enum ForgeIdentityError { /// HKDF key derivation failed for the specified derivation path. /// /// This indicates a failure in the cryptographic key derivation process /// when creating a child agent identity from a parent. /// /// See ANVIL Spec §11.1 — OAS Identity Binding. #[error("identity derivation failed for path '{path}' from parent {parent_did}: {reason}")] DerivationFailed { /// The parent's DID from which derivation was attempted. parent_did: String, /// The HKDF derivation path that was used. path: String, /// A description of why the derivation failed. reason: String, }, /// Lineage chain verification failed for the specified identity. /// /// The cryptographic chain from the agent to its human root could not /// be verified. This may indicate a tampered identity, a missing parent /// document, or an invalid proof signature. /// /// See ANVIL Spec §11.2 — Lineage Propagation. #[error("lineage verification failed for '{did}': {reason}")] LineageVerificationFailed { /// The DID of the identity whose lineage failed verification. did: String, /// A description of why verification failed. reason: String, }, /// Lineage chain exceeds the maximum allowed generation depth. /// /// ANVIL Spec §11.2 defines a maximum lineage depth to prevent /// unbounded delegation chains. The default maximum is 16. #[error("lineage chain depth {depth} exceeds ANVIL maximum {max_depth} (ANVIL Spec §11.2)")] ChainTooDeep { /// The actual depth of the lineage chain. depth: u32, /// The configured maximum depth. max_depth: u32, }, /// The identity is malformed or fails structural validation. /// /// This covers cases like missing DID fields, invalid document structure, /// or inconsistent lineage sections. #[error("invalid identity: {reason}")] InvalidIdentity { /// A description of the structural problem. reason: String, }, /// Saving or loading an identity to/from persistent storage failed. /// /// This may indicate I/O errors, permission problems, or corrupted /// identity files on disk. #[error("identity persistence failed: {reason}")] PersistenceFailed { /// A description of the persistence failure. reason: String, }, /// An error propagated from the underlying OAS SDK. /// /// This wraps [`oas_sdk::OasError`] for seamless `?` propagation /// from OAS SDK calls within forge-identity functions. #[error("OAS SDK error: {0}")] Oas(#[from] oas_sdk::OasError), } Source line 127 pub type ForgeIdentityResult = Result;