run402-mcp
Version:
MCP server for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.
62 lines • 2.98 kB
TypeScript
/**
* Named-wallet profile storage.
*
* A "wallet" is a whole config directory. The reserved `default` wallet lives
* at the base config dir (zero migration for existing installs); every named
* wallet lives under `{base}/profiles/<name>/` with its own `wallet.json`,
* `projects.json`, and this module's non-secret `meta.json`.
*
* Two levels of active state, mirroring the wallet → project model:
* - base `{base}/config.json` `active_wallet` — which wallet is the default
* - per-wallet `projects.json` `active_project_id` — which project within it
*
* All writes are atomic (temp-file + rename) and owner-only (0600 files,
* 0700 dirs). `meta.json` holds only public/display data (no private key), so
* listing and name display never need to load key material.
*/
export interface BaseConfig {
active_wallet?: string;
}
export interface ProfileMeta {
name: string;
address?: string;
/** Cached server-side display label; null when unknown/unset. */
label?: string | null;
rail?: "x402" | "mpp";
created?: string;
/** How the wallet signs: a local key, or a signer reference (an AWS KMS key). Absent means local. */
signer?: "local" | "aws_kms";
}
export declare function readBaseConfig(): BaseConfig;
export declare function writeBaseConfig(cfg: BaseConfig): void;
/**
* The globally-selected default wallet (set via `wallets use`), or the
* reserved `default` when unset/invalid. This is precedence rung 4 — below the
* flag, env var, and per-directory binding.
*/
export declare function getDefaultWallet(): string;
export declare function setDefaultWallet(name: string): void;
/** Absolute directory for a wallet. `default` → base dir; named → profiles/<name>. */
export declare function profileDir(name: string): string;
/** Create (if needed) a wallet's directory with owner-only (0700) perms. */
export declare function ensureProfileDir(name: string): string;
export declare function readMeta(name: string): ProfileMeta | null;
export declare function writeMeta(name: string, meta: ProfileMeta): void;
/** True when a wallet's `wallet.json` exists on disk. */
export declare function profileExists(name: string): boolean;
/**
* All wallet names on disk: `default` (only if a root wallet.json exists)
* plus every valid directory under `profiles/`.
*/
export declare function listProfileNames(): string[];
/** Delete a named wallet's directory. Refuses to remove the reserved default. */
export declare function removeProfile(name: string): void;
/**
* Move a wallet to a new name. Renaming `default` migrates the root-level
* credential files into `profiles/<newName>/` (so a named wallet is always a
* directory). Does NOT update the `active_wallet` pointer — the caller owns
* that orchestration. Throws if the destination already exists or the source
* is missing.
*/
export declare function renameProfile(oldName: string, newName: string): void;
//# sourceMappingURL=profiles.d.ts.map