nostr-tools
2.20.02.21.0
lib/esm/nip44.js~
lib/esm/nip44.jsModified+10−10
Index: package/lib/esm/nip44.js
===================================================================
--- package/lib/esm/nip44.js
+++ package/lib/esm/nip44.js
@@ -1,25 +1,25 @@
// nip44.ts
-import { chacha20 } from "@noble/ciphers/chacha";
-import { equalBytes } from "@noble/ciphers/utils";
-import { secp256k1 } from "@noble/curves/secp256k1";
-import { extract as hkdf_extract, expand as hkdf_expand } from "@noble/hashes/hkdf";
-import { hmac } from "@noble/hashes/hmac";
-import { sha256 } from "@noble/hashes/sha256";
-import { concatBytes, randomBytes } from "@noble/hashes/utils";
+import { chacha20 } from "@noble/ciphers/chacha.js";
+import { equalBytes } from "@noble/ciphers/utils.js";
+import { secp256k1 } from "@noble/curves/secp256k1.js";
+import { extract as hkdf_extract, expand as hkdf_expand } from "@noble/hashes/hkdf.js";
+import { hmac } from "@noble/hashes/hmac.js";
+import { sha256 } from "@noble/hashes/sha2.js";
+import { concatBytes, hexToBytes as hexToBytes2, randomBytes } from "@noble/hashes/utils.js";
import { base64 } from "@scure/base";
// utils.ts
-import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
+import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
var utf8Decoder = new TextDecoder("utf-8");
var utf8Encoder = new TextEncoder();
// nip44.ts
var minPlaintextSize = 1;
var maxPlaintextSize = 65535;
function getConversationKey(privkeyA, pubkeyB) {
- const sharedX = secp256k1.getSharedSecret(privkeyA, "02" + pubkeyB).subarray(1, 33);
- return hkdf_extract(sha256, sharedX, "nip44-v2");
+ const sharedX = secp256k1.getSharedSecret(privkeyA, hexToBytes2("02" + pubkeyB)).subarray(1, 33);
+ return hkdf_extract(sha256, sharedX, utf8Encoder.encode("nip44-v2"));
}
function getMessageKeys(conversationKey, nonce) {
const keys = hkdf_expand(sha256, conversationKey, nonce, 76);
return {