From 3cd26d7d76605a1d7fb123ba8515ef019b0d1805 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 18 May 2026 20:04:17 -0300 Subject: [PATCH] nip44: fix test sha256. --- nip44.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nip44.test.ts b/nip44.test.ts index 90e2800..fd68fff 100644 --- a/nip44.test.ts +++ b/nip44.test.ts @@ -3,6 +3,7 @@ import { v2 } from './nip44.js' import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js' import { default as vec } from './nip44.vectors.json' with { type: 'json' } import { schnorr } from '@noble/curves/secp256k1.js' +import { sha256 } from '@noble/hashes/sha2.js' const v2vec = vec.v2 @@ -216,8 +217,7 @@ test('spec test vectors: SHA-256 of payload at 65535/65536/65537', async () => { const nonce = hexToBytes('0000000000000000000000000000000000000000000000000000000000000001') async function sha256hex(data: Uint8Array): Promise { - const hash = await crypto.subtle.digest('SHA-256', data) - return bytesToHex(new Uint8Array(hash)) + return bytesToHex(sha256(data)) } const vectors = [