Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Nov 1, 2023
1 parent b5d53d5 commit 161a99f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/password/index.test.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

0 comments on commit 161a99f

Please sign in to comment.