syndicate-protocols/schemas/sturdy.prs

71 lines
2.3 KiB
Plaintext
Raw Normal View History

version 1 .
2021-07-22 12:12:53 +00:00
embeddedType EntityRef.Cap .
2023-02-08 22:11:05 +00:00
;---------------------------------------------------------------------------
; Binding and connection
SturdyStepType = =ref .
; In a gatekeeper.Step or gatekeeper.PathStep, use Parameters as detail.
SturdyStepDetail = Parameters .
SturdyPathStepDetail = Parameters .
; In a gatekeeper.Description, use the following detail.
SturdyDescriptionDetail = {
oid: any,
key: bytes,
} .
;---------------------------------------------------------------------------
; Macaroons
2023-02-08 13:33:48 +00:00
2023-02-06 09:45:41 +00:00
; The sequence of Caveats is run RIGHT-TO-LEFT.
; That is, the newest Caveats are at the right.
2023-02-06 15:19:03 +00:00
;
; 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.
2023-02-06 15:19:03 +00:00
;
2023-02-07 12:11:14 +00:00
; The `sig` is then f(f(f(f(k, e(oid)), ...), e(Caveat)), ...).
2023-02-06 15:19:03 +00:00
;
2023-02-08 22:11:05 +00:00
SturdyRef = <ref @parameters Parameters> .
Parameters = {
oid: any,
sig: bytes,
} & @caveats CaveatsField .
CaveatsField = @present { caveats: [Caveat ...] } / @invalid { caveats: any } / @absent {} .
; embodies 1st-party caveats over assertion structure, but nothing else
; can add 3rd-party caveats and richer predicates later
2023-02-07 12:18:18 +00:00
Caveat = Rewrite / Alts / Reject / @unknown any .
2023-02-06 10:06:02 +00:00
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 .
2021-07-12 19:10:19 +00:00
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 ...:... }> .
2021-06-09 13:06:58 +00:00
Template = TAttenuate / TRef / Lit / TCompound .
2023-02-06 09:45:41 +00:00
TAttenuate = <attenuate @template Template @attenuation [Caveat ...]>.
2021-07-12 19:10:19 +00:00
TRef = <ref @binding int>.
TCompound =
/ @rec <rec @label any @fields [Template ...]>
/ @arr <arr @items [Template ...]>
/ @dict <dict @entries { any: Template ...:... }> .