pub enum InvalidationReason {
Expired {
vendor: VendorId,
challenge_class: ChallengeClass,
age_secs: u64,
ttl_secs: u64,
},
NonceMismatch {
vendor: VendorId,
challenge_class: ChallengeClass,
expected: String,
observed: String,
},
NonceReplayed {
vendor: VendorId,
challenge_class: ChallengeClass,
observation_count: u32,
},
SessionBindingMiss {
vendor: VendorId,
challenge_class: ChallengeClass,
expected: Option<String>,
observed: Option<String>,
},
ContractMissing {
vendor: VendorId,
challenge_class: ChallengeClass,
},
NotApplicable {
vendor: VendorId,
challenge_class: ChallengeClass,
},
}Expand description
Structured reason a TokenValidator
rejected a token submission.
Every variant carries the vendor family and
challenge class so the diagnostic payload can route the
invalidation to the per-family audit log without inspecting
the rest of the report. The kind tag is the routing key
(see InvalidationKind); the variant embeds the
diagnostic context (expected vs. observed values, age,
observation count, etc.).
§Example
use stygian_charon::token_lifecycle::{ChallengeClass, InvalidationKind, InvalidationReason};
use stygian_charon::vendor_classifier::VendorId;
let reason = InvalidationReason::Expired {
vendor: VendorId::Cloudflare,
challenge_class: ChallengeClass::Interstitial,
age_secs: 1900,
ttl_secs: 1800,
};
assert_eq!(reason.kind(), InvalidationKind::Expired);
assert_eq!(reason.vendor_family(), VendorId::Cloudflare);Variants§
Expired
Token TTL elapsed before submission.
Fields
challenge_class: ChallengeClassChallenge class the token is bound to.
NonceMismatch
Submission’s nonce does not match the contract’s nonce.
Fields
challenge_class: ChallengeClassChallenge class the contract is bound to.
NonceReplayed
A single-use nonce was observed more than once.
Fields
challenge_class: ChallengeClassChallenge class the contract is bound to.
SessionBindingMiss
Submission’s session id does not match the contract’s
bound_session.
Fields
challenge_class: ChallengeClassChallenge class the contract is bound to.
ContractMissing
No contract was supplied alongside the token.
Fields
vendor: VendorIdVendor family the token was nominally issued for (when the caller had partial evidence).
challenge_class: ChallengeClassChallenge class the token was nominally bound to.
NotApplicable
The token’s challenge class is not applicable for the supplied vendor family.
Fields
challenge_class: ChallengeClassChallenge class the contract claimed to cover.
Implementations§
Source§impl InvalidationReason
impl InvalidationReason
Sourcepub const fn kind(&self) -> InvalidationKind
pub const fn kind(&self) -> InvalidationKind
Routing kind for this invalidation.
§Example
use stygian_charon::token_lifecycle::{ChallengeClass, InvalidationKind, InvalidationReason};
use stygian_charon::vendor_classifier::VendorId;
let reason = InvalidationReason::NonceReplayed {
vendor: VendorId::Akamai,
challenge_class: ChallengeClass::ProofOfWork,
observation_count: 2,
};
assert_eq!(reason.kind(), InvalidationKind::NonceReplayed);Sourcepub const fn vendor_family(&self) -> VendorId
pub const fn vendor_family(&self) -> VendorId
Vendor family the invalidation is attributed to.
§Example
use stygian_charon::token_lifecycle::{ChallengeClass, InvalidationReason};
use stygian_charon::vendor_classifier::VendorId;
let reason = InvalidationReason::NonceMismatch {
vendor: VendorId::PerimeterX,
challenge_class: ChallengeClass::IntegrityCheck,
expected: "n".to_string(),
observed: "m".to_string(),
};
assert_eq!(reason.vendor_family(), VendorId::PerimeterX);Sourcepub const fn challenge_class(&self) -> ChallengeClass
pub const fn challenge_class(&self) -> ChallengeClass
Challenge class the invalidation is attributed to.
§Example
use stygian_charon::token_lifecycle::{ChallengeClass, InvalidationReason};
use stygian_charon::vendor_classifier::VendorId;
let reason = InvalidationReason::SessionBindingMiss {
vendor: VendorId::DataDome,
challenge_class: ChallengeClass::Captcha,
expected: Some("s1".to_string()),
observed: Some("s2".to_string()),
};
assert_eq!(reason.challenge_class(), ChallengeClass::Captcha);Sourcepub const fn label(&self) -> &'static str
pub const fn label(&self) -> &'static str
Stable wire label — equivalent to
kind().label(). Useful for
the JSON field that the diagnostic payload exposes.
§Example
use stygian_charon::token_lifecycle::{ChallengeClass, InvalidationReason};
use stygian_charon::vendor_classifier::VendorId;
let reason = InvalidationReason::ContractMissing {
vendor: VendorId::Unknown,
challenge_class: ChallengeClass::Unknown,
};
assert_eq!(reason.label(), "contract_missing");Trait Implementations§
Source§impl Clone for InvalidationReason
impl Clone for InvalidationReason
Source§fn clone(&self) -> InvalidationReason
fn clone(&self) -> InvalidationReason
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InvalidationReason
impl Debug for InvalidationReason
Source§impl<'de> Deserialize<'de> for InvalidationReason
impl<'de> Deserialize<'de> for InvalidationReason
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for InvalidationReason
impl PartialEq for InvalidationReason
Source§impl Serialize for InvalidationReason
impl Serialize for InvalidationReason
impl Eq for InvalidationReason
impl StructuralPartialEq for InvalidationReason
Auto Trait Implementations§
impl Freeze for InvalidationReason
impl RefUnwindSafe for InvalidationReason
impl Send for InvalidationReason
impl Sync for InvalidationReason
impl Unpin for InvalidationReason
impl UnsafeUnpin for InvalidationReason
impl UnwindSafe for InvalidationReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.