nostr-dev-kit / ndk

Nostr Development Kit with outbox-model support
https://nostr-dev-kit.github.io/ndk/
MIT License
366 stars 99 forks source link

nip46 signer may produce invalid events #222

Open nostrband opened 6 months ago

nostrband commented 6 months ago

Nip46 signer client only uses the 'sig' field from an event returned from nip46 server:

https://github.com/nostr-dev-kit/ndk/blob/7cd209e41806124e1a7cf75de34d95b357cf7c6b/ndk/src/signers/nip46/index.ts#L242C1-L243C1

However, NDK's own nip46 server may change the to-be-signed event (in particular, it changes the created_at field for replaceable events), which means that nip46 client may get a signature from a different event, but will assume otherwise.