@vapi-network/core 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,21 +48,86 @@ declare const keystoreSchema: z.ZodObject<{
48
48
  }, z.core.$strip>;
49
49
  }, z.core.$strip>;
50
50
  }, z.core.$strip>;
51
+ declare const keystoreV3Schema: z.ZodObject<{
52
+ version: z.ZodLiteral<3>;
53
+ address: z.ZodString;
54
+ keys: z.ZodObject<{
55
+ evm: z.ZodObject<{
56
+ type: z.ZodLiteral<"secp256k1">;
57
+ address: z.ZodString;
58
+ path: z.ZodString;
59
+ }, z.core.$strip>;
60
+ solana: z.ZodOptional<z.ZodObject<{
61
+ type: z.ZodLiteral<"ed25519">;
62
+ address: z.ZodString;
63
+ path: z.ZodString;
64
+ }, z.core.$strip>>;
65
+ }, z.core.$strip>;
66
+ crypto: z.ZodObject<{
67
+ cipher: z.ZodLiteral<"aes-256-gcm">;
68
+ ciphertext: z.ZodString;
69
+ iv: z.ZodString;
70
+ authTag: z.ZodString;
71
+ kdf: z.ZodLiteral<"scrypt">;
72
+ salt: z.ZodString;
73
+ kdfParams: z.ZodObject<{
74
+ n: z.ZodLiteral<number>;
75
+ r: z.ZodLiteral<8>;
76
+ p: z.ZodLiteral<1>;
77
+ dkLen: z.ZodLiteral<32>;
78
+ }, z.core.$strip>;
79
+ }, z.core.$strip>;
80
+ }, z.core.$strip>;
51
81
  export type VapiKeystore = z.infer<typeof keystoreSchema>;
82
+ /** Keystore version 3: one BIP-39 recovery phrase behind both accounts. */
83
+ export type VapiKeystoreV3 = z.infer<typeof keystoreV3Schema>;
52
84
  export type LegacyVapiKeystore = z.infer<typeof legacyKeystoreSchema>;
53
85
  /** @deprecated Use VapiKeystore. */
54
86
  export type AgentCashKeystore = VapiKeystore;
55
87
  export type VapiPaymentAccount = ReturnType<typeof privateKeyToAccount> & {
56
88
  readonly solana?: KeyPairSigner;
57
89
  };
90
+ export type CreateKeystoreOptions = {
91
+ enableSolana?: boolean;
92
+ /** Restore an existing wallet instead of generating a new phrase. */
93
+ phrase?: string;
94
+ };
58
95
  export declare class KeystoreError extends Error {
59
96
  constructor(message: string, options?: ErrorOptions);
60
97
  }
61
98
  export declare function encryptPrivateKey(privateKey: Hex, passphrase: string): Promise<VapiKeystore>;
62
- export declare function decryptPrivateKey(keystore: VapiKeystore, passphrase: string): Promise<Hex>;
63
- export declare function createKeystore(passphrase: string, path?: string, options?: {
64
- enableSolana?: boolean;
99
+ /** Published only through `@vapi-network/core/secrets`. */
100
+ export declare function decryptPrivateKey(keystore: VapiKeystore | VapiKeystoreV3, passphrase: string): Promise<Hex>;
101
+ /**
102
+ * Creates a version 3 keystore: both accounts come from one BIP-39 recovery
103
+ * phrase, so the wallet can be restored in MetaMask, Rabby or Phantom from the
104
+ * words alone. The phrase is returned once and never written anywhere.
105
+ *
106
+ * Published only through `@vapi-network/core/secrets`.
107
+ */
108
+ export declare function createKeystoreWithPhrase(passphrase: string, path?: string, options?: CreateKeystoreOptions): Promise<{
109
+ account: VapiPaymentAccount;
110
+ recoveryPhrase: string;
111
+ }>;
112
+ /**
113
+ * Wraps a private key the user already holds in a version 2 keystore, for
114
+ * `vapi import --key`. Such a wallet has no recovery phrase, so `vapi backup`
115
+ * keeps pointing at `vapi export-key` for it.
116
+ */
117
+ export declare function createKeystoreFromPrivateKey(passphrase: string, path: string | undefined, options: {
118
+ privateKey: string;
65
119
  }): Promise<VapiPaymentAccount>;
120
+ /** The shape every wallet import accepts: 0x and 32 bytes of hexadecimal. */
121
+ export declare function validatePrivateKey(value: string): Hex;
122
+ /**
123
+ * Re-seals the keystore under a new passphrase: fresh salt and IV, the same
124
+ * keys, the same addresses, and the same atomic write as every other keystore
125
+ * change. A version 1 file becomes version 2, the upgrade `unlockKeystore`
126
+ * already performs.
127
+ */
128
+ export declare function changeKeystorePassphrase(oldPassphrase: string, newPassphrase: string, path?: string): Promise<VapiPaymentAccount>;
129
+ /** `createKeystoreWithPhrase` for callers that do not show the phrase. */
130
+ export declare function createKeystore(passphrase: string, path?: string, options?: CreateKeystoreOptions): Promise<VapiPaymentAccount>;
66
131
  export declare function unlockKeystore(passphrase: string, path?: string): Promise<VapiPaymentAccount>;
67
132
  /**
68
133
  * The stored address, read without the passphrase. Only the encrypted key
@@ -70,6 +135,12 @@ export declare function unlockKeystore(passphrase: string, path?: string): Promi
70
135
  * to replace. Returns undefined for a missing or unreadable keystore.
71
136
  */
72
137
  export declare function readKeystoreAddress(path?: string): Promise<string | undefined>;
138
+ /**
139
+ * The stored format version, read without the passphrase, so a command can say
140
+ * why a version 1 or 2 wallet has no recovery phrase. Undefined for a missing
141
+ * or unreadable keystore.
142
+ */
143
+ export declare function readKeystoreVersion(path?: string): Promise<number | undefined>;
73
144
  export type ExportedVapiKeys = {
74
145
  evm: {
75
146
  address: string;
@@ -85,12 +156,31 @@ export type ExportedVapiKeys = {
85
156
  * for the EVM key, and the base58 64-byte Ed25519 secret key for Solana. Only
86
157
  * `vapi export-key` may call this, and it must never write the result anywhere
87
158
  * but the caller's stdout.
159
+ *
160
+ * Published only through `@vapi-network/core/secrets`.
88
161
  */
89
162
  export declare function exportKeystoreKeys(passphrase: string, path?: string): Promise<ExportedVapiKeys>;
90
- /** Lazily adds a locally generated Ed25519 seed without replacing the EVM key. */
163
+ /**
164
+ * Adds the Solana account. A version 3 wallet derives it from the recovery
165
+ * phrase it already has; older files get a locally generated Ed25519 seed,
166
+ * which the EVM key never replaces.
167
+ */
91
168
  export declare function enableSolanaKey(passphrase: string, path?: string): Promise<VapiPaymentAccount>;
169
+ /**
170
+ * The 12 or 24 words behind a version 3 wallet, for `vapi backup`. Callers must
171
+ * print it to the user and nowhere else. Older keystores have no phrase.
172
+ *
173
+ * Published only through `@vapi-network/core/secrets`.
174
+ */
175
+ export declare function exportRecoveryPhrase(passphrase: string, path?: string): Promise<string>;
92
176
  export declare function getKeystorePassphrase(options?: {
93
177
  confirm?: boolean;
94
178
  }): Promise<string>;
179
+ /**
180
+ * Reads one line from the terminal without echoing it, for passphrases,
181
+ * recovery phrases, and private keys. The prompt goes to stderr so stdout stays
182
+ * a clean channel, and the secret never reaches the terminal's scrollback.
183
+ */
184
+ export declare function promptForSecret(prompt: string, noTerminalHint?: string): Promise<string>;
95
185
  export {};
96
186
  //# sourceMappingURL=keystore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keystore.d.ts","sourceRoot":"","sources":["../src/keystore.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAsB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AA0BhC,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;iBAIxB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBlB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC1D,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACtE,oCAAoC;AACpC,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,GAAG;IACxE,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC;AAaF,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAyBD,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,GAAG,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,CAAC,CAEvB;AA6CD,wBAAsB,iBAAiB,CAA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MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,IAAI,SAA0B,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,IAAI,SAA0B,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA0B7B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,IAAI,SAA0B,GAC7B,OAAO,CAAC,MAAM,CAAC,CAajB;AA8DD,wBAAsB,qBAAqB,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB5F;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA6C9F"}
package/dist/onramp.d.ts CHANGED
@@ -1,36 +1,20 @@
1
- import { type LookupFn } from "./net-guard.js";
2
1
  /** Onramp deposits land on Base, the only network the hosted onramp settles to. */
3
2
  export declare const ONRAMP_NETWORK = "base";
4
- export declare const ONRAMP_ASSET = "USDC";
5
- /** Printed whenever the hosted onramp cannot be used; funding stays possible. */
3
+ /** Printed alongside the funding page, so funding never depends on a browser. */
6
4
  export declare const ONRAMP_FALLBACK_INSTRUCTIONS = "Send USDC on Base (eip155:8453) to this address; add a little ETH for gas if you plan to sweep.";
7
- export type CreateOnrampSessionOptions = {
8
- address: string;
9
- /** Requested fiat amount in USD. Omitted when the caller has no preference. */
10
- fiatAmount?: number;
11
- registryUrl?: string;
12
- env?: NodeJS.ProcessEnv;
13
- fetchImpl?: typeof fetch;
14
- allowPrivateNetwork?: boolean;
15
- lookup?: LookupFn;
16
- };
17
- export type OnrampSession = {
18
- status: "ready";
19
- address: string;
20
- url: string;
21
- } | {
22
- status: "unavailable";
23
- address: string;
24
- reason: string;
25
- instructions: string;
5
+ export type FundingPageOptions = {
6
+ /** Fiat amount in USD to prefill on the page. Omitted when the caller has no preference. */
7
+ amount?: number;
26
8
  };
9
+ /** The registry this install talks to: the env override first, then the shipped default. */
10
+ export declare function resolveRegistryUrl(env?: NodeJS.ProcessEnv): string;
27
11
  /**
28
- * Ask the registry for a hosted onramp session for one local address.
12
+ * Build the URL of the hosted funding page for one local address.
29
13
  *
30
- * vAPI never holds funds: the session is created by the registry with the
31
- * onramp provider, and the user pays the provider directly. Every failure mode
32
- * degrades to direct-transfer instructions instead of throwing, so funding
33
- * advice is always available.
14
+ * The page is public — no sign-in — and mints the card-payment session at click
15
+ * time, so the link never goes stale in a terminal scrollback or an agent
16
+ * transcript. It also offers a wallet transfer and a bridge, which is why this
17
+ * is the only funding link the client hands out. Pure: no network, no clock.
34
18
  */
35
- export declare function createOnrampSession(options: CreateOnrampSessionOptions): Promise<OnrampSession>;
19
+ export declare function fundingPageUrl(registryUrl: string, address: string, options?: FundingPageOptions): string;
36
20
  //# sourceMappingURL=onramp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"onramp.d.ts","sourceRoot":"","sources":["../src/onramp.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAGlE,mFAAmF;AACnF,eAAO,MAAM,cAAc,SAAS,CAAC;AACrC,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,oGAC0D,CAAC;AAEpG,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,QAAQ,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,aAAa,CAAC,CAgDxB"}
1
+ {"version":3,"file":"onramp.d.ts","sourceRoot":"","sources":["../src/onramp.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,iFAAiF;AACjF,eAAO,MAAM,4BAA4B,oGAC0D,CAAC;AAKpG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAE/E;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAWR"}
@@ -0,0 +1,47 @@
1
+ import { type SecretStore } from "./secret-store.js";
2
+ /**
3
+ * Where the passphrase of a wallet comes from, in one place.
4
+ *
5
+ * The order is `VAPI_KEYSTORE_PASSWORD`, then the OS secret store, then a
6
+ * prompt on a real terminal. The environment variable stays first so CI keeps
7
+ * working; the secret store is what lets an editor's MCP configuration hold no
8
+ * secret at all; the prompt is for a person, and a run with no terminal says
9
+ * how to arrange one of the other two instead.
10
+ */
11
+ export declare const PASSPHRASE_ENVIRONMENT_VARIABLE = "VAPI_KEYSTORE_PASSWORD";
12
+ /** Which of the three routes actually produced the passphrase. */
13
+ export type PassphraseSource = "environment" | "secret-store" | "prompt";
14
+ export type ResolvedPassphrase = {
15
+ passphrase: string;
16
+ source: PassphraseSource;
17
+ };
18
+ export type ResolvePassphraseOptions = {
19
+ /** The environment to read `VAPI_KEYSTORE_PASSWORD` from. */
20
+ env?: NodeJS.ProcessEnv | undefined;
21
+ /** The OS secret store to consult. Defaults to this platform's. */
22
+ store?: SecretStore | undefined;
23
+ /** Reads one line without echoing it. Defaults to the terminal prompt. */
24
+ prompt?: ((prompt: string, noTerminalHint?: string) => Promise<string>) | undefined;
25
+ /** False when nobody is watching, so the prompt is refused before it starts. */
26
+ interactive?: boolean | undefined;
27
+ /**
28
+ * Ask twice. A passphrase that is being set rather than used never comes
29
+ * from the secret store, so this also skips it.
30
+ */
31
+ confirm?: boolean | undefined;
32
+ };
33
+ /** The two ways out of a run that cannot prompt, named for the wallet at hand. */
34
+ export declare function noPassphraseHint(walletName: string): string;
35
+ /**
36
+ * The message for a stored passphrase that no longer opens its wallet — the
37
+ * shape of a passphrase changed on one machine while another kept the old one.
38
+ */
39
+ export declare function staleStoredPassphraseMessage(walletName: string, store: SecretStore): string;
40
+ /**
41
+ * The passphrase for one wallet: environment, then secret store, then prompt.
42
+ * A secret store that cannot be reached — no keyring installed, a locked
43
+ * session — is not fatal here; the prompt, or the error that names both other
44
+ * routes, is the better answer than a failure a person cannot act on.
45
+ */
46
+ export declare function resolvePassphrase(walletName: string, options?: ResolvePassphraseOptions): Promise<ResolvedPassphrase>;
47
+ //# sourceMappingURL=passphrase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passphrase.d.ts","sourceRoot":"","sources":["../src/passphrase.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElE;;;;;;;;GAQG;AAEH,eAAO,MAAM,+BAA+B,2BAA2B,CAAC;AAExE,kEAAkE;AAClE,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEzE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;IACpC,mEAAmE;IACnE,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,0EAA0E;IAC1E,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACpF,gFAAgF;IAChF,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAK3F;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,kBAAkB,CAAC,CA+B7B"}
package/dist/policy.d.ts CHANGED
@@ -11,12 +11,18 @@ export type PaymentIntent = Readonly<{
11
11
  export interface Policy {
12
12
  authorize(intent: PaymentIntent): Promise<void>;
13
13
  }
14
+ /**
15
+ * Caps one wallet's spending. The caps belong to the wallet, not to the
16
+ * machine: pass the wallet's name so today's total is counted against that
17
+ * wallet alone.
18
+ */
14
19
  export declare class SpendPolicy implements Policy {
15
20
  readonly caps: SpendCaps;
16
21
  private readonly options;
17
22
  constructor(caps: SpendCaps, options?: {
18
23
  ledgerPath?: string;
19
24
  now?: () => Date;
25
+ wallet?: string;
20
26
  });
21
27
  authorize(intent: PaymentIntent): Promise<void>;
22
28
  reserve(amountAtomic: bigint): Promise<SpendLedger>;
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,qBAAa,WAAY,YAAW,MAAM;aAEtB,IAAI,EAAE,SAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADR,IAAI,EAAE,SAAS,EACd,OAAO,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;IAGpE,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAM1D"}
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH,4EAA4E;AAC5E,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED;;;;GAIG;AACH,qBAAa,WAAY,YAAW,MAAM;aAEtB,IAAI,EAAE,SAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADR,IAAI,EAAE,SAAS,EACd,OAAO,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAGrF,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAO1D"}
@@ -1,8 +1,11 @@
1
1
  import type { ListingProvenance } from "./discovery.js";
2
+ import { type WalletName } from "./wallet-name.js";
2
3
  import type { X402SettlementOutcome } from "./x402.js";
3
4
  export interface Receipt {
4
5
  readonly id: string;
5
6
  readonly timestamp: string;
7
+ /** The wallet that paid. Absent on receipts written before named wallets, which belong to `main`. */
8
+ readonly wallet?: string;
6
9
  readonly resourceUrl: string;
7
10
  readonly method?: string;
8
11
  /** Primary discovery source retained for compatibility with early receipt writers. */
@@ -50,11 +53,26 @@ export interface Receipt {
50
53
  readonly outcome?: "paid" | "signed_in" | "declined_policy" | "failed_request" | "settlement_rejected" | "settlement_unknown";
51
54
  }
52
55
  export declare function parseReceipt(value: unknown): Receipt;
53
- /** Append exactly one receipt as one JSONL record. Existing records are never rewritten. */
54
- export declare function appendReceipt(receipt: Receipt, path?: string): Promise<Receipt>;
56
+ /**
57
+ * Append exactly one receipt as one JSONL record. Existing records are never
58
+ * rewritten. `options.wallet` names the wallet that paid when the receipt does
59
+ * not already carry one.
60
+ */
61
+ export declare function appendReceipt(receipt: Receipt, path?: string, options?: {
62
+ wallet?: string;
63
+ }): Promise<Receipt>;
55
64
  export declare function readReceipts(path?: string, options?: {
56
65
  limit?: number;
66
+ wallet?: string;
57
67
  }): Promise<Receipt[]>;
58
- /** Compatibility alias used by early CLI code. */
59
- export declare const listReceipts: typeof readReceipts;
68
+ /** The wallet a receipt belongs to; rows written before named wallets are `main`. */
69
+ export declare function receiptWallet(receipt: Receipt): WalletName;
70
+ /** Keeps the receipts of one wallet, counting rows without a wallet as `main`. */
71
+ export declare function filterReceiptsByWallet(receipts: readonly Receipt[], name: WalletName): Receipt[];
72
+ /**
73
+ * Rewrites the wallet field of every matching row after a wallet is renamed.
74
+ * Rows of other wallets keep their exact bytes, and the file is replaced in one
75
+ * atomic rename. Returns how many rows changed.
76
+ */
77
+ export declare function renameReceiptWallet(from: WalletName, to: WalletName, path?: string): Promise<number>;
60
78
  //# sourceMappingURL=receipts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"receipts.d.ts","sourceRoot":"","sources":["../src/receipts.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SA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AmB,CACvC,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,UAAU,EACd,IAAI,SAA0B,GAC7B,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The OS secret store, so an agent never needs a passphrase in plain text.
3
+ *
4
+ * A wallet's passphrase is kept by the operating system's own credential
5
+ * store — the macOS Keychain, or libsecret on Linux — under the service
6
+ * `vapi-network` and the wallet's name as the account. `vapi unlock` puts it
7
+ * there, `vapi lock` takes it out, and every unlock path reads it from there
8
+ * before falling back to a prompt.
9
+ *
10
+ * There is no dependency: the store is driven through the OS binaries with
11
+ * `execFile` and an argument array, never a shell string, so nothing a wallet
12
+ * name or a passphrase contains can be read as a command. The passphrase
13
+ * itself is written to the binary's stdin and never appears in an argument,
14
+ * where `ps` would show it to every process on the machine.
15
+ */
16
+ /** The service name every vAPI entry is filed under. */
17
+ export declare const SECRET_STORE_SERVICE = "vapi-network";
18
+ /** What one run of an OS binary produced. A runner never throws for a non-zero exit. */
19
+ export type SecretStoreOutcome = {
20
+ /** The exit code, or null when the binary could not be run at all. */
21
+ code: number | null;
22
+ stdout: string;
23
+ stderr: string;
24
+ /** The binary is not installed on this machine. */
25
+ notFound?: boolean;
26
+ };
27
+ /**
28
+ * Runs one OS binary. Injected by the tests, which assert the command line
29
+ * rather than touching a real keychain.
30
+ */
31
+ export type SecretStoreRunner = (file: string, args: readonly string[], input?: string) => Promise<SecretStoreOutcome>;
32
+ export type SecretStore = {
33
+ /** Whether this platform has a store vAPI can drive at all. */
34
+ available: boolean;
35
+ platform: NodeJS.Platform;
36
+ /** How to name this store to a person, such as "the macOS Keychain". */
37
+ description: string;
38
+ /** The stored passphrase of a wallet, or undefined when there is none. */
39
+ get(name: string): Promise<string | undefined>;
40
+ /** Whether a wallet has a stored passphrase, without reading the secret. */
41
+ has(name: string): Promise<boolean>;
42
+ set(name: string, passphrase: string): Promise<void>;
43
+ /** Removes the entry; false when there was nothing to remove. */
44
+ remove(name: string): Promise<boolean>;
45
+ /**
46
+ * The wallet names this store holds, where the platform can answer it
47
+ * without handing back the secrets themselves. Neither platform can today,
48
+ * so callers list the wallets they know and ask `has` about each.
49
+ */
50
+ list?(): Promise<string[]>;
51
+ };
52
+ export type SecretStoreOptions = {
53
+ /** Defaults to `process.platform`. */
54
+ platform?: NodeJS.Platform | undefined;
55
+ /** Defaults to running the real binary. */
56
+ run?: SecretStoreRunner | undefined;
57
+ };
58
+ /** The secret store of this machine, or one that refuses on every call. */
59
+ export declare function secretStore(options?: SecretStoreOptions): SecretStore;
60
+ //# sourceMappingURL=secret-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-store.d.ts","sourceRoot":"","sources":["../src/secret-store.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,wDAAwD;AACxD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AAgBnD,wFAAwF;AACxF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sEAAsE;IACtE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,KAAK,CAAC,EAAE,MAAM,KACX,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG;IACxB,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,4EAA4E;IAC5E,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC;;;;OAIG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC;IACvC,2CAA2C;IAC3C,GAAG,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CACrC,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,WAAW,CAMzE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@vapi-network/core/secrets` — the human-only corner of the SDK.
3
+ *
4
+ * Everything here returns a recovery phrase or a private key. It is a separate
5
+ * package entry point, and deliberately not re-exported from the main index,
6
+ * so that a package which must never hold a secret — the MCP server above all —
7
+ * cannot reach one by importing `@vapi-network/core`. The repository lint rules
8
+ * enforce that for `packages/mcp`.
9
+ *
10
+ * Callers must print the result to the person in front of the terminal and
11
+ * nowhere else: not to a log, not to a file, not into a tool result.
12
+ */
13
+ export { createKeystoreWithPhrase, decryptPrivateKey, exportKeystoreKeys, exportRecoveryPhrase, type ExportedVapiKeys, } from "./keystore.js";
14
+ //# sourceMappingURL=secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC"}