/** * Patterns stripped from stringified errors before they ride a wire * frame. The default set covers the common credential * shapes that show up in stack traces by accident (URLs with token query * params, Bearer headers captured by retry libraries, env-var dumps). * * Each regex replaces the matched span with `[REDACTED]`. Replacement is * conservative — we'd rather over-redact than leak. Operators who need * finer control supply a custom {@link SanitizeCausedBy} function (or * pass a stricter pattern set to {@link sanitizeCausedBy}). */ export declare const DEFAULT_CREDENTIAL_PATTERNS: readonly RegExp[]; /** Default max length for a sanitized `causedBy` string. */ export declare const DEFAULT_CAUSED_BY_MAX_LENGTH = 2048; /** Truncation marker appended when `causedBy` exceeds the max length. */ export declare const TRUNCATION_MARKER = "\n\u2026[truncated]"; /** * Sanitize a stringified error (typically `err.stack`) before it's * written to a wire-visible diagnostic slot (e.g. the `channel_error` * frame's `details`). * * Applies every pattern in {@link DEFAULT_CREDENTIAL_PATTERNS} in order, * replacing matches with `[REDACTED]`. If the result exceeds `maxLength`, * the tail is replaced with {@link TRUNCATION_MARKER}. * * The function is pure and deterministic — the same `raw` produces the * same output across runs. Safe to call in hot paths; patterns are * pre-compiled module-level regexes. * * @param raw - The stringified error (usually `err.stack`). * @param maxLength - Maximum length of returned string. Default 2048. * @param patterns - Override the default credential-pattern set. Useful * for tests or operators who want stricter behavior. Passing an empty * array disables pattern replacement (truncation still applies). */ export declare function sanitizeCausedBy(raw: string, maxLength?: number, patterns?: readonly RegExp[]): string; /** * Signature of a `causedBy` sanitizer hook. Receives the raw * stringified error (typically `err.stack`) and MUST return a * safe-to-emit string. * * {@link sanitizeCausedBy} is the canonical implementation. A * pass-through function that returns `raw` unchanged is valid but * discouraged — it re-enables the leak this module was added to close. */ export type SanitizeCausedBy = (raw: string) => string; //# sourceMappingURL=sanitize-error.d.ts.map