From 251f0a5bd102ac52e62307b997b5ee87631f8668 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 4 May 2021 15:10:47 +1000 Subject: [PATCH] dm-hook: sign, hash messages --- pkg/arvo/app/dm-hook.hoon | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/app/dm-hook.hoon b/pkg/arvo/app/dm-hook.hoon index 41b56aa30..35e108cc5 100644 --- a/pkg/arvo/app/dm-hook.hoon +++ b/pkg/arvo/app/dm-hook.hoon @@ -59,12 +59,12 @@ :: %graph-update-2 =+ !<(=update:store vase) - ?+ -.q.update `this + ?+ -.q.update !! %add-nodes ?> ?=([@ %inbox] resource.q.update) =^ cards state ?: =(our.bowl src.bowl) - (outgoing-add nodes.q.update) + (outgoing-add (hash-and-sign nodes.q.update)) ?: &(screening !(dm-exists src.bowl)) (screen-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 |= =action:hook ^- card