From ce022247613f1b26dbfda79d0feeed95ad0bcd75 Mon Sep 17 00:00:00 2001 From: Brad Anderson Date: Sun, 28 Jan 2024 10:12:01 -0500 Subject: [PATCH] fix pbkdf2 deriveBits tests --- example/src/testing/Tests/webcryptoTests/webcryptoTests.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/example/src/testing/Tests/webcryptoTests/webcryptoTests.ts b/example/src/testing/Tests/webcryptoTests/webcryptoTests.ts index 67cd09b9..322042fa 100644 --- a/example/src/testing/Tests/webcryptoTests/webcryptoTests.ts +++ b/example/src/testing/Tests/webcryptoTests/webcryptoTests.ts @@ -68,6 +68,10 @@ function arrayBufferToBase64(buffer: ArrayBuffer) { return btoa(binary); } +function ab2str(buf: ArrayBuffer) { + return Buffer.from(buf).toString('hex'); +} + export const registerWebcryptoTests = () => {}; describe('webcrypto', () => { @@ -117,7 +121,7 @@ describe('webcrypto', () => { key, length ); - const pbkdf2Key = arrayBufferToBase64(bits); + const pbkdf2Key = ab2str(bits); expect(pbkdf2Key).to.equal(expected); };