Skip to content

feat(transport): simplify NostrSigner initialization to accept hex string#47

Merged
ContextVM-org merged 1 commit into
ContextVM:masterfrom
DevAnuragT:feat/signer-string-shorthand
Apr 21, 2026
Merged

feat(transport): simplify NostrSigner initialization to accept hex string#47
ContextVM-org merged 1 commit into
ContextVM:masterfrom
DevAnuragT:feat/signer-string-shorthand

Conversation

@DevAnuragT
Copy link
Copy Markdown
Contributor

Fixes #46

Description

This PR addresses the TODO in base-nostr-transport.ts by improving the ergonomics of the NostrSigner initialization. It allows the signer option to directly accept a hex-encoded private key string as a shorthand, automatically wrapping it in a PrivateKeySigner internally.

This is a non-breaking, additive change. Existing code that passes a completely instantiated NostrSigner will continue to function exactly as before.

Changes Made

  • Updated BaseNostrTransportOptions.signer to accept NostrSigner | string.
  • Added constructor logic to resolve the string into a PrivateKeySigner.
  • Added 5 comprehensive unit tests targeting both client and server transports with string and NostrSigner inputs.

Testing Performed

  • Ran type checks (tsc --noEmit) - passed.
  • All new and existing unit tests pass cleanly.

@DevAnuragT DevAnuragT force-pushed the feat/signer-string-shorthand branch from 3e4d632 to ff14ced Compare April 12, 2026 16:44
@DevAnuragT
Copy link
Copy Markdown
Contributor Author

Tests are passing now

@ContextVM-org ContextVM-org merged commit 3274e09 into ContextVM:master Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(transport): simplify NostrSigner initialization to accept hex string

2 participants