/- sur=nostr /+ js=json-nostr |% ++ gen-keys |= eny=@ ^- keys:sur =, secp256k1:secp:crypto =/ privkey |- =/ k (~(rad og eny) (bex 256)) ?. (lth k n.t) $ k =/ pubkey (priv-to-pub privkey) =/ pub (compress-point pubkey) :: =/ pub (serialize-point pubkey) [pub=pub priv=privkey] :: ++ hash-event |= raw=raw-event:sur ^- @ux =/ jon (raw-event:en:js raw) =/ jstring (en:json:html jon) (swp 3 (shax jstring)) ++ raws |= [eny=@ bits=@] ^- [@ @] [- +>-]:(~(raws og eny) bits) ++ sign-event |= [priv=@ux hash=@ux eny=@] =^ sed eny (raws eny 256) (sign:schnorr:secp256k1:secp:crypto priv hash sed) --