Skip to the content

Capsid menu

app/lib/bearer.server.ts

12 lines and 1 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of bearer.server.ts
FunctionLinesComplexityCoveredCRAPMutation
tokenLabel12 to 141100%OkCRAP 1No data: no mutants in this code

Imports

It imports app/lib/bytes.mjs. Imported by app/lib/operator/auth.server.ts, app/lib/smoke.server.ts.

Source

// The bearer tokens' label. The compare itself is the family's one constant-time copy,
// `safeEqual` from `@dustinedwards/site-runtime/compare`. Kept `.server` because the secrets
// boundary is a path rule.

import { fnv1a32 } from "./bytes.mjs";

/**
 * A label for commit messages and rate-limit keys. 32-bit FNV-1a is not the token and cannot be
 * read back into one, but a holder of the label can confirm a guess; `safeEqual` is the
 * security boundary.
 */
export function tokenLabel(token: string): string {
  return fnv1a32(token);
}