Update Preserves submodule
This commit is contained in:
parent
ed555776fb
commit
62464a0cc1
|
@ -1 +1 @@
|
|||
Subproject commit f408708887e227ba8f67133cf03095890edbd8f9
|
||||
Subproject commit ea50b05bada73dc421227ecbff2b50e35971025f
|
|
@ -1,7 +1,10 @@
|
|||
import preserves, preserves/parse
|
||||
# SPDX-FileCopyrightText: ☭ 2021 Emery Hemingway
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
import preserves
|
||||
import ../syndicate/protocols/schemas/sturdy, ./private/hmacs
|
||||
|
||||
proc mint*(key: openarray[byte]; oid: Value): SturdyRef =
|
||||
proc mint*(key: openarray[byte]; oid: Preserve): SturdyRef =
|
||||
SturdyRef(oid: oid, sig: hmacSha256(key, encode(oid), key.len))
|
||||
|
||||
proc attenuate*(r: SturdyRef; caveats: Attenuation): SturdyRef =
|
||||
|
@ -19,10 +22,11 @@ proc validate*(key: openarray[byte]; r: SturdyRef): bool =
|
|||
|
||||
when isMainModule:
|
||||
import unittest
|
||||
test "mint":
|
||||
import preserves/parse
|
||||
test "sturdy":
|
||||
var
|
||||
key: array[16, byte]
|
||||
oid = "syndicate".toPreserve(EmbeddedType)
|
||||
oid = "syndicate".toPreserve
|
||||
sRef = mint(key, oid)
|
||||
control = parsePreserves"""<ref "syndicate" [] #[pkgN9TBmEd3Q04grVG4Zdw]>"""
|
||||
check(sRef.toPreserve == control)
|
||||
|
|
Loading…
Reference in New Issue