shrub/pkg/arvo/lib/signatures.hoon

53 lines
1.2 KiB
Plaintext
Raw Normal View History

/- post
^?
=< [post .]
=, post
|%
2020-09-04 08:35:03 +03:00
++ jael-scry
|* [=mold our=ship desk=term now=time =path]
.^ mold
%j
(scot %p our)
desk
(scot %da now)
path
==
++ sign
|= [our=ship now=time =hash]
^- signature
2020-09-04 08:35:03 +03:00
=+ (jael-scry ,=life our %life now /(scot %p our))
=+ (jael-scry ,=ring our %vein now /(scot %ud life))
:+ `@ux`(sign:as:(nol:nu:crub:crypto ring) hash)
our
life
::
++ is-signature-valid
2020-09-04 08:35:03 +03:00
|= [our=ship =signature =hash now=time]
^- ?
2020-09-04 08:35:03 +03:00
=+ (jael-scry ,lyf=(unit @) our %lyfe now /(scot %p q.signature))
:: we do not have a public key from ship at this life
::
2020-09-04 08:35:03 +03:00
?~ lyf %.y
=+ %: jael-scry
,deed=[a=life b=pass c=(unit @ux)]
our %deed now /(scot %p q.signature)/(scot %ud p.signature)
==
?. =(a.deed r.signature) %.y
:: verify signature from ship at life
::
2020-09-04 08:35:03 +03:00
=/ them
(com:nu:crub:crypto b.deed)
=(`hash (sure:as.them p.signature))
::
++ are-signatures-valid
2020-09-04 08:35:03 +03:00
|= [our=ship =signatures =hash now=time]
^- ?
=/ signature-list ~(tap in signatures)
|-
?~ signature-list
%.y
2020-09-04 08:35:03 +03:00
?: (is-signature-valid our i.signature-list hash now)
$(signature-list t.signature-list)
%.n
--