Rename sturdy module to capabilities

This commit is contained in:
Emery Hemingway 2021-10-27 18:54:20 +02:00
parent 77a9ea380f
commit 3f552edde7
1 changed files with 10 additions and 2 deletions

View File

@ -2,11 +2,19 @@
# SPDX-License-Identifier: Unlicense
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))
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 =
result = SturdyRef(
oid: r.oid,