syndicate-js/packages/core/protocols/schemas/sturdy.prs

53 lines
1.8 KiB
Plaintext

version 1 .
embeddedType EntityRef.Cap .
; Serves as both gatekeeper.Step and gatekeeper.PathStep.
SturdyStep = SturdyRef .
; A gatekeeper.Description.
SturdyService = <ref @oid any @key bytes> .
; The sequence of Caveats is run RIGHT-TO-LEFT.
; That is, the newest Caveats are at the right.
;
; Let f(k,d) = HMAC-BLAKE2s-256(k,d)[0..16),
; e = canonical machine-oriented serialization of some preserves value, and
; k = the original secret key for the ref.
;
; The `sig` is then f(f(f(f(k, e(oid)), ...), e(Caveat)), ...).
;
SturdyRef = <ref @oid any @caveatChain [Caveat ...] @sig bytes>.
; embodies 1st-party caveats over assertion structure, but nothing else
; can add 3rd-party caveats and richer predicates later
Caveat = Rewrite / Alts / Reject / @unknown any .
Rewrite = <rewrite @pattern Pattern @template Template> .
Reject = <reject @pattern Pattern> .
Alts = <or @alternatives [Rewrite ...]>.
Oid = int .
WireRef = @mine [0 @oid Oid] / @yours [1 @oid Oid @attenuation Caveat ...].
;---------------------------------------------------------------------------
Lit = <lit @value any>.
Pattern = PDiscard / PAtom / PEmbedded / PBind / PAnd / PNot / Lit / PCompound .
PDiscard = <_>.
PAtom = =Boolean / =Float / =Double / =SignedInteger / =String / =ByteString / =Symbol .
PEmbedded = =Embedded .
PBind = <bind @pattern Pattern>.
PAnd = <and @patterns [Pattern ...]>.
PNot = <not @pattern Pattern>.
PCompound =
/ @rec <rec @label any @fields [Pattern ...]>
/ @arr <arr @items [Pattern ...]>
/ @dict <dict @entries { any: Pattern ...:... }> .
Template = TAttenuate / TRef / Lit / TCompound .
TAttenuate = <attenuate @template Template @attenuation [Caveat ...]>.
TRef = <ref @binding int>.
TCompound =
/ @rec <rec @label any @fields [Template ...]>
/ @arr <arr @items [Template ...]>
/ @dict <dict @entries { any: Template ...:... }> .