Skip to main content

AuthError

Enum AuthError 

Source
pub enum AuthError {
Show 13 variants Forbidden, DidMethodRejected, PendingChallengeLimitReached, SessionNotFound, SessionStateMismatch, ChallengeMismatch, ChallengeExpired, SignerMismatch, StaleMessage, RefreshTokenInvalid, RefreshTokenExpired, AttestationFailed(String), Internal(String),
}
Expand description

Auth-specific failures the canonical handlers can raise.

Each backend’s Error associated type must implement From<AuthError> so the handler can return these variants and the route layer surfaces them via its existing IntoResponse plumbing (e.g. vti-common’s AppError::Unauthorized(_) arm).

Variants§

§

Forbidden

DID is not in the backend’s ACL, or the ACL entry is expired. Returned as 403 Forbidden to avoid revealing whether the DID exists in the ACL system at all (timing-side-channel mitigation; the ACL check happens before any other gate).

§

DidMethodRejected

The DID’s method (e.g. did:foo:...) is not in the backend’s allowlist. Distinct from Forbidden so audit logs can distinguish “wrong method” from “not in ACL”. Surfaced to callers as a generic 403 to avoid leaking the allowlist contents.

§

PendingChallengeLimitReached

Too many concurrent ChallengeSent sessions for this DID; the per-DID rate limit (default 10) is exhausted. Returned as 429 Too Many Requests so clients can back off.

§

SessionNotFound

The session referenced by the request does not exist or has expired (TTL swept it). Returned as 401 Unauthorized; the holder must restart the challenge flow.

§

SessionStateMismatch

The session exists but was already authenticated (replay) or is otherwise not in the state the request expected. Returned as 401 Unauthorized; the holder must restart.

§

ChallengeMismatch

The presented challenge does not match what was issued for this session. Constant-time compared. Returned as 401 Unauthorized.

§

ChallengeExpired

The challenge is older than the backend’s configured TTL. Returned as 401 Unauthorized; the holder must request a fresh challenge.

§

SignerMismatch

The signer DID extracted from the transport (DIDComm from, SIOPv2 iss) does not match the DID the session was issued to. Critical binding — without this check, any leaked challenge could be redeemed by any signer. Returned as 401 Unauthorized.

§

StaleMessage

The DIDComm envelope’s created_time is outside the freshness window. Replay defense for the DIDComm transport. Returned as 401 Unauthorized.

§

RefreshTokenInvalid

The refresh token was not found or already consumed. Atomic claim semantics: at most one caller succeeds per token. Returned as 401 Unauthorized; the holder must re-authenticate.

§

RefreshTokenExpired

The refresh token’s absolute expiry has passed. Returned as 401 Unauthorized; the holder must re-authenticate.

§

AttestationFailed(String)

TEE attestation failed in a TeeMode::Required deployment. Returned as 503 Service Unavailable (the operator’s TEE is broken; the caller did nothing wrong).

§

Internal(String)

Surface for any wrapped error from the backend’s policy or storage layer that doesn’t fit the variants above. The canonical handler does not introspect this; it surfaces unchanged via the backend’s Error::from(AuthError::Internal).

Trait Implementations§

Source§

impl Debug for AuthError

Source§

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

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

impl Display for AuthError

Source§

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

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

impl Error for AuthError

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
Source§

impl From<AuthError> for AppError

Convert the canonical auth-flow errors into AppError so the route layer’s existing IntoResponse plumbing renders them without backend-specific glue. Each variant lands on the HTTP status reflected in the crate::auth::AuthError doc-comments:

  • Forbidden, DidMethodRejected → 403
  • PendingChallengeLimitReached → 429 via the Validation arm (route layer can return a typed 429 if needed; the canonical variant carries the rate-limit signal in the message).
  • SessionNotFound, SessionStateMismatch, ChallengeMismatch, ChallengeExpired, SignerMismatch, StaleMessage, RefreshTokenInvalid, RefreshTokenExpired → 401
  • AttestationFailed → 503 via Internal (TEE outages are not the caller’s fault).
  • Internal → 500.
Source§

fn from(e: AuthError) -> Self

Converts to this type from the input type.

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> At for T

Source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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<T> BorrowStripped for T

Source§

fn stripped(&self) -> &Stripped<T>

Source§

impl<T> BorrowUnordered for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ResourceProvider<()> for T

Source§

fn get_resource(&self) -> &()

Returns a reference to the resource of type T.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T

Source§

type Owned = T

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

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.
Source§

impl<T, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more