pub fn memory_adjustment_for(memory: &ChallengeMemory, key: &EngineKey) -> f64Expand description
Compute the risk-score adjustment a ChallengeMemory would
apply for an EngineKey, using the
ChallengeFeedbackPolicy::default clamp.
Returns 0.0 when the memory has no entry for the key (the
common case on first contact with a new target).
ยงExample
use stygian_charon::challenge_feedback::{
memory_adjustment_for, ChallengeMemory, ChallengeOutcome, EngineKey,
};
use stygian_charon::types::TargetClass;
use stygian_charon::vendor_classifier::VendorId;
let memory = ChallengeMemory::with_defaults();
let key = EngineKey {
engine: VendorId::Cloudflare,
version: None,
target_class: TargetClass::ContentSite,
tls_profile: None,
};
memory.record(&key, None, ChallengeOutcome::Captcha);
let delta = memory_adjustment_for(&memory, &key);
assert!(delta > 0.0);