Skip to main content

VerifyError

Enum VerifyError 

Source
pub enum VerifyError {
Show 21 variants InvalidJwsShape(usize), Base64Decode { segment: &'static str, source: DecodeError, }, InvalidJwsHeader, PayloadJson(Error), AudienceMismatch { expected: String, actual: String, }, NonceMismatch, Expired { exp: u64, now: u64, }, NotYetValid { iat: u64, now: u64, max_skew_secs: u64, }, MalformedDid { did: String, }, MalformedVmPubkey { vm_id: String, }, SignatureWrongLength { actual: usize, }, SignatureInvalidScalars, GenesisSignatureInvalid, ChainSignerNotInPriorRoster { entry_version: u64, signer_kid: String, }, ChainSignatureInvalid { entry_version: u64, }, ChainVersionNotMonotonic { entry_version: u64, prior_version: u64, }, CurrentVmNotInHeadRoster { vm_id: String, }, JwtSignatureInvalid, RollbackDetected { current: u64, last_seen: u64, }, ForkDetected { version: u64, }, ChainEntryDidMismatch { entry_version: u64, entry_did: String, },
}
Expand description

The single error type returned by crate::verify_mid_response.

Variants§

§

InvalidJwsShape(usize)

The JWT string did not have exactly 3 dot-separated segments.

§

Base64Decode

One of the base64url segments failed to decode.

Fields

§segment: &'static str

Which segment failed: “header”, “payload”, or “signature”.

§source: DecodeError

The underlying base64 error.

§

InvalidJwsHeader

The JWS header was not valid JSON or did not declare alg: ES256.

§

PayloadJson(Error)

The JWT payload JSON was not parseable into a mid_issuer::MidJwtPayload.

§

AudienceMismatch

The aud claim did not match the verifier’s expected audience.

Fields

§expected: String

What the RP configured.

§actual: String

What the JWT carried.

§

NonceMismatch

The nonce claim did not match the nonce the RP issued for this session — possible replay attempt or stale tab.

§

Expired

The JWT’s exp is in the past relative to the verifier’s clock.

Fields

§exp: u64

JWT’s expiry claim.

§now: u64

Verifier’s wall clock.

§

NotYetValid

The JWT’s iat is too far in the future for the verifier’s clock skew tolerance — possible attacker producing forward-dated tokens or genuine clock skew.

Fields

§iat: u64

JWT’s issued-at claim.

§now: u64

Verifier’s wall clock.

§max_skew_secs: u64

Verifier’s configured skew tolerance.

§

MalformedDid

The DID’s base58 suffix did not decode to a valid P-256 public key. Either the DID is malformed or it’s from a non-mID identity system.

Fields

§did: String

The DID that failed to decode.

§

MalformedVmPubkey

A verification method’s publicKeyMultibase did not decode to a valid P-256 public key.

Fields

§vm_id: String

The VM ID whose pubkey failed to decode.

§

SignatureWrongLength

A base64url-encoded signature was not 64 bytes (the expected r || s form for ES256).

Fields

§actual: usize

The length actually decoded.

§

SignatureInvalidScalars

The signature was 64 bytes but r/s are not valid P-256 scalars (zero, >= curve order). Often means the wallet returned a placeholder all-zero signature (vault locked / sign failed).

§

GenesisSignatureInvalid

The genesis roster’s self-signature did not verify against the key recoverable from the DID. Either the genesis roster was tampered with or the signature is from a different key — the user does not hold the genesis key.

§

ChainSignerNotInPriorRoster

A roster chain entry was signed by a verification method that is not present in the prior entry’s roster — the chain is broken.

Fields

§entry_version: u64

The version of the chain entry whose signer is unknown.

§signer_kid: String

The signer_kid that doesn’t appear in the prior roster.

§

ChainSignatureInvalid

A roster chain entry’s signature did not verify against the claimed signer’s public key. Either the entry was tampered with or the signature is from a different key.

Fields

§entry_version: u64

The chain entry version that failed signature verification.

§

ChainVersionNotMonotonic

Chain versions did not strictly increase. Indicates a stolen device trying to bundle an older roster envelope as the head, or a malformed chain.

Fields

§entry_version: u64

The non-monotonic entry’s version.

§prior_version: u64

The prior entry’s version (must be < entry_version).

§

CurrentVmNotInHeadRoster

The verification method that signed the JWT is not present in the head roster — the signing device has been revoked.

Fields

§vm_id: String

The VM ID that’s not in the head roster.

§

JwtSignatureInvalid

The JWS outer signature did not verify against the embedded verification method’s public key.

§

RollbackDetected

The current roster version is less than the highest the RP has seen for this DID — possible stolen-device replay of an old (pre-revocation) roster envelope.

This variant is NEVER produced by crate::verify_mid_response directly; the RP uses crate::VerifiedMid::check_rollback after looking up last_seen_version from its own per-DID store.

Fields

§current: u64

The current head roster version from the verified JWT.

§last_seen: u64

The highest version this RP has seen for this DID.

§

ForkDetected

The token’s roster history does not contain the exact roster the RP saw last at version: another history was branched off an older roster. Returned by crate::VerifiedMid::check_continuity. A device removed at some version, but listed in an earlier one, can sign its own later versions from that earlier roster; only the content of the version the RP already saw tells the two histories apart.

Fields

§version: u64

The version the RP recorded, whose roster this token does not carry.

§

ChainEntryDidMismatch

A roster chain entry names a different DID than the token’s issuer.

Fields

§entry_version: u64

The entry’s version.

§entry_did: String

The DID the entry names.

Trait Implementations§

Source§

impl Debug for VerifyError

Source§

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

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

impl Display for VerifyError

Source§

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

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

impl Error for VerifyError

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<Error> for VerifyError

Source§

fn from(source: Error) -> 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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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> 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.
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