Rename sturdy module to capabilities
This commit is contained in:
parent
77a9ea380f
commit
3f552edde7
|
@ -2,11 +2,19 @@
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import preserves
|
import preserves
|
||||||
import ../syndicate/protocols/schemas/sturdy, ./private/hmacs
|
import ./protocols/sturdy, ./private/hmacs
|
||||||
|
|
||||||
proc mint*(key: openarray[byte]; oid: Preserve): SturdyRef =
|
from ./actors import Ref
|
||||||
|
|
||||||
|
type SturdyRef* = sturdy.SturdyRef[Ref]
|
||||||
|
|
||||||
|
proc mint*(key: openarray[byte]; oid: Preserve[Ref]): SturdyRef =
|
||||||
SturdyRef(oid: oid, sig: hmacSha256(key, encode(oid), key.len))
|
SturdyRef(oid: oid, sig: hmacSha256(key, encode(oid), key.len))
|
||||||
|
|
||||||
|
proc mint*[T](key: openarray[byte]; oid: T): SturdyRef =
|
||||||
|
let oidPr = toPreserve(oid, Ref)
|
||||||
|
SturdyRef(oid: oidPr, sig: hmacSha256(key, encode(oidPr), key.len))
|
||||||
|
|
||||||
proc attenuate*(r: SturdyRef; caveats: Attenuation): SturdyRef =
|
proc attenuate*(r: SturdyRef; caveats: Attenuation): SturdyRef =
|
||||||
result = SturdyRef(
|
result = SturdyRef(
|
||||||
oid: r.oid,
|
oid: r.oid,
|
Loading…
Reference in New Issue