Liking cljdoc? Tell your friends :D

stroopwafel.pdp.spki.templates

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'.

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'.
raw docstring

capabilities-onlyclj

Just the capability templates — for pure RBAC-ish services that don't use SDSI group resolution or delegation visibility.

Just the capability templates — for pure RBAC-ish services that
don't use SDSI group resolution or delegation visibility.
raw docstring

capabilityclj

3-arity :capability assertion → [:can ?subject ?action ?resource].

Stored fact shape: [sayer ts not-before not-after :capability id subject action resource]

3-arity :capability assertion → [:can ?subject ?action ?resource].

Stored fact shape:
  [sayer ts not-before not-after :capability id subject action resource]
raw docstring

capability-constrainedclj

4-arity :capability assertion → [:can-constrained ?subject ?action ?resource ?constraints].

Its own predicate, not a 5-term :can: a predicate has one length (stroopwafel's arity check denies on a mismatch since 0.16.0).

Stored fact shape: [sayer ts not-before not-after :capability id subject action resource constraints]

4-arity :capability assertion → [:can-constrained ?subject ?action ?resource ?constraints].

Its own predicate, not a 5-term `:can`: a predicate has one length
(stroopwafel's arity check denies on a mismatch since 0.16.0).

Stored fact shape:
  [sayer ts not-before not-after :capability id subject action resource constraints]
raw docstring

delegationclj

A :delegation assertion → [:delegated ?delegator ?delegate ?type].

Stored fact shape: [sayer ts not-before not-after :delegation id delegate type]

The sayer (position 0) IS the delegator, so it surfaces as ?delegator in the head — useful for audit queries like 'who delegated :capability rights to this key?'.

A :delegation assertion → [:delegated ?delegator ?delegate ?type].

Stored fact shape:
  [sayer ts not-before not-after :delegation id delegate type]

The sayer (position 0) IS the delegator, so it surfaces as
?delegator in the head — useful for audit queries like 'who
delegated :capability rights to this key?'.
raw docstring

name-bindingclj

A :name-binding assertion → [:named ?key ?name].

Stored fact shape: [sayer ts not-before not-after :name-binding id key name]

The 'key' position is a kid URN or an intermediate name string (for chained name resolution); 'name' is a string identifier.

A :name-binding assertion → [:named ?key ?name].

Stored fact shape:
  [sayer ts not-before not-after :name-binding id key name]

The 'key' position is a kid URN or an intermediate name string
(for chained name resolution); 'name' is a string identifier.
raw docstring

revoked-assertionclj

A :revocation assertion targeting an assertion-id → [:revoked-assertion ?target].

Note: revocations are enforced by the pre-filter, which drops revoked assertions from the fact store before templates run. This template exposes revocations themselves for audit/debugging queries like 'what's been revoked recently'.

A :revocation assertion targeting an assertion-id →
[:revoked-assertion ?target].

Note: revocations are enforced by the pre-filter, which drops
revoked assertions from the fact store before templates run. This
template exposes revocations themselves for audit/debugging queries
like 'what's been revoked recently'.
raw docstring

revoked-keyclj

A :revocation assertion targeting a sayer key → [:revoked-key ?target].

A :revocation assertion targeting a sayer key →
[:revoked-key ?target].
raw docstring

revoked-subjectclj

A :revocation assertion targeting a subject name → [:revoked-subject ?target].

A :revocation assertion targeting a subject name →
[:revoked-subject ?target].
raw docstring

standardclj

The canonical template bundle — all four assertion types, both capability arities, all three revocation scopes. This is the 'batteries included' set. Users can subset or extend as needed.

The canonical template bundle — all four assertion types, both
capability arities, all three revocation scopes. This is the
'batteries included' set. Users can subset or extend as needed.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close