/**
 * Node credential provider — wraps the local project-key cache + SIWX auth.
 * Reads `credentials/project-keys.v1.json` (or an explicit `keystorePath`),
 * signs SIWX headers from the wallet private key, and serves project
 * anon/service keys from disk only for operations classified as credential-
 * required.
 */
import type { WalletData, AuthRequestMeta, CredentialsProvider, ProjectKeys, WalletIdentity } from "../credentials.js";
import { GRANT_KEY_CREDENTIALS } from "../grant-key-credentials.js";
/**
 * Where credential resolution runs — selects the default `authMode`.
 * `sandbox` is an MCP `run` snippet: wallet-only credentials like `mcp`, and
 * the client additionally refuses methods that would return a one-time
 * secret (`capabilities.returnSecrets: false`).
 */
export type CredentialSurface = "cli" | "mcp" | "sdk" | "sandbox";
/** How a request's credentials are chosen. `auto` = wallet, else the sign-in session. */
export type AuthMode = "auto" | "wallet" | "session" | "grant_key" | "none";
export interface NodeCredentialsOptions {
    walletPath?: 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 sign-in session authority); `cli` opts into `auto`; `mcp` and `sandbox` stay `wallet`. */
    surface?: CredentialSurface;
    /** Explicit override; otherwise derived from `surface`. */
    authMode?: AuthMode;
    /**
     * A grant-key bearer (kind `run402_agent_key`). When present — here or in
     * `RUN402_GRANT_KEY` — it is the credential class for every request and
     * nothing else is consulted. See `../grant-key-credentials.ts`.
     */
    grantKey?: string;
}
export declare class NodeCredentialsProvider implements CredentialsProvider {
    private readonly options;
    constructor(options?: NodeCredentialsOptions);
    /**
     * Marks this provider as grant-key-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 [GRANT_KEY_CREDENTIALS](): boolean;
    /** Explicit option wins over the environment; blank env values are ignored. */
    private resolveGrantKey;
    /** 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, sandbox, and agent path): only the SIWX wallet. NEVER
     *   reads the sign-in session or write-approval caches, so a person's
     *   ambient authority cannot leak into an agent tool call.
     * - `auto` (CLI): SIWX wallet if present; otherwise the live control-plane
     *   sign-in session, plus an `X-Run402-Write-Approval` 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_APPROVAL_REQUIRED`.
     * - `session`: only the sign-in session (plus a matching write approval).
     */
    getAuth(path: string, metadata?: AuthRequestMeta): Promise<Record<string, string> | null>;
    /** API origin used to bind/look-up approvals (matches the ceremony's mint origin). */
    private apiOrigin;
    getProjectCredentials(id: string): Promise<ProjectKeys | null>;
    listProjectCredentials(): Promise<Record<string, ProjectKeys>>;
    getProject(id: string): Promise<ProjectKeys | null>;
    saveProject(id: string, project: ProjectKeys): Promise<void>;
    updateProject(id: string, patch: Partial<ProjectKeys>): Promise<void>;
    removeProject(id: string): Promise<void>;
    setActiveProject(id: string): Promise<void>;
    getActiveProject(): Promise<string | null>;
    /**
     * The profile's current organization (`run402 orgs 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<string | null>;
    readWallet(): Promise<WalletData | null>;
    signPersonalMessage(message: string): Promise<{
        address: string;
        signature: string;
    }>;
    saveWallet(data: WalletData): Promise<void>;
    createWallet(): Promise<WalletData>;
    getWalletPath(): string;
    getProjectCredentialCacheInfo(): {
        source: "local_cache";
        cache_path: string;
        wallet: string;
        profile: string;
    };
    getProfileStatePath(): string;
    private activeScope;
    getWalletIdentity(): Promise<WalletIdentity | null>;
}
//# sourceMappingURL=credentials.d.ts.map