Initial Commit

This commit is contained in:
2026-05-27 23:47:53 +01:00
parent fbc70f96e6
commit 9b28db724f
18103 changed files with 1600554 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { constantTimeStringEqual } from "../totp/verify.js";
import { ocra } from "./ocra.js";
import type { OcraParams } from "./ocra.types.js";
/** Constant-time verify: recomputes the OCRA response under the given suite
* and key and compares it to `response` without short-circuiting. */
export function verifyOcra(
response: string,
suite: string,
key: Uint8Array,
params: OcraParams
): boolean {
const expected = ocra(suite, key, params);
return constantTimeStringEqual(response, expected);
}