diff options
author | polwex <polwex@sortug.com> | 2025-09-17 12:24:41 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-09-17 12:24:41 +0700 |
commit | 387af8fc1603805b02ce03f8adba4fa73a954f7c (patch) | |
tree | 6ac4fe9c33a14d9da418a97955a38efb9338d869 /desk/lib/nostr.hoon | |
parent | 31a47ce72255bb56920e417d250541b04be82648 (diff) |
relay much more robust
Diffstat (limited to 'desk/lib/nostr.hoon')
-rw-r--r-- | desk/lib/nostr.hoon | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/desk/lib/nostr.hoon b/desk/lib/nostr.hoon index c05b0eb..90eb563 100644 --- a/desk/lib/nostr.hoon +++ b/desk/lib/nostr.hoon @@ -1,6 +1,8 @@ /- sur=nostr -/+ js=json-nostr +/+ js=json-nostr, sr=sortug |% +++ gen-sub-id |= eny=@ ^- @t + %- crip (scag 60 (scow:sr %uw eny)) ++ gen-keys |= eny=@ ^- keys:sur =, secp256k1:secp:crypto =/ privkey @@ -26,4 +28,24 @@ ++ sign-event |= [priv=@ux hash=@ux eny=@] =^ sed eny (raws eny 256) (sign:schnorr:secp256k1:secp:crypto priv hash sed) + + +:: +++ validate-pubkey |= pubkey=@ux ^- ? + =/ tap (scow:sr %ux pubkey) + .= (lent tap) 64 +:: +++ diff-filters +|= [a=filter:sur b=filter:sur] ^- filter:sur + =/ ids (unit-set-dif ids.a ids.b) + =/ authors (unit-set-dif authors.a authors.b) + =/ kinds (unit-set-dif kinds.a kinds.b) + =/ tags ~ + =/ since ~ + =/ until ~ + =/ limit ~ :: TODO + [ids authors kinds tags since until limit] +++ unit-set-dif + |* [a=(unit) b=(unit)] + %^ clap a b |* [x=(set) y=(set)] (~(dif in x) y) -- |