#[non_exhaustive]pub enum ActError {
Show 19 variants
TooLarge {
actual: usize,
limit: usize,
},
EnvelopeDecode(String),
ClaimsDecode(String),
UnsupportedVersion {
found: u64,
supported: u64,
},
UnsupportedAlgorithm(String),
MissingSignature,
MalformedSignature(usize),
MalformedTrustedKey {
index: usize,
reason: String,
},
NoTrustedKeys,
SignatureInvalid {
tried: usize,
},
Expired {
expired_at: i64,
now: i64,
},
NotYetValid {
valid_from: i64,
now: i64,
},
IssuerMismatch {
expected: String,
found: String,
},
AudienceMismatch {
expected: String,
found: Vec<String>,
},
MissingScope(String),
MalformedScope {
value: String,
reason: &'static str,
},
EmptyClaim(&'static str),
EmptyValidityWindow {
nbf: i64,
exp: i64,
},
Encode(String),
}Expand description
Failures encountered while decoding or verifying an ACT.
Variants are deliberately specific so callers can distinguish an expired token from a forged one in logs and metrics. A verifier that collapses these into a single “invalid token” outcome loses the ability to alarm on forgery while staying quiet about ordinary expiry.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TooLarge
The encoded token exceeded crate::MAX_ACT_BYTES.
Checked before any parsing, so a hostile payload cannot force unbounded allocation.
EnvelopeDecode(String)
The outer envelope was not well-formed CBOR, or did not match the envelope schema.
ClaimsDecode(String)
The claims payload inside the envelope was not well-formed CBOR, or did not match the claims schema.
UnsupportedVersion
The envelope declared a format version this build does not implement.
Carried explicitly so a rollout can distinguish “forged” from “newer than me”, which are operationally opposite situations.
UnsupportedAlgorithm(String)
The envelope declared a signature algorithm this build does not implement.
MissingSignature
The signature field was absent.
MalformedSignature(usize)
The signature was present but not 64 bytes.
MalformedTrustedKey
A configured trusted key was not a valid Ed25519 public key.
Distinguished from a verification failure because it is a misconfiguration on the verifier’s side, not a problem with the token.
NoTrustedKeys
No trusted keys were supplied, so no token could ever verify.
SignatureInvalid
The signature did not validate against any trusted key.
Expired
exp is at or before the current time.
NotYetValid
nbf is after the current time.
IssuerMismatch
iss did not match the expected issuer.
AudienceMismatch
aud did not include the expected audience.
Fields
MissingScope(String)
A required scope was absent from scope.
MalformedScope
A scope did not match the service:resource:action grammar.
EmptyClaim(&'static str)
A structurally required claim was empty.
EmptyValidityWindow
exp was not after nbf, so the token has no valid window.
Encode(String)
Serializing claims or an envelope failed.
Trait Implementations§
Source§impl Error for ActError
impl Error for ActError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()