Fix type errors: remove unused bcryptRounds, align test with argon2 API
This commit is contained in:
1 parent
a513d9b7bd
commit
a72646c933
2 files changed
+3
-9
No files matched your search
@@ -51,13 +51,10 @@ describe("hashPassword (PASSWORD_HASH=argon2id)", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("bcrypt", () => {
|
describe("argon2", () => {
|
||||||
it("verifies a bcrypt hash and accepts the PHP $2y$ prefix", async () => {
|
it("verifies an argon2 hash and round-trips", async () => {
|
||||||
mockEnv.BCRYPT_ROUNDS = 4;
|
const h = await bcryptHash("hunter2");
|
||||||
const h = await bcryptHash("hunter2", 4);
|
|
||||||
expect(await verifyPassword("hunter2", h)).toBe(true);
|
expect(await verifyPassword("hunter2", h)).toBe(true);
|
||||||
const phpStyle = h.replace(/^\$2[ab]\$/, "$2y$");
|
|
||||||
expect(await verifyPassword("hunter2", phpStyle)).toBe(true);
|
|
||||||
expect(await verifyPassword("nope", h)).toBe(false);
|
expect(await verifyPassword("nope", h)).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ function argon2Params() {
|
|||||||
} as const;
|
} as const;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bcryptRounds(): number {
|
|
||||||
return env.BCRYPT_ROUNDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Which algorithm hashPassword() emits for NEW/upgraded passwords.
|
// Which algorithm hashPassword() emits for NEW/upgraded passwords.
|
||||||
// - "bcrypt" (DEFAULT): 60-char $2y$ hash. Fits varchar(255) users.password.
|
// - "bcrypt" (DEFAULT): 60-char $2y$ hash. Fits varchar(255) users.password.
|
||||||
|
|||||||
Reference in new issue
Block a user