Skip to main content

ActError

Enum ActError 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TooLarge

The encoded token exceeded crate::MAX_ACT_BYTES.

Checked before any parsing, so a hostile payload cannot force unbounded allocation.

Fields

§actual: usize

Size of the rejected input.

§limit: usize

The configured ceiling.

§

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.

Fields

§found: u64

Version declared by the envelope.

§supported: u64

Version this build implements.

§

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.

Fields

§index: usize

Position in the supplied key set.

§reason: String

Underlying reason.

§

NoTrustedKeys

No trusted keys were supplied, so no token could ever verify.

§

SignatureInvalid

The signature did not validate against any trusted key.

Fields

§tried: usize

Number of keys attempted.

§

Expired

exp is at or before the current time.

Fields

§expired_at: i64

The exp claim.

§now: i64

Time used for the comparison.

§

NotYetValid

nbf is after the current time.

Fields

§valid_from: i64

The nbf claim.

§now: i64

Time used for the comparison.

§

IssuerMismatch

iss did not match the expected issuer.

Fields

§expected: String

Issuer the verifier requires.

§found: String

Issuer the token carries.

§

AudienceMismatch

aud did not include the expected audience.

Fields

§expected: String

Audience the verifier requires.

§found: Vec<String>

Audiences the token carries.

§

MissingScope(String)

A required scope was absent from scope.

§

MalformedScope

A scope did not match the service:resource:action grammar.

Fields

§value: String

The offending scope string.

§reason: &'static str

Why it was rejected.

§

EmptyClaim(&'static str)

A structurally required claim was empty.

§

EmptyValidityWindow

exp was not after nbf, so the token has no valid window.

Fields

§nbf: i64

The nbf claim.

§exp: i64

The exp claim.

§

Encode(String)

Serializing claims or an envelope failed.

Trait Implementations§

Source§

impl Debug for ActError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ActError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ActError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.