@cef-ai/vault-sdk 1.3.1 → 3.0.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.
Files changed (66) hide show
  1. package/README.md +31 -22
  2. package/dist/agreements/manifest-fields.d.ts +2 -3
  3. package/dist/agreements/manifest-fields.d.ts.map +1 -1
  4. package/dist/agreements/manifest-fields.js +4 -4
  5. package/dist/agreements/manifest-fields.js.map +1 -1
  6. package/dist/agreements/sign.d.ts +13 -6
  7. package/dist/agreements/sign.d.ts.map +1 -1
  8. package/dist/agreements/sign.js +8 -10
  9. package/dist/agreements/sign.js.map +1 -1
  10. package/dist/auth/assert-scheme.d.ts +8 -0
  11. package/dist/auth/assert-scheme.d.ts.map +1 -0
  12. package/dist/auth/assert-scheme.js +15 -0
  13. package/dist/auth/assert-scheme.js.map +1 -0
  14. package/dist/auth/wallet.d.ts +10 -4
  15. package/dist/auth/wallet.d.ts.map +1 -1
  16. package/dist/auth/wallet.js +14 -8
  17. package/dist/auth/wallet.js.map +1 -1
  18. package/dist/client.d.ts +26 -5
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +77 -21
  21. package/dist/client.js.map +1 -1
  22. package/dist/core/endpoints.d.ts +1 -0
  23. package/dist/core/endpoints.d.ts.map +1 -1
  24. package/dist/core/endpoints.js +1 -0
  25. package/dist/core/endpoints.js.map +1 -1
  26. package/dist/core/errors.d.ts.map +1 -1
  27. package/dist/core/errors.js +4 -1
  28. package/dist/core/errors.js.map +1 -1
  29. package/dist/core/types.d.ts +12 -4
  30. package/dist/core/types.d.ts.map +1 -1
  31. package/dist/fluent/vault.d.ts +21 -8
  32. package/dist/fluent/vault.d.ts.map +1 -1
  33. package/dist/fluent/vault.js +31 -13
  34. package/dist/fluent/vault.js.map +1 -1
  35. package/dist/index.d.ts +9 -6
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +12 -2
  38. package/dist/index.js.map +1 -1
  39. package/dist/internal/agents.d.ts +5 -3
  40. package/dist/internal/agents.d.ts.map +1 -1
  41. package/dist/internal/agents.js +5 -3
  42. package/dist/internal/agents.js.map +1 -1
  43. package/dist/internal/marketplace.d.ts +35 -9
  44. package/dist/internal/marketplace.d.ts.map +1 -1
  45. package/dist/internal/marketplace.js.map +1 -1
  46. package/dist/internal/onboarding.d.ts +4 -6
  47. package/dist/internal/onboarding.d.ts.map +1 -1
  48. package/dist/internal/onboarding.js +15 -12
  49. package/dist/internal/onboarding.js.map +1 -1
  50. package/dist/internal/vault-info.d.ts +12 -0
  51. package/dist/internal/vault-info.d.ts.map +1 -0
  52. package/dist/internal/vault-info.js +19 -0
  53. package/dist/internal/vault-info.js.map +1 -0
  54. package/dist/wallet/cere.d.ts +7 -6
  55. package/dist/wallet/cere.d.ts.map +1 -1
  56. package/dist/wallet/cere.js +10 -8
  57. package/dist/wallet/cere.js.map +1 -1
  58. package/dist/wallet/keypair.d.ts +8 -7
  59. package/dist/wallet/keypair.d.ts.map +1 -1
  60. package/dist/wallet/keypair.js +16 -9
  61. package/dist/wallet/keypair.js.map +1 -1
  62. package/package.json +3 -2
  63. package/dist/wallet/adapter.d.ts +0 -15
  64. package/dist/wallet/adapter.d.ts.map +0 -1
  65. package/dist/wallet/adapter.js +0 -6
  66. package/dist/wallet/adapter.js.map +0 -1
package/README.md CHANGED
@@ -23,7 +23,7 @@ const sdk = new VaultSDK({
23
23
  s3GatewayAuthInfoUrl: "https://ddc-s3-gateway.compute.dev.ddcdragon.com/auth/info",
24
24
  // Override to point at the prod marketplace; defaults to the dev cluster URL.
25
25
  marketplaceEndpoint: "https://agent-marketplace.compute.dev.ddcdragon.com",
26
- wallet: myWallet, // any `Wallet` adapter
26
+ signer: mySigner, // any `@cef-ai/signer` Signer
27
27
  });
28
28
 
29
29
  const vault = await sdk.vault.ensure({
@@ -42,12 +42,12 @@ Server-side (pre-provisioned wallet, skip onboarding):
42
42
  ```ts
43
43
  import { VaultSDK, CereWallet } from "@cef-ai/vault-sdk";
44
44
 
45
- const wallet = await CereWallet.fromMnemonic(process.env.WALLET_MNEMONIC!);
45
+ const signer = await CereWallet.fromMnemonic(process.env.WALLET_MNEMONIC!);
46
46
  const sdk = new VaultSDK({
47
47
  endpoint: "https://vault.cere.io",
48
48
  garEndpoint: "https://gar.cere.io",
49
49
  s3GatewayAuthInfoUrl: "https://ddc-s3-gateway.compute.dev.ddcdragon.com/auth/info",
50
- wallet,
50
+ signer,
51
51
  });
52
52
  const vault = await sdk.vault.ensure({ onboard: false });
53
53
  ```
@@ -108,16 +108,23 @@ and on-chain proxy submission lives entirely in `@cef-ai/account`'s
108
108
 
109
109
  ## Connecting an agent
110
110
 
111
- `vault.agents.connect({ manifest, scope, settings })` is the high-level entry
111
+ `vault.agents.connect({ agentId, scope, settings })` is the high-level entry
112
112
  point. It builds the v2 agreement payload, signs it with your wallet, POSTs
113
113
  the signed envelope to the Global Agent Registry (GAR), and then calls
114
- vault-api `POST /agents` with the resulting signature — all internally.
114
+ vault-api `POST /agents` with the resulting signature — all internally. The
115
+ agent-service pubkey the GAR agreement is keyed on is derived from the
116
+ `agentId` prefix (`<agentServicePubkey>:<alias>`); pass `agentServicePubkey`
117
+ explicitly to override. `version`/`manifestCid` are not sent — the vault-api
118
+ resolves the manifest from the DDC registry itself, so no prior `getAgent`
119
+ call is required to connect.
115
120
 
116
121
  ```ts
117
- const manifest = await sdk.marketplace.getAgent("personal-assistant");
122
+ // Optional: fetch the display card to render before connecting.
123
+ const { agentId, card } = await sdk.marketplace.getAgent("personal-assistant");
124
+ console.log(card.name, card.description);
118
125
 
119
126
  const handle = await vault.agents.connect({
120
- manifest,
127
+ agentId,
121
128
  scope: "default",
122
129
  settings: { language: "en" },
123
130
  });
@@ -125,7 +132,7 @@ const handle = await vault.agents.connect({
125
132
  console.log(handle.agentId, handle.status);
126
133
  ```
127
134
 
128
- Requires `garEndpoint` and a `wallet` adapter on `VaultSDKConfig`. If you
135
+ Requires `garEndpoint` and a `signer` on `VaultSDKConfig`. If you
129
136
  already have a pre-signed `agreementSignature` (e.g. from a custodial flow),
130
137
  drop down to the low-level `Agents.connect(vaultId, ConnectAgentRequest)`
131
138
  exported from `@cef-ai/vault-sdk/internal`.
@@ -137,7 +144,7 @@ exported from `@cef-ai/vault-sdk/internal`.
137
144
  | `sdk.vault.ensure({ onboard?, onProgress?, delegationToken? })` | runs the onboarding pipeline + `POST /api/v1/vaults` |
138
145
  | `sdk.vault.current()` / `.rotateCredentials()` | `GET` / `PUT /api/v1/vaults[/credentials]` |
139
146
  | `vault.scopes.{list,get,create,update,delete}` | `/api/v1/vaults/:v/scopes` |
140
- | `vault.agents.connect({ manifest, scope, settings })` (signs GAR internally) | `POST {garEndpoint}/api/v1/agreements` + `POST /api/v1/vaults/:v/agents` |
147
+ | `vault.agents.connect({ agentId, scope, settings })` (signs GAR internally) | `POST {garEndpoint}/api/v1/agreements` + `POST /api/v1/vaults/:v/agents` |
141
148
  | `vault.agents.{list,get}` → `AgentConnectionHandle` | `/api/v1/vaults/:v/agents` |
142
149
  | `handle.update(settings)` / `handle.disconnect()` | `PATCH` / `DELETE` |
143
150
  | `handle.cubby(alias).query(...)` / `.exec(...)` | `/scopes/:s/cubbies/:alias/{query,exec}` |
@@ -148,7 +155,7 @@ exported from `@cef-ai/vault-sdk/internal`.
148
155
  | `vault.scope(s).streams.list()` / `.get(c)` / `.stream(c).events.list()` | `/scopes/:s/streams[/:c[/events]]` |
149
156
  | `vault.jobs.list({ state? })` / `.get(jobId).activities.list()` | `/jobs[/...]` |
150
157
  | `handle.jobs.get(jobId).activities.subscribe({ since? }, handler)` | poll-backed activity tail with seen-id dedupe |
151
- | `sdk.marketplace.getAgent(id, version?)` | public `GET /api/v1/marketplace/agents/:id[/versions/:v]` |
158
+ | `sdk.marketplace.getAgent(id, version?)` → `{ agentId, agentServicePubkey, version, card }` | public `GET /api/v1/marketplace/agents/:id[/versions/:v]` |
152
159
  | `sdk.marketplace.list({ limit?, cursor?, query? })` | public `GET /api/v1/marketplace/agents` |
153
160
  | `sdk.health.live()` / `.ready()` | public `GET /health` / `/ready` |
154
161
 
@@ -161,7 +168,7 @@ exported from `@cef-ai/vault-sdk/internal`.
161
168
  | `marketplaceEndpoint?: string` | Base URL for the agent marketplace API (separate host from the vault API; reads are unauthenticated). Default: dev cluster URL (`https://agent-marketplace.compute.dev.ddcdragon.com`). |
162
169
  | `s3GatewayAuthInfoUrl?: string` | Gateway `/auth/info` URL used to fetch the gateway pubkey when `s3GatewayPubkey` is not set. Default: dev cluster gateway. |
163
170
  | `s3GatewayPubkey?: string` | Static gateway pubkey; skips the `/auth/info` round-trip during `vault.ensure()`. |
164
- | `wallet?: Wallet` / `auth?: AuthProvider` | Authenticated calls. Mutually exclusive — `auth` overrides `wallet`. |
171
+ | `signer?: Signer` / `auth?: AuthProvider` | Authenticated calls. Mutually exclusive — `auth` overrides `signer`. `Signer` is `@cef-ai/signer`'s canonical interface. |
165
172
  | `fetch?: typeof fetch` | Inject a custom fetch for tests / non-browser runtimes. |
166
173
  | `timeoutMs?: number` | Per-request timeout (default 30 s). |
167
174
 
@@ -173,7 +180,7 @@ you supply reach the wire.
173
180
 
174
181
  ## Pluggable auth
175
182
 
176
- `VaultSDK` accepts either a `wallet` (default → `WalletAuthProvider`) or a
183
+ `VaultSDK` accepts either a `signer` (default → `WalletAuthProvider`) or a
177
184
  fully custom `auth: AuthProvider`:
178
185
 
179
186
  ```ts
@@ -183,18 +190,20 @@ new VaultSDK({ endpoint, auth: new BearerAuthProvider(token) });
183
190
  Ships with `WalletAuthProvider` and `NoAuth`. Implement `AuthProvider`
184
191
  yourself to plug in delegation tokens, trusted-headers, or anything else.
185
192
 
186
- ## Wallet adapters
193
+ ## Signers
187
194
 
188
- The `Wallet` interface is `{ pubkey(), sign(bytes), sigType?() }`.
195
+ The SDK consumes a `@cef-ai/signer.Signer` the canonical, chain-free signer
196
+ interface shared across the SDK suite: `{ type, address, publicKey: Uint8Array,
197
+ isReady(), sign(bytes, intent?) }`. vault-sdk 3.0.0 retired its bespoke `Wallet`
198
+ interface; pass any `Signer` directly.
189
199
 
190
- - `KeypairWallet.fromSeed(bytes)` — raw 32-byte ed25519 seed (server use).
191
- - `CereWallet.fromMnemonic(mnemonic, type?)` — wraps `UriSigner`.
192
- - `CereWallet.fromKeystore(json, passphrase, type?)` — Cere/Polkadot JSON keystore.
200
+ - `KeypairWallet.fromSeed(bytes)` — raw 32-byte ed25519 seed (server use); implements `Signer`.
201
+ - `CereWallet.fromMnemonic(mnemonic, type?)` — wraps `UriSigner`; implements `Signer`.
202
+ - `CereWallet.fromKeystore(json, passphrase, type?)` — Cere/Polkadot JSON keystore; implements `Signer`.
193
203
 
194
- Browser apps using `@cere/embed-wallet` should write a thin adapter
195
- implementing the 3-method `Wallet` interface against the embed-wallet's
196
- signer surface; the chat-app pattern at `cef-chat/src/lib/wallet/embed-adapter.ts`
197
- is a working reference.
204
+ Browser apps using the CEF wallet pass `embedWallet.asSigner()` straight into
205
+ `new VaultSDK({ signer })` — it already satisfies `Signer`, so no adapter is
206
+ needed (this replaces the old 3-method `Wallet` shim).
198
207
 
199
208
  The `UriSigner` / `JsonSigner` classes powering `CereWallet` are vendored
200
209
  from [`@cere-activity-sdk/signers`](https://github.com/cere-io/cere-activity-sdk/tree/main/packages/signers)
@@ -212,7 +221,7 @@ Browser-extension and CereWalletNative adapters live in their own packages.
212
221
  `VaultHttpClient` and `endpoints`.
213
222
 
214
223
  Onboarding primitives (`runOnboarding`, `pollUntilProxyReady`,
215
- `getOnboardingStatus`, `runBootstrap`, `walletToOnboardingSigner`) and
224
+ `getOnboardingStatus`, `runBootstrap`, `signerToOnboardingSigner`) and
216
225
  `getGatewayInfo` live under their respective files in `src/internal/` for
217
226
  advanced consumers that need to drive the HTTP-only status/bootstrap
218
227
  pipeline piecewise. Use them only when the fluent surface isn't enough.
@@ -1,15 +1,14 @@
1
- import type { AgentManifest } from "../internal/marketplace.js";
2
1
  /**
3
2
  * Server emits the AS pubkey under different field names depending on the
4
3
  * endpoint:
5
- * - `agentServicePubkey` on full manifests (GET /agents/:id) — canonical
4
+ * - `agentServicePubkey` on the per-agent card (GET /agents/:id) — canonical
6
5
  * - `asPubkey` (lowercase k) on list summaries (GET /agents)
7
6
  * - `asPubKey` (capital K) is the historical SDK shape kept for back-compat
8
7
  *
9
8
  * Consumers should not have to know which they're holding. Pass whatever
10
9
  * the server returned and this helper picks the first one present.
11
10
  */
12
- export declare function getAsPubkey(manifest: AgentManifest | {
11
+ export declare function getAsPubkey(source: {
13
12
  agentServicePubkey?: string;
14
13
  asPubkey?: string;
15
14
  asPubKey?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-fields.d.ts","sourceRoot":"","sources":["../../src/agreements/manifest-fields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EACJ,aAAa,GACb;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACxE,MAAM,GAAG,SAAS,CAOpB"}
1
+ {"version":3,"file":"manifest-fields.d.ts","sourceRoot":"","sources":["../../src/agreements/manifest-fields.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,GAAG,SAAS,CAErB"}
@@ -1,15 +1,15 @@
1
+ // src/agreements/manifest-fields.ts
1
2
  /**
2
3
  * Server emits the AS pubkey under different field names depending on the
3
4
  * endpoint:
4
- * - `agentServicePubkey` on full manifests (GET /agents/:id) — canonical
5
+ * - `agentServicePubkey` on the per-agent card (GET /agents/:id) — canonical
5
6
  * - `asPubkey` (lowercase k) on list summaries (GET /agents)
6
7
  * - `asPubKey` (capital K) is the historical SDK shape kept for back-compat
7
8
  *
8
9
  * Consumers should not have to know which they're holding. Pass whatever
9
10
  * the server returned and this helper picks the first one present.
10
11
  */
11
- export function getAsPubkey(manifest) {
12
- const m = manifest;
13
- return m.agentServicePubkey ?? m.asPubkey ?? m.asPubKey;
12
+ export function getAsPubkey(source) {
13
+ return source.agentServicePubkey ?? source.asPubkey ?? source.asPubKey;
14
14
  }
15
15
  //# sourceMappingURL=manifest-fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-fields.js","sourceRoot":"","sources":["../../src/agreements/manifest-fields.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,QAEyE;IAEzE,MAAM,CAAC,GAAG,QAIT,CAAC;IACF,OAAO,CAAC,CAAC,kBAAkB,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC;AAC1D,CAAC"}
1
+ {"version":3,"file":"manifest-fields.js","sourceRoot":"","sources":["../../src/agreements/manifest-fields.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,MAI3B;IACC,OAAO,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC;AACzE,CAAC"}
@@ -1,15 +1,22 @@
1
- import type { Wallet } from "../wallet/adapter.js";
2
- import type { AgentManifest } from "../internal/marketplace.js";
1
+ import type { Signer } from "@cef-ai/signer";
3
2
  import type { GarClient } from "./gar-client.js";
4
3
  export interface SignAndSubmitAgreementOptions {
5
- /** Wallet adapter — must implement `sign(bytes)`. */
6
- wallet: Wallet;
4
+ /** Signer — must implement `sign(bytes, intent?)`. */
5
+ signer: Signer;
7
6
  /** Vault to bind the agreement to. */
8
7
  vault: {
9
8
  id: string;
10
9
  userPubKey: string;
11
10
  };
12
- manifest: AgentManifest;
11
+ /**
12
+ * Agent identity the agreement binds to. The GAR payload is keyed on the
13
+ * agent-service pubkey; the caller resolves it (e.g. from the `agentId`
14
+ * prefix) and passes both scalars here — no manifest required.
15
+ */
16
+ agent: {
17
+ agentId: string;
18
+ agentServicePubkey: string;
19
+ };
13
20
  scope: string;
14
21
  gar: GarClient;
15
22
  /** Injectable clock for deterministic tests. */
@@ -24,7 +31,7 @@ export interface SignAndSubmitAgreementResult {
24
31
  }
25
32
  /**
26
33
  * High-level orchestrator: build a v2 agreement payload, sign the JSON bytes
27
- * with the user's wallet, POST the signed envelope to GAR, and return the
34
+ * with the user's signer, POST the signed envelope to GAR, and return the
28
35
  * bare-hex signature for the vault-api `agents.connect` body.
29
36
  */
30
37
  export declare function signAndSubmitAgreement(opts: SignAndSubmitAgreementOptions): Promise<SignAndSubmitAgreementResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/agreements/sign.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAA2B,MAAM,iBAAiB,CAAC;AAG1E,MAAM,WAAW,6BAA6B;IAC5C,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,SAAS,CAAC;IACf,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,4BAA4B,CAAC,CAoCvC"}
1
+ {"version":3,"file":"sign.d.ts","sourceRoot":"","sources":["../../src/agreements/sign.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,KAAK,EAAE,SAAS,EAA2B,MAAM,iBAAiB,CAAC;AAE1E,MAAM,WAAW,6BAA6B;IAC5C,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C;;;;OAIG;IACH,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,SAAS,CAAC;IACf,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,4BAA4B,CAAC,CAmCvC"}
@@ -2,30 +2,28 @@
2
2
  import { bytesToHex, encodeBase64Url, ensure0xHex, strip0xHex, } from "../core/canonical.js";
3
3
  import { VaultSignerRequiredError } from "../core/errors.js";
4
4
  import { buildVaultAgreementPayloadV2 } from "./payload.js";
5
- import { getAsPubkey } from "./manifest-fields.js";
6
5
  /**
7
6
  * High-level orchestrator: build a v2 agreement payload, sign the JSON bytes
8
- * with the user's wallet, POST the signed envelope to GAR, and return the
7
+ * with the user's signer, POST the signed envelope to GAR, and return the
9
8
  * bare-hex signature for the vault-api `agents.connect` body.
10
9
  */
11
10
  export async function signAndSubmitAgreement(opts) {
12
- if (typeof opts.wallet?.sign !== "function") {
11
+ if (typeof opts.signer?.sign !== "function") {
13
12
  throw new VaultSignerRequiredError();
14
13
  }
15
- const asPubkey = getAsPubkey(opts.manifest);
16
- if (!asPubkey) {
17
- throw new Error("signAndSubmitAgreement: manifest is missing required AS pubkey field " +
18
- "(checked: `agentServicePubkey`, `asPubkey`, `asPubKey`)");
14
+ const { agentId, agentServicePubkey } = opts.agent;
15
+ if (!agentServicePubkey) {
16
+ throw new Error("signAndSubmitAgreement: `agent.agentServicePubkey` is required");
19
17
  }
20
18
  const { bytes } = buildVaultAgreementPayloadV2({
21
19
  vaultId: opts.vault.id,
22
20
  userPubKey: opts.vault.userPubKey,
23
- asPubKey: asPubkey,
24
- agentId: opts.manifest.agentId,
21
+ asPubKey: agentServicePubkey,
22
+ agentId,
25
23
  scope: opts.scope,
26
24
  createdAt: opts.clock,
27
25
  });
28
- const sigBytes = await opts.wallet.sign(bytes);
26
+ const sigBytes = await opts.signer.sign(bytes, "data");
29
27
  const sigHexBare = bytesToHex(sigBytes);
30
28
  const envelope = {
31
29
  payload: encodeBase64Url(bytes),
@@ -1 +1 @@
1
- {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/agreements/sign.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EACL,UAAU,EACV,eAAe,EACf,WAAW,EACX,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAsBnD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAmC;IAEnC,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;QAC5C,MAAM,IAAI,wBAAwB,EAAE,CAAC;IACvC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C,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { SignerType } from "@cef-ai/signer";
2
+ /** Thrown when a signer's curve type is not a scheme the vault-api accepts. */
3
+ export declare class UnsupportedSignatureTypeError extends Error {
4
+ constructor(type: string);
5
+ }
6
+ /** Narrow a signer's `SignerType` to the vault-api wire scheme, or throw. */
7
+ export declare function assertScheme(type: SignerType): "ed25519" | "sr25519";
8
+ //# sourceMappingURL=assert-scheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-scheme.d.ts","sourceRoot":"","sources":["../../src/auth/assert-scheme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,+EAA+E;AAC/E,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,IAAI,EAAE,MAAM;CAOzB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAGpE"}
@@ -0,0 +1,15 @@
1
+ /** Thrown when a signer's curve type is not a scheme the vault-api accepts. */
2
+ export class UnsupportedSignatureTypeError extends Error {
3
+ constructor(type) {
4
+ super(`Unsupported signature type "${type}": vault-api accepts only "ed25519" or "sr25519". ` +
5
+ `Pass WalletAuthOptions.sigType to override.`);
6
+ this.name = "UnsupportedSignatureTypeError";
7
+ }
8
+ }
9
+ /** Narrow a signer's `SignerType` to the vault-api wire scheme, or throw. */
10
+ export function assertScheme(type) {
11
+ if (type === "ed25519" || type === "sr25519")
12
+ return type;
13
+ throw new UnsupportedSignatureTypeError(type);
14
+ }
15
+ //# sourceMappingURL=assert-scheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-scheme.js","sourceRoot":"","sources":["../../src/auth/assert-scheme.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD,YAAY,IAAY;QACtB,KAAK,CACH,+BAA+B,IAAI,oDAAoD;YACrF,6CAA6C,CAChD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC1D,MAAM,IAAI,6BAA6B,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC"}
@@ -1,15 +1,21 @@
1
+ import type { Signer } from "@cef-ai/signer";
1
2
  import type { AuthProvider, AuthRequest, AuthOutcome } from "./provider.js";
2
- import type { Wallet } from "../wallet/adapter.js";
3
+ /** Options for {@link WalletAuthProvider}. */
3
4
  export interface WalletAuthOptions {
4
- /** Override the wallet's sigType. */
5
+ /** Override the signer's scheme (skips assertScheme). */
5
6
  sigType?: "ed25519" | "sr25519";
6
7
  /** Clock for deterministic tests. */
7
8
  clock?: () => string;
8
9
  }
10
+ /**
11
+ * Auth provider that signs vault-api requests. NOTE: the "Wallet" prefix is
12
+ * legacy — the constructor takes a `@cef-ai/signer` `Signer`, not the
13
+ * removed `Wallet` interface.
14
+ */
9
15
  export declare class WalletAuthProvider implements AuthProvider {
10
- private readonly wallet;
16
+ private readonly signer;
11
17
  private readonly opts;
12
- constructor(wallet: Wallet, opts?: WalletAuthOptions);
18
+ constructor(signer: Signer, opts?: WalletAuthOptions);
13
19
  authenticate(req: AuthRequest): Promise<AuthOutcome>;
14
20
  }
15
21
  //# sourceMappingURL=wallet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/auth/wallet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAMnD,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB;AAED,qBAAa,kBAAmB,YAAW,YAAY;IAEnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,iBAAsB;IAGzC,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAuB3D"}
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/auth/wallet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAY5E,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IAEnD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,iBAAsB;IAGzC,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CA4B3D"}
@@ -1,30 +1,36 @@
1
1
  import { buildPreamble, encodeBase64Url, ensure0xHex, stampBody, strip0xHex, bytesToHex, } from "../core/canonical.js";
2
2
  import { VaultSignerRequiredError } from "../core/errors.js";
3
+ import { assertScheme } from "./assert-scheme.js";
4
+ /**
5
+ * Auth provider that signs vault-api requests. NOTE: the "Wallet" prefix is
6
+ * legacy — the constructor takes a `@cef-ai/signer` `Signer`, not the
7
+ * removed `Wallet` interface.
8
+ */
3
9
  export class WalletAuthProvider {
4
- wallet;
10
+ signer;
5
11
  opts;
6
- constructor(wallet, opts = {}) {
7
- this.wallet = wallet;
12
+ constructor(signer, opts = {}) {
13
+ this.signer = signer;
8
14
  this.opts = opts;
9
15
  }
10
16
  async authenticate(req) {
11
- if (typeof this.wallet?.sign !== "function")
17
+ if (typeof this.signer?.sign !== "function")
12
18
  throw new VaultSignerRequiredError();
13
- const sigType = this.opts.sigType ?? this.wallet.sigType?.() ?? "ed25519";
19
+ const sigType = this.opts.sigType ?? assertScheme(this.signer.type);
14
20
  const headers = {
15
- "X-Public-Key": ensure0xHex(this.wallet.pubkey()),
21
+ "X-Public-Key": ensure0xHex(bytesToHex(this.signer.publicKey)),
16
22
  "X-Signature-Type": sigType,
17
23
  };
18
24
  const upper = req.method.toUpperCase();
19
25
  if (upper === "GET" || upper === "HEAD") {
20
26
  const { bytes } = buildPreamble(upper, req.path, req.query, this.opts.clock);
21
- const sig = await this.wallet.sign(bytes);
27
+ const sig = await this.signer.sign(bytes, "data");
22
28
  headers["X-Signed-Preamble"] = encodeBase64Url(bytes);
23
29
  headers["X-Signature"] = strip0xHex(bytesToHex(sig));
24
30
  return { headers };
25
31
  }
26
32
  const { bytes } = stampBody(req.body, this.opts.clock);
27
- const sig = await this.wallet.sign(bytes);
33
+ const sig = await this.signer.sign(bytes, "data");
28
34
  headers["Content-Type"] = "application/json";
29
35
  headers["X-Signature"] = strip0xHex(bytesToHex(sig));
30
36
  return { headers, body: bytes };
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/auth/wallet.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,GAC/E,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAS7D,MAAM,OAAO,kBAAkB;I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MAAM,EAAE,CAAC;YACxC,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAC7B,KAAK,EACL,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,KAAK,EACT,IAAI,CAAC,IAAI,CAAC,KAAK,CAChB,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;YAClD,OAAO,CAAC,mBAAmB,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YACtD,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;YACrD,OAAO,EAAE,OAAO,EAAE,CAAC;QACrB,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAC7C,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC;CACF"}
package/dist/client.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Health } from "./internal/health.js";
3
3
  import { Vault } from "./fluent/vault.js";
4
4
  import { type OnboardingStatus } from "./internal/onboarding.js";
5
5
  import type { AuthProvider } from "./auth/provider.js";
6
- import type { Wallet } from "./wallet/adapter.js";
6
+ import type { Signer } from "@cef-ai/signer";
7
7
  export interface VaultSDKConfig {
8
8
  endpoint: string;
9
9
  /**
@@ -21,11 +21,11 @@ export interface VaultSDKConfig {
21
21
  */
22
22
  garEndpoint?: string;
23
23
  /**
24
- * Wallet adapter — used to construct a default `WalletAuthProvider` for
24
+ * Signer — used to construct a default `WalletAuthProvider` for
25
25
  * authenticated calls. Mutually exclusive with `auth`.
26
26
  */
27
- wallet?: Wallet;
28
- /** Fully custom auth provider. Overrides `wallet`. */
27
+ signer?: Signer;
28
+ /** Fully custom auth provider. Overrides `signer`. */
29
29
  auth?: AuthProvider;
30
30
  fetch?: typeof fetch;
31
31
  timeoutMs?: number;
@@ -90,8 +90,9 @@ export declare class VaultSDK {
90
90
  private readonly http;
91
91
  private readonly marketplaceHttp;
92
92
  private readonly vaults;
93
+ private readonly vaultInfo;
93
94
  private readonly gar?;
94
- private readonly wallet?;
95
+ private readonly signer?;
95
96
  private readonly s3GatewayPubkey?;
96
97
  private readonly s3GatewayAuthInfoUrl;
97
98
  private readonly fetchFn;
@@ -125,6 +126,26 @@ export declare class VaultSDK {
125
126
  * purpose — do not rework or build on it until that lands.
126
127
  */
127
128
  rotateCredentials: (vaultId: string, delegationToken: string) => Promise<Vault>;
129
+ delegate: {
130
+ /** vault-api's delegate signing pubkey (T_v subject). */
131
+ pubkey: () => Promise<string>;
132
+ /**
133
+ * Grant vault-api autonomous S3-credential refresh for `bucketId`:
134
+ * owner signs T_v (subject = delegate pubkey) and registers it with the
135
+ * gateway. The SDK resolves vault-api's delegate pubkey itself (via
136
+ * `VaultInfo.delegate()`) unless the caller already knows it and passes
137
+ * `delegatePubkey` to skip the round-trip.
138
+ */
139
+ grant: (opts: {
140
+ bucketId: bigint;
141
+ delegatePubkey?: string;
142
+ }) => Promise<void>;
143
+ /** Revoke that grant. */
144
+ revoke: (opts: {
145
+ bucketId: bigint;
146
+ delegatePubkey?: string;
147
+ }) => Promise<void>;
148
+ };
128
149
  };
129
150
  }
130
151
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACx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