Files
vitareba/lib/utils/validate.ts
T
g-butandClaude Sonnet 4.6 09ef9dfa55 refactor(config): eliminate magic numbers and duplicate UUID regex
- lib/config/auth.ts: add PASSWORD_RESET_TOKEN_MAX_LENGTH and
  RESET_TOKEN_IDENTIFIER_PREFIX ("reset:") so the token schema cap and
  identifier prefix have a single source of truth
- auth routes: import and use both new constants (4 occurrences of
  hardcoded "reset:" prefix replaced)
- lib/utils/validate.ts: export UUID_RE so routes don't each define their
  own copy of the same regex
- documents routes (GET + upload): import UUID_RE instead of local re-def

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 09:06:37 +02:00

3 lines
164 B
TypeScript

/** UUID v4 regex — use this instead of re-defining inline in routes */
export const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;