/** * Upstream secrets for MCP servers (DES-MCP-TOOLS-001 ยง5, D-2). Secrets stay in the broker. * * - The registry stores a REFERENCE only: `keychain:wicked-mcp/` (the OS keychain, written * by `PUT /mcp/servers/:name/secret`) or `env:` (a variable of the daemon's own env). * - A value is resolved only at the moment crew itself talks to the upstream (a probe here; the * broker's call path later), injected into that upstream's env or header, and scrubbed out of * whatever comes back (`scrubSecrets`). No route answers it and nothing logs or writes it. * - macOS writes through `security -i`, with the command on STDIN, so the value is never in an * argv that another process of the same user (a worker) could read with `ps`. Linux uses * `secret-tool store`, which reads the value from stdin. Other platforms have no store: the * secret route answers 501, and `env:` references still work. */ export declare const KEYCHAIN_SERVICE = "wicked-mcp"; /** What replaces a secret value anywhere it would have left the broker. */ export declare const SECRET_REDACTION = "[redacted:secret]"; export type SecretRef = { kind: 'keychain'; account: string; } | { kind: 'env'; name: string; }; export declare function keychainRef(account: string): string; /** Parse a stored reference; `null` = not a reference this broker understands. */ export declare function parseSecretRef(ref: string): SecretRef | null; /** The OS secret store, behind a seam so tests never touch a real keychain. */ export interface SecretStore { /** `false` = this platform has no store; the secret route answers 501. */ readonly available: boolean; get(account: string): Promise; has(account: string): Promise; set(account: string, value: string): Promise; delete(account: string): Promise; } export declare class SecretStoreError extends Error { } /** Resolve a reference to its value, or `null` when it is unset. Never logs the value. */ export declare function resolveSecret(ref: string, store: SecretStore, env?: NodeJS.ProcessEnv): Promise; /** Whether a reference resolves to a value, without reading the value where the store allows. */ export declare function secretIsSet(ref: string, store: SecretStore, env?: NodeJS.ProcessEnv): Promise; /** * Replace every exact occurrence of each secret in every string of `value` (object keys included). * Pure: `value` is not mutated. Empty secrets are ignored; longer secrets are replaced first, so a * secret that contains another is never left half-exposed. */ export declare function scrubSecrets(value: T, secrets: ReadonlyArray): T; /** macOS login keychain through `/usr/bin/security`; writes go through `-i` on stdin. */ export declare class MacKeychainStore implements SecretStore { readonly available = true; get(account: string): Promise; has(account: string): Promise; set(account: string, value: string): Promise; delete(account: string): Promise; } /** Linux Secret Service through `secret-tool` (libsecret); the value goes over stdin. */ export declare class SecretToolStore implements SecretStore { readonly available = true; private attrs; get(account: string): Promise; has(account: string): Promise; set(account: string, value: string): Promise; delete(account: string): Promise; } export declare function platformSecretStore(platform?: NodeJS.Platform): SecretStore; //# sourceMappingURL=secrets.d.ts.map