Policy Decision Point — the bridge between crypto and logic.
Verifies signed chains (signet), extracts assertions as facts, and feeds them to the Datalog engine (stroopwafel) for a decision.
Usage: (-> (context) (add-chain signed-chain {:trust-root root-kid}) (add-chain idp-chain {:trust-root idp-kid}) (add-facts [[:current-time (System/currentTimeMillis)] [:requested-effect :read]]) (decide :rules [...] :policies [{:kind :allow :query [...]}])) ;; → {:allowed? true/false}
Policy Decision Point — the bridge between crypto and logic.
Verifies signed chains (signet), extracts assertions as facts,
and feeds them to the Datalog engine (stroopwafel) for a decision.
Usage:
(-> (context)
(add-chain signed-chain {:trust-root root-kid})
(add-chain idp-chain {:trust-root idp-kid})
(add-facts [[:current-time (System/currentTimeMillis)]
[:requested-effect :read]])
(decide
:rules [...]
:policies [{:kind :allow :query [...]}]))
;; → {:allowed? true/false}Replay protection for signed requests.
Uses UUIDv7 request-ids as both timestamp (freshness) and nonce (replay). Factory pattern: create-replay-guard returns an independent guard instance with its own cache and configurable freshness window.
Replay protection for signed requests. Uses UUIDv7 request-ids as both timestamp (freshness) and nonce (replay). Factory pattern: create-replay-guard returns an independent guard instance with its own cache and configurable freshness window.
SPKI/SDSI-style assertion blocks: signed statements with mandatory sayer + timestamp + optional temporal bounds, as the unit of issuance for the assertion-based PDP.
A block is a signet signed envelope whose message carries: {:not-before <epoch-ms> — optional; absent means 'as of signing-ts' :not-after <epoch-ms> — optional; absent/nil/:forever means infinity :assertions [{:id :type :statement} ...]}
All assertions in one block inherit the sayer, signing-ts, and temporal bounds from the envelope. Assertions needing different windows go in different blocks.
The sayer is the keypair that signs the block. Trust resolution (primordial trust-roots + delegation closure) happens later in the pre-filter pipeline — this namespace only handles construction and signature verification.
See docs/assertion-api-proposal.md for the full design.
SPKI/SDSI-style assertion blocks: signed statements with mandatory
sayer + timestamp + optional temporal bounds, as the unit of
issuance for the assertion-based PDP.
A block is a signet signed envelope whose message carries:
{:not-before <epoch-ms> — optional; absent means 'as of signing-ts'
:not-after <epoch-ms> — optional; absent/nil/:forever means infinity
:assertions [{:id :type :statement} ...]}
All assertions in one block inherit the sayer, signing-ts, and
temporal bounds from the envelope. Assertions needing different
windows go in different blocks.
The sayer is the keypair that signs the block. Trust resolution
(primordial trust-roots + delegation closure) happens later in the
pre-filter pipeline — this namespace only handles construction and
signature verification.
See docs/assertion-api-proposal.md for the full design.SPKI/SDSI-shaped PDP: context builder, assertion ingestion, the pre-filter pipeline, and decide.
Usage: (-> (context) (add-trust-roots #{authority-kid}) (with-templates tmpl/standard) (add-assertions signed-block) (add-facts [[:current-time (System/currentTimeMillis)]]) (decide :policies [{:kind :allow :query [[:can "alice" :read "/data"]]}]))
Phase 2 scope: passes 1–5 of the pre-filter (sig → trust → temporal → revocation → expand). Trust is a flat primordial set — delegation closure is Phase 3. The pipeline is otherwise complete end-to-end.
See docs/assertion-api-proposal.md for the full design.
SPKI/SDSI-shaped PDP: context builder, assertion ingestion, the
pre-filter pipeline, and decide.
Usage:
(-> (context)
(add-trust-roots #{authority-kid})
(with-templates tmpl/standard)
(add-assertions signed-block)
(add-facts [[:current-time (System/currentTimeMillis)]])
(decide :policies [{:kind :allow
:query [[:can "alice" :read "/data"]]}]))
Phase 2 scope: passes 1–5 of the pre-filter (sig → trust → temporal
→ revocation → expand). Trust is a flat primordial set — delegation
closure is Phase 3. The pipeline is otherwise complete end-to-end.
See docs/assertion-api-proposal.md for the full design.Revocation set collection and checking for the SPKI/SDSI PDP.
A revocation set is a plain map with three explicit scopes:
{:ids #{uuid ...} — revoked assertion IDs :keys #{kid ...} — revoked sayer keys (cascades to every assertion that sayer ever signed) :subjects #{name ...}} — revoked subject names (first element of an assertion's statement, by convention)
Two sources feed into the revocation pass of the pre-filter:
collect-in-band
after trust filtering, so only revocations from trusted sayers
count.stroopwafel.pdp.spki.core/with-revocation-source. Useful for
services that maintain a revocation feed outside the token path.collect-all combines both. Sources compose via combine-sources.
This namespace owns the revocation data model and the in-band
collection logic; core orchestrates when it runs within the
pre-filter pipeline.
Revocation set collection and checking for the SPKI/SDSI PDP.
A revocation set is a plain map with three explicit scopes:
{:ids #{uuid ...} — revoked assertion IDs
:keys #{kid ...} — revoked sayer keys (cascades to
every assertion that sayer ever
signed)
:subjects #{name ...}} — revoked subject names (first
element of an assertion's
statement, by convention)
Two sources feed into the revocation pass of the pre-filter:
1. **In-band** — :revocation assertions carried alongside other
assertions in signed blocks. Collected via `collect-in-band`
after trust filtering, so only revocations from trusted sayers
count.
2. **Out-of-band** — a caller-supplied function returning a live
revocation set, registered via
`stroopwafel.pdp.spki.core/with-revocation-source`. Useful for
services that maintain a revocation feed outside the token path.
`collect-all` combines both. Sources compose via `combine-sources`.
This namespace owns the revocation data model and the in-band
collection logic; `core` orchestrates when it runs within the
pre-filter pipeline.Standard Datalog templates for SPKI/SDSI assertion types.
Templates are rules that unpack raw assertion tuples (the 7-position format produced by the pre-filter — sayer/ts/not-before/not-after/ type/id/statement) into clean named predicates, so policy authors never have to match positions directly.
The standard var bundles the canonical set for the four built-in
assertion types (:capability, :name-binding, :delegation,
:revocation). Register via (spki/with-templates ctx standard).
Users can also define their own templates following the same shape — they're just regular stroopwafel Datalog rules, nothing special.
Templates use unique variable names (?_sayer, ?_ts, ?_nb, ?_na,
?_id) for positions the head doesn't care about. Do NOT use bare
?_ as a wildcard here — stroopwafel's Datalog treats every
variable-named occurrence as a real variable, so repeating ?_
forces unification across positions that should be independent.
The ?_ prefix is just a Clojure-ish convention meaning 'present
in the body but ignored by the head'.
Standard Datalog templates for SPKI/SDSI assertion types. Templates are rules that unpack raw assertion tuples (the 7-position format produced by the pre-filter — sayer/ts/not-before/not-after/ type/id/statement) into clean named predicates, so policy authors never have to match positions directly. The `standard` var bundles the canonical set for the four built-in assertion types (:capability, :name-binding, :delegation, :revocation). Register via (spki/with-templates ctx standard). Users can also define their own templates following the same shape — they're just regular stroopwafel Datalog rules, nothing special. ### Note on variable naming Templates use unique variable names (?_sayer, ?_ts, ?_nb, ?_na, ?_id) for positions the head doesn't care about. Do NOT use bare `?_` as a wildcard here — stroopwafel's Datalog treats every variable-named occurrence as a real variable, so repeating `?_` forces unification across positions that should be independent. The `?_` prefix is just a Clojure-ish convention meaning 'present in the body but ignored by the head'.
Trust closure with delegation fixpoint for the SPKI/SDSI PDP.
A trust entry is a map: {:kid <kid URN> :for-types <:all or set of assertion-type keywords> :not-after <epoch-ms or nil for infinity> :origin <:primordial or :delegated>}
Multiple entries may exist for the same kid (one primordial, several delegated). trusted-for? iterates and returns true if ANY entry covers the requested type at the given time. This automatically implements the 'widen' semantics (pinned decision §11 #6): a primordial trust-root's effective scope is the union of its primordial grant and any delegations that also reach it.
Delegation semantics:
Phase 3 scope: type-level delegation. Resource/action scoping (e.g., 'delegate :capability for resources under /api/service only') is deferred — delegation assertions carry only a delegate kid and a type keyword (or :all).
Trust closure with delegation fixpoint for the SPKI/SDSI PDP.
A trust entry is a map:
{:kid <kid URN>
:for-types <:all or set of assertion-type keywords>
:not-after <epoch-ms or nil for infinity>
:origin <:primordial or :delegated>}
Multiple entries may exist for the same kid (one primordial, several
delegated). trusted-for? iterates and returns true if ANY entry
covers the requested type at the given time. This automatically
implements the 'widen' semantics (pinned decision §11 #6): a
primordial trust-root's effective scope is the union of its
primordial grant and any delegations that also reach it.
Delegation semantics:
- A sayer trusted for type T can issue :delegation assertions
for type T to any kid (no separate :delegation grant needed).
- The delegated entry's :for-types is the intersection of the
delegator's scope and the delegation's stated type.
- The delegated entry's :not-after is the MIN of the delegator's
own :not-after and the delegation block's :not-after
(attenuation — a delegate can never outlive the delegator).
Phase 3 scope: type-level delegation. Resource/action scoping (e.g.,
'delegate :capability for resources under /api/service only') is
deferred — delegation assertions carry only a delegate kid and a
type keyword (or :all).Trust-root fact generation for Datalog authorization.
Converts trust-root configurations into [:trusted-root kid effect domain] facts using kid URNs as key identifiers.
Trust-root fact generation for Datalog authorization. Converts trust-root configurations into [:trusted-root kid effect domain] facts using kid URNs as key identifiers.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |