attenuate-entity-ref as well as attenuate-sturdy
This commit is contained in:
parent
1290e30c3d
commit
da0d2b8e61
|
@ -6,6 +6,7 @@
|
||||||
(rename-out [make-entity entity])
|
(rename-out [make-entity entity])
|
||||||
|
|
||||||
(struct-out entity-ref)
|
(struct-out entity-ref)
|
||||||
|
attenuate-entity-ref
|
||||||
parse-Ref
|
parse-Ref
|
||||||
Ref->preserves
|
Ref->preserves
|
||||||
|
|
||||||
|
@ -432,3 +433,11 @@
|
||||||
(define (deliver maybe-proc . args)
|
(define (deliver maybe-proc . args)
|
||||||
(when maybe-proc
|
(when maybe-proc
|
||||||
(apply maybe-proc args)))
|
(apply maybe-proc args)))
|
||||||
|
|
||||||
|
;; TODO: prove to myself I've gotten the order correct. (Right-to-left, wasn't it?!?!)
|
||||||
|
(define (attenuate-entity-ref r . caveats)
|
||||||
|
(if (null? caveats)
|
||||||
|
r
|
||||||
|
(match r
|
||||||
|
[(entity-ref relay target previous-attenuation)
|
||||||
|
(entity-ref relay target (append previous-attenuation caveats))])))
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
[(Caveat-Rewrite r)
|
[(Caveat-Rewrite r)
|
||||||
(rewrite r v)]))
|
(rewrite r v)]))
|
||||||
|
|
||||||
|
;; TODO: prove to myself I've gotten the order correct. (Right-to-left, wasn't it?!?!)
|
||||||
(define (run-rewrites attenuation v)
|
(define (run-rewrites attenuation v)
|
||||||
(let loop ((stages attenuation) (v v))
|
(let loop ((stages attenuation) (v v))
|
||||||
(match stages
|
(match stages
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
sturdy-encode
|
sturdy-encode
|
||||||
sturdy-decode
|
sturdy-decode
|
||||||
mint
|
mint
|
||||||
attenuate
|
attenuate-sturdy
|
||||||
SturdyRef-valid?
|
SturdyRef-valid?
|
||||||
validate
|
validate
|
||||||
(all-from-out "schemas/gen/sturdy.rkt"))
|
(all-from-out "schemas/gen/sturdy.rkt"))
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
(define (mint oid key)
|
(define (mint oid key)
|
||||||
(SturdyRef oid '() (hmac-sha256 key (sturdy-encode oid))))
|
(SturdyRef oid '() (hmac-sha256 key (sturdy-encode oid))))
|
||||||
|
|
||||||
(define (attenuate r . attenuation)
|
(define (attenuate-sturdy r . attenuation)
|
||||||
(match-define (SturdyRef oid caveatChain sig) r)
|
(match-define (SturdyRef oid caveatChain sig) r)
|
||||||
(SturdyRef oid
|
(SturdyRef oid
|
||||||
(append caveatChain (list attenuation))
|
(append caveatChain (list attenuation))
|
||||||
|
|
Loading…
Reference in New Issue