From 161a99f3fac1d61a61513ce4ba014fe50d7e4d20 Mon Sep 17 00:00:00 2001 From: lucythecat Date: Wed, 1 Nov 2023 14:42:43 +0900 Subject: [PATCH] fix test --- src/password/index.test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/password/index.test.ts b/src/password/index.test.ts index 6215c38..8c84469 100644 --- a/src/password/index.test.ts +++ b/src/password/index.test.ts @@ -1,24 +1,23 @@ import { test, expect } from "vitest"; import { Argon2id, Bcrypt, Scrypt } from "./index.js"; import { encodeHex } from "../encoding/index.js"; -import { getRandomValues } from "crypto"; test("Argon2id", async () => { - const password = encodeHex(getRandomValues(new Uint8Array(32))); + const password = encodeHex(crypto.getRandomValues(new Uint8Array(32))); const argon2id = new Argon2id(); const hash = await argon2id.hash(password); expect(argon2id.verify(hash, password)).resolves.toBe(true); }); test("Bcrypt", async () => { - const password = encodeHex(getRandomValues(new Uint8Array(32))); + const password = encodeHex(crypto.getRandomValues(new Uint8Array(32))); const bcrypt = new Bcrypt(); const hash = await bcrypt.hash(password); expect(bcrypt.verify(hash, password)).resolves.toBe(true); }); test("Argon2id", async () => { - const password = encodeHex(getRandomValues(new Uint8Array(32))); + const password = encodeHex(crypto.getRandomValues(new Uint8Array(32))); const scrypt = new Scrypt(); const hash = await scrypt.hash(password); expect(scrypt.verify(hash, password)).resolves.toBe(true);