diff options
Diffstat (limited to 'desk/lib')
-rw-r--r-- | desk/lib/json/nostr.hoon | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/desk/lib/json/nostr.hoon b/desk/lib/json/nostr.hoon index 6f93c1c..cb10c1d 100644 --- a/desk/lib/json/nostr.hoon +++ b/desk/lib/json/nostr.hoon @@ -22,11 +22,12 @@ ~ == ++ req |= =req:shim:sur ^- json + =/ en-ev event :- %a :- s+(crip (cuss (trip -.req))) ?- -.req %req (enreq +.req) - %event :_ ~ (event +.req) - %auth :_ ~ (event +.req) + %event :_ ~ (en-ev(nostr .y) +.req) + %auth :_ ~ (en-ev(nostr .y) +.req) %close :_ ~ [%s +.req] == ++ enreq @@ -38,11 +39,12 @@ :: ++ raw-event |= raw-event:sur :: WTF nostr doesn't want the prefix on the pubkey - =/ scw scow:sr - =/ pubkeyt (scw(min-chars 64) %ux pubkey) + :: =/ scw scow:sr + :: =/ pubkeyt (scw(min-chars 64) %ux pubkey) + =/ pubkeyt (scow:sr %ux pubkey) ?~ pubkeyt !! - :: =/ pubkeyj [%s (crip t.pubkeyt)] - =/ pubkeyj [%s (crip pubkeyt)] + =/ pubkeyj [%s (crip t.pubkeyt)] + :: =/ pubkeyj [%s (crip pubkeyt)] :- %a :~ [%n '0'] pubkeyj @@ -52,14 +54,16 @@ s+content == ++ event + =/ nostr=? .n |= e=event:sur ^- json - :: =/ pubkeyt (scow:sr %ux pubkey.e) - :: ?~ pubkeyt !! - :: =/ pubkeyj [%s (crip t.pubkeyt)] + =/ pubkey ?. nostr + (hex:en:common pubkey.e) + =/ pubkeyt (scow:sr %ux pubkey.e) + ?~ pubkeyt !! + [%s (crip t.pubkeyt)] %: pairs id+(hex:en:common id.e) - pubkey+(hex:en:common pubkey.e) - :: pubkey+pubkeyj + pubkey+pubkey sig+(hex:en:common sig.e) ['created_at' (numb created-at.e)] kind+(numb kind.e) |