chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { PasswordService } from '../../src/auth/services/password.service';
|
||||
|
||||
test('PasswordService hashes with Argon2id and verifies safely', async () => {
|
||||
const service = new PasswordService();
|
||||
const hash = await service.hash('Una-clave-segura-2026');
|
||||
|
||||
assert.match(hash, /^\$argon2id\$/);
|
||||
assert.equal(await service.verify(hash, 'Una-clave-segura-2026'), true);
|
||||
assert.equal(await service.verify(hash, 'clave-incorrecta'), false);
|
||||
assert.equal(service.needsRehash(hash), false);
|
||||
});
|
||||
|
||||
test('PasswordService performs dummy verification for unknown users', async () => {
|
||||
const service = new PasswordService();
|
||||
await assert.doesNotReject(service.verifyUnknown('cualquier-clave'));
|
||||
});
|
||||
Reference in New Issue
Block a user