MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / safeKey

Function safeKey

server/src/training-agent/state.ts:344–348  ·  view source on GitHub ↗
(value: string | undefined, max: number, pattern: RegExp)

Source from the content-addressed store, hash-verified

342const SAFE_ACCOUNT_ID_RE = /^[a-zA-Z0-9._-]+$/;
343
344function safeKey(value: string | undefined, max: number, pattern: RegExp): string | null {
345 if (!value || value.length === 0 || value.length > max) return null;
346 if (!pattern.test(value)) return null;
347 return value;
348}
349
350/** Derive a session key from the request context.
351 *

Callers 1

sessionKeyFromArgsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected