Skip to main content

kanoniv_agent_auth/
error.rs

1//! Error types for cryptographic operations.
2
3/// Errors from cryptographic operations.
4#[derive(Debug, thiserror::Error)]
5pub enum CryptoError {
6    #[error("Invalid public key length: expected 32, got {0}")]
7    InvalidKeyLength(usize),
8
9    #[error("Invalid public key")]
10    InvalidPublicKey,
11
12    #[error("Signature verification failed")]
13    SignatureInvalid,
14
15    #[error("Invalid signature encoding: {0}")]
16    InvalidSignatureEncoding(String),
17
18    #[error("Serialization error: {0}")]
19    SerializationError(String),
20
21    #[error("Integrity check failed: outer field '{0}' does not match signed payload")]
22    IntegrityMismatch(String),
23
24    #[error("Delegation chain broken: {0}")]
25    DelegationChainBroken(String),
26
27    #[error("Caveat violation: {0}")]
28    CaveatViolation(String),
29
30    #[error("Delegation revoked: {0}")]
31    DelegationRevoked(String),
32}