dm-hook: sign, hash messages

This commit is contained in:
Liam Fitzgerald 2021-05-04 15:10:47 +10:00
parent 31a84f583f
commit 251f0a5bd1
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -59,12 +59,12 @@
:: ::
%graph-update-2 %graph-update-2
=+ !<(=update:store vase) =+ !<(=update:store vase)
?+ -.q.update `this ?+ -.q.update !!
%add-nodes %add-nodes
?> ?=([@ %inbox] resource.q.update) ?> ?=([@ %inbox] resource.q.update)
=^ cards state =^ cards state
?: =(our.bowl src.bowl) ?: =(our.bowl src.bowl)
(outgoing-add nodes.q.update) (outgoing-add (hash-and-sign nodes.q.update))
?: &(screening !(dm-exists src.bowl)) ?: &(screening !(dm-exists src.bowl))
(screen-add nodes.q.update) (screen-add nodes.q.update)
(incoming-add nodes.q.update) (incoming-add nodes.q.update)
@ -72,6 +72,25 @@
== ==
== ==
:: ::
++ hash-and-sign
|= =nodes
%- ~(gas by *^nodes)
%+ turn ~(tap by nodes)
|= [=index:store =node:store]
^- [index:store node:store]
:- index
?> ?=(%& -.post.node)
=* p post.node
=/ =hash:store
`@ux`(sham [~ author time-sent contents]:p.p)
%_ node
hash.p.post `hash
::
signatures.p.post
%- ~(gas in *signatures:store)
[(sign:sig our.bowl now.bowl hash)]~
==
::
++ give ++ give
|= =action:hook |= =action:hook
^- card ^- card