typesec_integrations/did/
error.rs1#[derive(Debug, thiserror::Error)]
5pub enum DidError {
6 #[error("invalid DID: {0}")]
8 InvalidDid(String),
9 #[error("unresolved DID: {0}")]
11 Unresolved(String),
12 #[error("missing private key for DID: {0}")]
14 MissingPrivateKey(String),
15 #[error("DID document has no authentication key")]
17 MissingAuthentication,
18 #[error("DID document has no key agreement key")]
20 MissingKeyAgreement,
21 #[error("missing verification method: {0}")]
23 MissingVerificationMethod(String),
24 #[error("missing key version {version} for DID {did}")]
26 MissingKeyVersion {
27 did: String,
29 version: u64,
31 },
32 #[error("cannot retire active key version {version} for DID {did}")]
34 CannotRetireActiveKey {
35 did: String,
37 version: u64,
39 },
40 #[error("retired verification method: {0}")]
42 RetiredKey(String),
43 #[error("invalid DID envelope signature")]
45 InvalidSignature,
46 #[error("DID envelope was not addressed to {0}")]
48 WrongRecipient(String),
49 #[error("DID envelope has expired")]
51 Expired,
52 #[error("DID envelope is not yet valid (created {created}, now {now})")]
54 NotYetValid {
55 created: u64,
57 now: u64,
59 },
60 #[error("DID envelope replay detected for message {0}")]
62 Replayed(String),
63 #[error("DID payload too large: {size} bytes exceeds limit of {max}")]
65 PayloadTooLarge {
66 size: usize,
68 max: usize,
70 },
71 #[error("invalid key material: {0}")]
73 InvalidKey(String),
74 #[error("invalid nonce: expected 12 bytes")]
76 InvalidNonce,
77 #[error("DID payload encryption failed")]
79 EncryptionFailed,
80 #[error("DID payload decryption failed")]
82 DecryptionFailed,
83 #[error("key generation failed: {0}")]
85 KeyGen(String),
86 #[error("capability does not cover this payload: {0}")]
88 Capability(#[from] typesec_core::secure_value::SecureAccessError),
89 #[error("invalid hex encoding")]
91 InvalidHex,
92 #[error("decrypted DID payload is not valid UTF-8")]
94 InvalidUtf8,
95 #[error("DID HTTP integration failed: {0}")]
97 Http(Box<dyn std::error::Error + Send + Sync>),
98 #[error("Ollama response did not contain message.content")]
100 MissingOllamaReply,
101 #[error("DID envelope is missing TypeDID metadata")]
103 MissingTypeDidMetadata,
104 #[error("no compatible TypeDID profile")]
106 NoCompatibleTypeDidProfile,
107}