phase8-p1b-argon2id-latency.test.mjs
36 lines 1.3 KB
Raw
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 57 days ago
1 /**
2 * Phase 8 P1b — performance tier: Argon2id latency bounds (§9).
3 */
4
5 import { describe, test } from 'node:test';
6 import assert from 'node:assert/strict';
7 import {
8 hashPassphrase,
9 verifyPassphrase,
10 ARGON2_PARAMS,
11 } from '../../hub/lib/local-auth.mjs';
12
13 describe('phase8-p1b Argon2id latency (performance)', () => {
14 test('verify latency on floor params: ≥50ms and ≤2000ms', async () => {
15 let maxMs = 0;
16 for (let i = 0; i < 3; i++) {
17 const phc = await hashPassphrase(`PerfTest123!Xy${i}`);
18 const start = performance.now();
19 const ok = await verifyPassphrase(phc, `PerfTest123!Xy${i}`);
20 maxMs = Math.max(maxMs, performance.now() - start);
21 assert.equal(ok, true);
22 }
23 assert.ok(maxMs >= 50, `expected ≥50ms on at least one sample, max=${maxMs}`);
24 assert.ok(maxMs <= 2000, `expected ≤2000ms, got ${maxMs}`);
25 assert.equal(ARGON2_PARAMS.timeCost, 3);
26 assert.equal(ARGON2_PARAMS.memoryCost, 65536);
27 assert.equal(ARGON2_PARAMS.parallelism, 4);
28 });
29
30 test('hash at floor params completes within 3000ms', async () => {
31 const start = performance.now();
32 await hashPassphrase('BootstrapPerf123!');
33 const ms = performance.now() - start;
34 assert.ok(ms <= 3000, `bootstrap hash took ${ms}ms`);
35 });
36 });
File History 2 commits
sha256:87f84653ce4706be8c65b0c4494ed6fb891213cca82db2b1824772cddc41a752 feat(auth): durable MCP OAuth refresh via shared strong sto… Agent minor 57 days ago
sha256:873e30b7fafe601346295f8f4289f388f21d8f715f28584d5481899ba2b714fc Merge pull request #249 from aaronrene/muse-mirror Agent 74 days ago