pub enum Error {
Show 17 variants
CborEncoding,
CborDecoding,
Base64Decoding,
Io,
KeyNotFound(String),
InvalidIssuer {
expected: String,
actual: String,
},
TokenExpired,
TokenNotActive,
InvalidAudience,
MacFailed,
TagMismatch,
ExpectedCwtTag,
UnsupportedValidationType,
MissingMacOptions,
UnableToParseToken,
InvalidClaimType,
InvalidJson,
}Expand description
Error types for the Common Access Token (CAT) library.
This enum represents all possible errors that can occur during token generation, parsing, and validation.
Variants§
CborEncoding
Error during CBOR encoding.
CborDecoding
Error during CBOR decoding.
Base64Decoding
Error when decoding Base64 data.
Io
I/O error.
KeyNotFound(String)
Specified key ID was not found in the key store.
InvalidIssuer
Token issuer does not match the expected value.
TokenExpired
Token has expired (current time is past the exp claim).
TokenNotActive
Token is not yet active (current time is before the nbf claim).
InvalidAudience
Token audience does not match any of the expected audiences.
MacFailed
Failed to create MAC for token.
TagMismatch
MAC tag verification failed.
ExpectedCwtTag
CWT tag was expected but not found in the token.
UnsupportedValidationType
The requested validation type is not supported.
MissingMacOptions
Required options for MAC validation are missing.
UnableToParseToken
Token could not be parsed correctly.
InvalidClaimType
A claim has an invalid data type.
InvalidJson
JSON format is invalid.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_validation_error(&self) -> bool
pub fn is_validation_error(&self) -> bool
Returns true if the error indicates a validation failure rather than a structural or parsing error. Validation failures include expired tokens, invalid issuers, etc.
Sourcepub fn is_structural_error(&self) -> bool
pub fn is_structural_error(&self) -> bool
Returns true if the error indicates a structural or format error rather than a validation error. These include encoding/decoding errors, missing keys, etc.