Speed up tests: lower argon2 params in CI, env overrides
- Allow ARGON2_MEMORY_SIZE, ARGON2_ITERATIONS, ARGON2_PARALLELISM env overrides - Use m=1024,t=1 in tests (was m=65536,t=4 → ~1s per hash) - Set fast params in CI and deploy workflows
This commit is contained in:
1 parent
b6ba554386
commit
f7551166c5
34 files changed
+16
-12902
No files matched your search
@@ -33,17 +33,25 @@ describe("hashPassword (default driver: bcrypt)", () => {
|
||||
});
|
||||
|
||||
describe("hashPassword (PASSWORD_HASH=argon2id)", () => {
|
||||
it("hashes with the AtomCMS params (m=65536,t=4,p=1) and round-trips", async () => {
|
||||
it("hashes with the AtomCMS params and round-trips", async () => {
|
||||
const prev = process.env.PASSWORD_HASH;
|
||||
const prevMem = process.env.ARGON2_MEMORY_SIZE;
|
||||
const prevIters = process.env.ARGON2_ITERATIONS;
|
||||
process.env.PASSWORD_HASH = "argon2id";
|
||||
process.env.ARGON2_MEMORY_SIZE = "1024";
|
||||
process.env.ARGON2_ITERATIONS = "1";
|
||||
try {
|
||||
const h = await hashPassword("s3cret!");
|
||||
expect(h).toMatch(/^\$argon2id\$v=19\$m=65536,t=4,p=1\$/);
|
||||
expect(h).toMatch(/^\$argon2id\$v=19\$m=1024,t=1,p=1\$/);
|
||||
expect(await verifyPassword("s3cret!", h)).toBe(true);
|
||||
expect(await verifyPassword("wrong", h)).toBe(false);
|
||||
} finally {
|
||||
if (prev === undefined) delete process.env.PASSWORD_HASH;
|
||||
else process.env.PASSWORD_HASH = prev;
|
||||
if (prevMem === undefined) delete process.env.ARGON2_MEMORY_SIZE;
|
||||
else process.env.ARGON2_MEMORY_SIZE = prevMem;
|
||||
if (prevIters === undefined) delete process.env.ARGON2_ITERATIONS;
|
||||
else process.env.ARGON2_ITERATIONS = prevIters;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user