src/approval.ts
8 lines and 1 functions in DrDustinEdwards/capsid, at commit daa875b on 2026-10-24. This file on GitHub.
Functions
| Function | Lines | Complexity | Covered | CRAP | Mutation |
|---|---|---|---|---|---|
| approvalTag | 8 to 10 | 2 | 100% | OkCRAP 2 | No data: mutation testing has not run on this repo yet |
Imports
It imports src/auth.ts. Imported by src/routes.ts.
Source
import { sha256Hex } from "./auth";
// 30 days. Consent is a one-second decision on a dialog that prints one redirect.
export const APPROVAL_MAX_AGE_SECONDS = 30 * 24 * 60 * 60;
// clientId plus 16 hex of sha256 of the requested redirect, not the whole set.
// 64 bits is integrity, not a secret: the cookie is HMAC-signed.
export async function approvalTag(clientId: string, redirectUri: string | undefined): Promise<string> {
return `${clientId}.${(await sha256Hex(redirectUri ?? "")).slice(0, 16)}`;
}