agentic_identity/
error.rs1#[derive(Debug, thiserror::Error)]
8pub enum IdentityError {
9 #[error("Invalid key: {0}")]
10 InvalidKey(String),
11
12 #[error("Signature verification failed")]
13 SignatureInvalid,
14
15 #[error("Identity not found: {0}")]
16 NotFound(String),
17
18 #[error("Key derivation failed: {0}")]
19 DerivationFailed(String),
20
21 #[error("Encryption failed: {0}")]
22 EncryptionFailed(String),
23
24 #[error("Decryption failed: {0}")]
25 DecryptionFailed(String),
26
27 #[error("Invalid passphrase")]
28 InvalidPassphrase,
29
30 #[error("Trust not granted for capability: {0}")]
31 TrustNotGranted(String),
32
33 #[error("Trust has been revoked: {0}")]
34 TrustRevoked(String),
35
36 #[error("Trust expired")]
37 TrustExpired,
38
39 #[error("Trust not yet valid")]
40 TrustNotYetValid,
41
42 #[error("Max uses exceeded")]
43 MaxUsesExceeded,
44
45 #[error("Delegation not allowed")]
46 DelegationNotAllowed,
47
48 #[error("Delegation depth exceeded")]
49 DelegationDepthExceeded,
50
51 #[error("Invalid receipt chain")]
52 InvalidChain,
53
54 #[error("Storage error: {0}")]
55 StorageError(String),
56
57 #[error("Serialization error: {0}")]
58 SerializationError(String),
59
60 #[error("Invalid file format: {0}")]
61 InvalidFileFormat(String),
62
63 #[error("IO error: {0}")]
64 Io(#[from] std::io::Error),
65
66 #[error("Competence not met for {domain}: required {required_rate}%, actual {actual_rate}%")]
67 CompetenceNotMet {
68 domain: String,
69 required_rate: f32,
70 actual_rate: f32,
71 },
72
73 #[error("Insufficient attempts: required {required}, actual {actual}")]
74 InsufficientAttempts { required: u64, actual: u64 },
75
76 #[error("Competence proof expired")]
77 CompetenceProofExpired,
78
79 #[error("Cannot prove impossibility: identity CAN do {capability}")]
80 NotImpossible { capability: String },
81
82 #[error("Invalid negative proof: {reason}")]
83 InvalidNegativeProof { reason: String },
84
85 #[error("Permanent declaration cannot be revoked")]
86 PermanentDeclaration,
87}
88
89pub type Result<T> = std::result::Result<T, IdentityError>;