pub struct Requirement {
pub provider: String,
pub scope: String,
pub allowed_subjects: Vec<String>,
pub max_proof_age_seconds: u64,
pub loa: u8,
}Expand description
A single requirement attached to a rule. Authored in YAML as the
identity: block under a rule; compiled into this struct once at
rule-load time and reused on every match.
Fields§
§provider: Stringid of the provider in identity.yaml to invoke. Must resolve
to a known ProviderConfig.
scope: StringLogical scope name (free-form). Doubles as the cache partition
key, so a proof for scm.commit_to_main does not satisfy a
rule asking for db.production_apply.
allowed_subjects: Vec<String>Set of subjects allowed to satisfy this gate. Each entry is
matched against VerifiedIdentity::subject AND
VerifiedIdentity::email; ANY hit passes.
Accepted forms:
- Email –
[email protected] - Subject –
idme|550e8400-e29b-41d4-a716-446655440000 - Wildcard –
*(any user verifying is enough; useful for single-operator laptops)
max_proof_age_seconds: u64Maximum acceptable age (seconds) for a cached proof. Older proofs are ignored and the user is re-prompted.
loa: u8Required ID.me level-of-assurance (0/1/2/3). A proof issued at a lower LOA does not satisfy the gate.
Implementations§
Source§impl Requirement
impl Requirement
Sourcepub fn allows(&self, vi: &VerifiedIdentity) -> bool
pub fn allows(&self, vi: &VerifiedIdentity) -> bool
Does this allow-list include the given identity?
Sourcepub fn is_satisfied_by(&self, proof: &Proof, now_secs: u64) -> bool
pub fn is_satisfied_by(&self, proof: &Proof, now_secs: u64) -> bool
True if the given (already-decoded, signature-verified) proof satisfies all of: provider, scope, allow-list, LOA, freshness.
Trait Implementations§
Source§impl Clone for Requirement
impl Clone for Requirement
Source§fn clone(&self) -> Requirement
fn clone(&self) -> Requirement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more