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

Constructor of NDKNip46Backend class throws "Invalid signer" when hex string is provided for privateKeyOrSigner argument #236

Open sabhas opened 5 months ago

sabhas commented 5 months ago

The condition here in the constructor of the NDKNip46Backend class always evaluates to false because a hex string is not an instance of the String class. Consequently, passing a hex string for the privateKeyOrSigner argument results in an "Invalid signer" error.

Modify the condition to properly check if privateKeyOrSigner is a hex string by using a more appropriate method, such as checking the type with typeof or using a regular expression to validate hex string format.