summaryrefslogtreecommitdiff
path: root/desk
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-09-18 05:08:24 +0700
committerpolwex <polwex@sortug.com>2025-09-18 05:08:24 +0700
commit0549cfd01f1feed9c313a84a3884328d08887caf (patch)
tree5017ce328f058bf9efa5bc1de60c18b09082a93c /desk
parentad7ebd1756956724e0b167d88f924e707401a9aa (diff)
nostr keys as annoying as usual, but this works reliably
Diffstat (limited to 'desk')
-rw-r--r--desk/app/nostrill.hoon13
-rw-r--r--desk/lib/json/nostr.hoon26
2 files changed, 23 insertions, 16 deletions
diff --git a/desk/app/nostrill.hoon b/desk/app/nostrill.hoon
index 611830f..37aaf06 100644
--- a/desk/app/nostrill.hoon
+++ b/desk/app/nostrill.hoon
@@ -163,13 +163,16 @@
`this
%genkey
=/ keys (gen-keys:nlib eny.bowl)
- ~& keys=keys
+ ~& pub=(scow:sr %ux -.keys)
+ ~& priv=(scow:sr %ux +.keys)
`this
%printkey
- =/ key i.keys
- ~& pub=(scow:sr %ux -.key)
- ~& priv=(scow:sr %ux +.key)
- `this
+ =/ ks `(list keys:nsur)`keys
+ |- ?~ ks `this
+ =/ key i.ks
+ ~& pub=(scow:sr %ux -.key)
+ ~& priv=(scow:sr %ux +.key)
+ $(ks t.ks)
%feed
=/ lol debug-own-feed:mutat
`this
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)