Thoryn

Rules, programmable

Use cases

Five scenarios, each with a copy-pasteable sample rule.

Five scenarios, each with a copy-pasteable sample rule. Every rule is a JSON tree — safe to version in git, review as code, deploy without redeployment.

Five Policy Engine scenarios at a glance — age-over verification, multi-credential issuer, revocation policy, consent-required gate, composite rule
The five named rule patterns with sample JSON shapes — copy-paste ready, evaluated in around a millisecond per call.
1

Age-over verification

Simplest rule — a single attestation. The wallet computes the derived claim; the engine checks it. No birth date ever leaves the wallet.

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

Multi-credential issuer requirement

Requires both a diploma credential from an accredited institution AND an employment credential from an authorised employer.

{
  "all": [
    { "fact": "diploma_issuer", "operator": "in", "value": ["TU Delft", "UvA", "VU"] },
    { "fact": "employment_issuer", "operator": "in", "value": ["Thoryn", "ExampleCorp"] }
  ]
}
3

Revocation policy

Not just 'is this credential valid' — 'is this credential active AND in-date today'. The $today macro is substituted at evaluation time.

{
  "all": [
    { "fact": "credential_status", "operator": "equal", "value": "active" },
    { "fact": "valid_until", "operator": "greaterThan", "value": "$today" }
  ]
}
4

Consent-required gate

Credential must assert age-over-18 AND the user must have explicitly consented during the session (a non-credential fact injected by the caller).

{
  "all": [
    { "fact": "age_over_18", "operator": "equal", "value": true },
    { "fact": "consent_flag", "operator": "equal", "value": "granted" }
  ]
}
5

Composite rule

Either admin role OR (manager role AND finance department). Demonstrates arbitrary nesting of logical operators.

{
  "any": [
    { "fact": "role", "operator": "equal", "value": "admin" },
    { "all": [
        { "fact": "role", "operator": "equal", "value": "manager" },
        { "fact": "department", "operator": "equal", "value": "finance" }
      ]
    }
  ]
}

Ready to turn policy into code?

Request access to see the library, the rule schema, and the evaluation fixtures.