/** * Node credential provider — wraps the local project-key cache + allowance-auth. * Reads `credentials/project-keys.v1.json` (or an explicit `keystorePath`), * signs SIWX headers from the allowance private key, and serves project * anon/service keys from disk only for operations classified as credential- * required. */ import type { AllowanceData, AuthRequestMeta, CredentialsProvider, ProjectKeys, WalletIdentity } from "../credentials.js"; import { DELEGATE_CREDENTIALS } from "../delegate-credentials.js"; /** Where credential resolution runs — selects the default `authMode`. */ export type CredentialSurface = "cli" | "mcp" | "sdk"; /** How a request's credentials are chosen. `auto` = wallet, else operator (control-plane) session. */ export type AuthMode = "auto" | "wallet" | "operator" | "delegate" | "none"; export interface NodeCredentialsOptions { allowancePath?: string; /** Local project-key credential cache path. Defaults to credentials/project-keys.v1.json. */ keystorePath?: string; /** Non-secret profile state path for active project pointers. Defaults to state.json. */ profileStatePath?: string; /** Default is `wallet` (no ambient operator authority); `cli` opts into `auto`. */ surface?: CredentialSurface; /** Explicit override; otherwise derived from `surface`. */ authMode?: AuthMode; /** * A delegate bearer (gateway `run402_agent_key`). When present — here or in * `RUN402_DELEGATE_TOKEN` — it is the credential class for every request and * nothing else is consulted. See `../delegate-credentials.ts`. */ delegateToken?: string; } export declare class NodeCredentialsProvider implements CredentialsProvider { private readonly options; constructor(options?: NodeCredentialsOptions); /** * Marks this provider as delegate-backed so apikey-attaching helpers stand * down (identical treatment to a CI session — the bearer already authorizes * the apikey-gated CAS routes, and mixing the two families on one request is * exactly what the kernel's credential-atomicity rule forbids). */ get [DELEGATE_CREDENTIALS](): boolean; /** Explicit option wins over the environment; blank env values are ignored. */ private resolveDelegateToken; /** Effective credential mode. Explicit `authMode` wins; else `cli → auto`, everything else → `wallet`. */ private resolveAuthMode; /** * Deterministic credential resolution — selects exactly one credential class * and never silently falls back to another after a failure. * * - `wallet` (default; the MCP/agent path): only the SIWX allowance. NEVER * reads the control-plane session or operator-approval caches, so a human's * ambient authority cannot leak into an agent tool call. * - `auto` (CLI): SIWX allowance if present; otherwise the live control-plane * session, plus an `X-Run402-Write-Auth` approval ONLY when the request's * `(capability, target)` exactly matches a cached, origin/session-bound * approval. A gated write with no match is sent cp-bearer-only and fails * closed with `WRITE_AUTH_REQUIRED`. */ getAuth(path: string, metadata?: AuthRequestMeta): Promise | null>; /** API origin used to bind/look-up approvals (matches the ceremony's mint origin). */ private apiOrigin; getProjectCredentials(id: string): Promise; listProjectCredentials(): Promise>; getProject(id: string): Promise; saveProject(id: string, project: ProjectKeys): Promise; updateProject(id: string, patch: Partial): Promise; removeProject(id: string): Promise; setActiveProject(id: string): Promise; getActiveProject(): Promise; /** * The profile's current organization (`run402 org use`). The CLI's * org-context resolver writes and reads it per profile WITHOUT a principal * (the "unknown" bucket), so that bucket is the authoritative one; the * principal-scoped bucket is consulted first only so a provider that wrote * it scoped like the active project is honoured too. */ getActiveOrg(): Promise; readAllowance(): Promise; signPersonalMessage(message: string): Promise<{ address: string; signature: string; }>; saveAllowance(data: AllowanceData): Promise; createAllowance(): Promise; getAllowancePath(): string; getProjectCredentialCacheInfo(): { source: "local_cache"; cache_path: string; wallet: string; profile: string; }; getProfileStatePath(): string; private activeScope; getWalletIdentity(): Promise; } //# sourceMappingURL=credentials.d.ts.map