nostr-tools
nostr-tools copied to clipboard
nip44.getConversationKey should accept a Uint8Array
This function is awkward because secret keys are now Uint8Arrays everywhere else in nostr-tools, but it's not clear how to change it since the underlying crypto functions want a string.
yea im struggling with this, too
@mroxso You can work around it using the hexToBytes function from @noble/hashes: https://gitlab.com/soapbox-pub/NSpec/-/blob/main/src/NSecSigner.ts?ref_type=heads#L46
@paulmillr Should secp256k1.getSharedSecret accept bytes instead of a hex string here? https://github.com/nbd-wtf/nostr-tools/blob/master/nip44.ts#L23 That way getConversationString can also accept bytes.
Ideally everything is just uint8arrays.
Looks like this was fixed in https://github.com/nbd-wtf/nostr-tools/commit/5876acd67ac20d452e408ca244140088eac04fa1