Thoryn

Policy rules · Policy rules

Age-over-18 gate

A single derived-claim equality — the simplest possible Policy Engine rule. Use it for any flow that needs proof of majority without ever seeing the birth date.

Tested against:policyEngine: 1.0.0

policy-engine recipe — shared category architecture: how this pattern composes with Hub, Broker, and the rest of the catalog

Use case

You operate an age-restricted online service (alcohol, nicotine, gambling) and a regulator wants proof you're verifying — not just asking. The wallet's derived age_over_18 claim is exactly that: a true/false produced by the wallet without disclosing the holder's date of birth.

This rule says ALLOW iff age_over_18 is true. One leaf, one boolean, one decision.

Rule

{
  "fact": "age_over_18",
  "operator": "equal",
  "value": true
}

Facts shape

data class AgeFacts(val age_over_18: Boolean)

Evaluation

val facts = AgeFacts(age_over_18 = vpClaims["age_over_18"] as Boolean)
val decision = policyEngine.evaluate(rule, facts.toMap())

Trace — ALLOW

{
  "decision": "ALLOW",
  "trace": [
    { "fact": "age_over_18", "operator": "equal", "value": true, "result": "pass" }
  ]
}

When to use

  • Strict age-gating where birth date must not leave the wallet
  • A regulator-facing audit log needs proof of verification, not derivation

When not to use

  • You actually need the birth date itself (e.g. for fraud-vector checks). Use a different presentation definition that discloses birthdate rather than the derived claim.

See also