Next: Simple Mint, Previous: Queue, Up: actor-lib: A standard library of sorts [Contents][Index]
The (goblins actor-lib sealers)
module provides a mechanism for
ensuring the authenticity of data. A sealer is used to place data
within a wrapper. This wrapper can only be unsealed by the
corresponding unsealer, and can be checked with a predicate to ensure
it is authentic. Sealers and unsealers are analogous to public key
cryptography, but do not use any cryptography at all.
Return values
holding a sealer
, unsealer
, and
check
capability. name, if provided, is the debug name
of the underlying Scheme record object. make-sealer-triplet, if
provided, is the primitive used to create the sealer objects. Each
sealer object can be invoked with a single argument:
sealer value
: Seal value and return a reference to the
sealed object.
unsealer value
: Unseal the value sealed with the
corresponding sealer
. If the unsealed object is near,
it is returned directly; otherwise, a promise is returned.
As an example, consider a metaphorical food delivery service and its rival service:
> (define-values (our-lunch:seal our-lunch:unseal our-can?) (spawn-sealer-triplet)) > (define-values (rival-lunch:seal rival-lunch:unseal rival-can?) (spawn-sealer-triplet)) > ($ our-lunch:seal 'fried-rice) => #<local-object sealed-value> > (define chickpea-lunch ($ our-lunch:seal 'chickpea-salad)) > ($ our-can? chickpea-lunch) => #t > ($ our-can? ($ rival-lunch:seal 'melted-ice-cream)) => #f > ($ our-lunch:unseal chickpea-lunch) => chickpea-salad