fix: convert the stored hex key to bytes before nip44 getConversationKey #1

Merged
reya merged 1 commits from chad.curtis/fix-nip44-hex-key AGit into master 2026-10-16 00:37:12 +00:00
Contributor

Since 1.0.0 every window.nostr.nip44.encrypt/decrypt call fails with expected Uint8Array, got type=string, which breaks NIP-17 DMs and anything else using NIP-44 on sites that use the extension.

private_key is stored as hex, and nostr-tools 2.23 (noble-curves v2) no longer accepts hex strings in getConversationKey. signEvent and getPublicKey already convert with hexToBytes(sk); this does the same in getSharedSecret.

Also adds NIP-44 tests (hex key rejected, converted key round-trips with a peer) in place of the note saying NIP-44 was only covered by the build. vitest run passes (50 tests), biome is clean, and a build.js prod firefox bundle encrypts where the published 1.0.0 throws.

Since 1.0.0 every `window.nostr.nip44.encrypt`/`decrypt` call fails with `expected Uint8Array, got type=string`, which breaks NIP-17 DMs and anything else using NIP-44 on sites that use the extension. `private_key` is stored as hex, and nostr-tools 2.23 (noble-curves v2) no longer accepts hex strings in `getConversationKey`. `signEvent` and `getPublicKey` already convert with `hexToBytes(sk)`; this does the same in `getSharedSecret`. Also adds NIP-44 tests (hex key rejected, converted key round-trips with a peer) in place of the note saying NIP-44 was only covered by the build. `vitest run` passes (50 tests), biome is clean, and a `build.js prod firefox` bundle encrypts where the published 1.0.0 throws.
chad.curtis added 1 commit 2026-10-15 20:00:36 +00:00
nostr-tools 2.23 (noble-curves v2) no longer accepts hex strings, so every nip44.encrypt/decrypt failed with "expected Uint8Array, got type=string". Adds nip44 tests.
reya merged commit 67d6e26093 into master 2026-10-16 00:37:12 +00:00
Owner

thank for your contributation

thank for your contributation
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: reya/nostr-connect#1