@the-ai-company/cbio-node-runtime 1.2.0 → 1.5.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 (52) hide show
  1. package/README.md +34 -14
  2. package/dist/clients/owner/client.d.ts +2 -2
  3. package/dist/clients/owner/client.js +7 -8
  4. package/dist/clients/owner/client.js.map +1 -1
  5. package/dist/clients/owner/contracts.d.ts +4 -5
  6. package/dist/clients/owner/index.d.ts +1 -1
  7. package/dist/protocol/childSecretNaming.d.ts +7 -0
  8. package/dist/protocol/childSecretNaming.js +12 -0
  9. package/dist/protocol/childSecretNaming.js.map +1 -0
  10. package/dist/protocol/identity.d.ts +8 -0
  11. package/dist/protocol/identity.js +16 -0
  12. package/dist/protocol/identity.js.map +1 -0
  13. package/dist/runtime/bootstrap.d.ts +8 -10
  14. package/dist/runtime/bootstrap.js +3 -5
  15. package/dist/runtime/bootstrap.js.map +1 -1
  16. package/dist/runtime/identity.d.ts +6 -0
  17. package/dist/runtime/identity.js +14 -0
  18. package/dist/runtime/identity.js.map +1 -0
  19. package/dist/runtime/index.d.ts +7 -6
  20. package/dist/runtime/index.js +5 -4
  21. package/dist/runtime/index.js.map +1 -1
  22. package/dist/vault-core/contracts.d.ts +11 -11
  23. package/dist/vault-core/core.d.ts +3 -2
  24. package/dist/vault-core/core.js +26 -8
  25. package/dist/vault-core/core.js.map +1 -1
  26. package/dist/vault-core/defaults.d.ts +9 -3
  27. package/dist/vault-core/defaults.js +18 -8
  28. package/dist/vault-core/defaults.js.map +1 -1
  29. package/dist/vault-core/index.d.ts +4 -4
  30. package/dist/vault-core/index.js +2 -2
  31. package/dist/vault-core/index.js.map +1 -1
  32. package/dist/vault-core/persistence.d.ts +33 -4
  33. package/dist/vault-core/persistence.js +92 -1
  34. package/dist/vault-core/persistence.js.map +1 -1
  35. package/dist/vault-core/ports.d.ts +9 -3
  36. package/dist/vault-ingress/defaults.d.ts +1 -7
  37. package/dist/vault-ingress/defaults.js +0 -13
  38. package/dist/vault-ingress/defaults.js.map +1 -1
  39. package/dist/vault-ingress/index.d.ts +2 -7
  40. package/dist/vault-ingress/index.js +10 -11
  41. package/dist/vault-ingress/index.js.map +1 -1
  42. package/docs/ARCHITECTURE.md +23 -4
  43. package/docs/CUSTODY_MODEL.md +5 -2
  44. package/docs/IDENTITY_MODEL.md +120 -0
  45. package/docs/REFERENCE.md +32 -11
  46. package/docs/es/README.md +42 -2
  47. package/docs/fr/README.md +42 -2
  48. package/docs/ja/README.md +42 -2
  49. package/docs/ko/README.md +42 -2
  50. package/docs/pt/README.md +42 -2
  51. package/docs/zh/README.md +5 -5
  52. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,7 @@ Node.js vault runtime with a hard-cut architecture: vault core first, explicit c
8
8
 
9
9
  - [English](README.md)
10
10
  - [Custody Model](docs/CUSTODY_MODEL.md)
11
+ - [Identity Model](docs/IDENTITY_MODEL.md)
11
12
  - [中文](docs/zh/README.md)
12
13
  - [日本語](docs/ja/README.md)
13
14
  - [한국어](docs/ko/README.md)
@@ -40,21 +41,36 @@ npm install @the-ai-company/cbio-node-runtime
40
41
  import {
41
42
  createVaultService,
42
43
  createDefaultVaultCoreDependencies,
43
- initializePersistentVault,
44
- recoverPersistentVault,
44
+ createIdentity,
45
+ createOwnedVault,
46
+ recoverVault,
45
47
  createOwnerHttpFlowBoundary,
46
48
  createStandardAcquireBoundary,
47
49
  createStandardDispatchBoundary,
48
50
  createOwnerClient,
49
51
  createAgentClient,
50
52
  FsStorageProvider,
51
- InMemoryVaultCapabilityResolver,
52
53
  LocalVaultTransport,
53
54
  } from '@the-ai-company/cbio-node-runtime';
54
55
  ```
55
56
 
56
57
  ## Architecture
57
58
 
59
+ Core terms:
60
+
61
+ - `identity`
62
+ An external principal represented by a public/private keypair.
63
+ - `owner`
64
+ The single admin role that a vault binds to one identity.
65
+ - `agent`
66
+ A delegated role that a vault binds to an identity registered by the owner.
67
+
68
+ Important role rule:
69
+
70
+ - outside the vault there are only identities
71
+ - inside a specific vault, those identities may be bound to roles such as `owner` or `agent`
72
+ - identities are independent; they do not imply parent/child lineage or inheritance by default
73
+
58
74
  The public runtime surface follows four hard rules:
59
75
 
60
76
  1. Secret plaintext lives only in vault core.
@@ -104,7 +120,7 @@ An owner-defined exception path also exists for non-standard but intentional int
104
120
  Vault boundary/facade. Accepts request-shaped calls, handles trusted acquisition paths, and keeps capability resolution plus dispatch ingress inside the vault trust boundary.
105
121
 
106
122
  - `clients/owner`
107
- Owner-facing client. Writes secrets, exports plaintext secrets, and reads audit.
123
+ Owner-facing client. The owner is the single vault admin. It writes secrets, exports plaintext secrets, manages agents/capabilities, and reads audit.
108
124
 
109
125
  - `clients/agent`
110
126
  Agent-facing client. Creates signed dispatch requests. Never handles plaintext secret.
@@ -117,11 +133,12 @@ This package now exposes the production local vault runtime surface as the prima
117
133
  ## Example Shape
118
134
 
119
135
  ```ts
120
- const capabilities = new InMemoryVaultCapabilityResolver();
121
- const vault = createVaultService(createDefaultVaultCoreDependencies(), { capabilities });
122
- const owner = createOwnerClient(ownerIdentity, vault, ownerSigner, clock);
136
+ const ownerIdentity = createIdentity();
137
+ const agentIdentity = createIdentity();
138
+ const vault = createVaultService(createDefaultVaultCoreDependencies());
139
+ const owner = createOwnerClient({ ownerId: ownerIdentity.identityId }, vault, new LocalSigner(ownerIdentity), clock);
123
140
  const transport = new LocalVaultTransport(vault, capability.capabilityId);
124
- const agent = createAgentClient(agentIdentity, capability, signer, transport, clock);
141
+ const agent = createAgentClient({ agentId: agentIdentity.identityId }, capability, new LocalSigner(agentIdentity), transport, clock);
125
142
  ```
126
143
 
127
144
  Capability example:
@@ -137,6 +154,8 @@ const capability = {
137
154
  allowedMethods: ['POST'],
138
155
  issuedAt: new Date().toISOString(),
139
156
  };
157
+
158
+ await owner.registerCapability({ capability });
140
159
  ```
141
160
 
142
161
  Custom flow example:
@@ -183,22 +202,23 @@ console.log(exported.plaintext);
183
202
  Persistent custody bootstrap example:
184
203
 
185
204
  ```ts
205
+ const ownerIdentity = createIdentity();
186
206
  const storage = new FsStorageProvider('/tmp/cbio-vault');
187
- const initializedVault = await initializePersistentVault(storage, {
207
+ const createdVault = await createOwnedVault(storage, {
188
208
  vaultId: 'vault-persistent',
189
209
  bootstrapOwner: {
190
210
  vaultId: { value: 'vault-persistent' },
191
- ownerId: 'owner-1',
192
- publicKey: ownerPublicKey,
211
+ ownerId: ownerIdentity.identityId,
212
+ publicKey: ownerIdentity.publicKey,
193
213
  },
194
214
  });
195
215
 
196
216
  // Show once to the owner and let them store it offline.
197
- console.log(initializedVault.initializedCustody.vaultRecoveryKey);
217
+ console.log(createdVault.initializedCustody.vaultRecoveryKey);
198
218
 
199
- const recoveredVault = await recoverPersistentVault(storage, {
219
+ const recoveredVault = await recoverVault(storage, {
200
220
  vaultId: 'vault-persistent',
201
- initializedVault.initializedCustody.vaultRecoveryKey,
221
+ vaultRecoveryKey: createdVault.initializedCustody.vaultRecoveryKey,
202
222
  });
203
223
  ```
204
224
 
@@ -1,6 +1,6 @@
1
1
  import type { Clock } from "../../vault-core/index.js";
2
2
  import type { VaultService } from "../../vault-ingress/index.js";
3
- import type { OwnerAuditQueryInput, OwnerExportSecretInput, OwnerRegisterCustomHttpFlowInput, OwnerRegisterAgentIdentityInput, OwnerRegisterOwnerIdentityInput, OwnerWriteSecretInput } from "./contracts.js";
3
+ import type { OwnerAuditQueryInput, OwnerExportSecretInput, OwnerRegisterCapabilityInput, OwnerRegisterCustomHttpFlowInput, OwnerRegisterAgentIdentityInput, OwnerWriteSecretInput } from "./contracts.js";
4
4
  export interface OwnerIdentity {
5
5
  ownerId: string;
6
6
  }
@@ -11,9 +11,9 @@ export interface OwnerSigner {
11
11
  export interface OwnerClient {
12
12
  writeSecret(input: OwnerWriteSecretInput): Promise<import("../../vault-core/index.js").SecretRecord>;
13
13
  exportSecret(input: OwnerExportSecretInput): Promise<import("../../vault-core/index.js").OwnerSecretExport>;
14
+ registerCapability(input: OwnerRegisterCapabilityInput): Promise<void>;
14
15
  getAudit(query?: OwnerAuditQueryInput): Promise<readonly import("../../vault-core/index.js").AuditEntry[]>;
15
16
  registerAgentIdentity(input: OwnerRegisterAgentIdentityInput): Promise<void>;
16
- registerOwnerIdentity(input: OwnerRegisterOwnerIdentityInput): Promise<void>;
17
17
  registerCustomFlow(input: OwnerRegisterCustomHttpFlowInput): Promise<void>;
18
18
  }
19
19
  export declare function createOwnerClient(identity: OwnerIdentity, vault: VaultService, signer: OwnerSigner, clock: Clock): OwnerClient;
@@ -123,28 +123,27 @@ class DefaultOwnerClient {
123
123
  },
124
124
  });
125
125
  }
126
- async registerOwnerIdentity(input) {
126
+ async registerCapability(input) {
127
127
  const requestedAt = input.requestedAt ?? this._clock.nowIso();
128
- const requestId = `${this._identity.ownerId}:${requestedAt}:${input.ownerId}:register_owner_identity`;
129
- const ownerIdentity = {
128
+ const requestId = `${this._identity.ownerId}:${requestedAt}:${input.capability.capabilityId}:register_capability`;
129
+ const capability = {
130
+ ...input.capability,
130
131
  vaultId: this._vault.vaultId,
131
- ownerId: input.ownerId,
132
- publicKey: input.publicKey,
133
132
  };
134
133
  const signature = await this._signer.sign(JSON.stringify({
135
134
  requestId,
136
135
  requestedAt,
137
136
  ownerId: this._identity.ownerId,
138
- ownerIdentity,
137
+ capability,
139
138
  }));
140
- await this._vault.registerOwnerIdentity({
139
+ await this._vault.registerCapability({
141
140
  vaultId: this._vault.vaultId,
142
141
  requestId,
143
142
  owner: {
144
143
  kind: "owner",
145
144
  id: this._identity.ownerId,
146
145
  },
147
- ownerIdentity,
146
+ capability,
148
147
  requestedAt,
149
148
  proof: {
150
149
  ownerId: this._identity.ownerId,
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/owner/client.ts"],"names":[],"mappings":"AA6BA,MAAM,kBAAkB;IAEH;IACA;IACA;IACA;IAJnB,YACmB,SAAwB,EACxB,MAAoB,EACpB,OAAoB,EACpB,MAAa;QAHb,c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KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;YAC5C,cAAc,EAAE,KAAK,CAAC,cAAc;SACrC,CAAC;QACF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;YACvD,SAAS;YACT,WAAW;YACX,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;YAC/B,IAAI;SACL,CAAC,CAAC,CAAC;QACJ,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YACnC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,SAAS;YACT,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO;gBACb,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;aAC3B;YACD,IAAI;YACJ,WAAW;YACX,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;gBAC/B,SAAS;gBACT,SAAS;gBACT,WAAW;aACZ;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAC/B,QAAuB,EACvB,KAAmB,EACnB,MAAmB,EACnB,KAAY;IAEZ,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -27,12 +27,11 @@ export interface OwnerRegisterAgentIdentityInput {
27
27
  publicKey: string;
28
28
  requestedAt?: string;
29
29
  }
30
- export interface OwnerRegisterOwnerIdentityInput {
31
- ownerId: string;
32
- publicKey: string;
33
- requestedAt?: string;
34
- }
35
30
  export interface OwnerRegisterCustomHttpFlowInput extends OwnerHttpFlowBoundary {
36
31
  flowId: string;
37
32
  requestedAt?: string;
38
33
  }
34
+ export interface OwnerRegisterCapabilityInput {
35
+ capability: import("../../vault-core/index.js").AgentCapability;
36
+ requestedAt?: string;
37
+ }
@@ -1,3 +1,3 @@
1
1
  export { createOwnerClient } from "./client.js";
2
2
  export type { OwnerClient, OwnerIdentity, OwnerSigner, } from "./client.js";
3
- export type { OwnerAuditQueryInput, OwnerExportSecretInput, OwnerRegisterCustomHttpFlowInput, OwnerRegisterAgentIdentityInput, OwnerRegisterOwnerIdentityInput, OwnerSecretTargetBinding, OwnerWriteSecretInput, } from "./contracts.js";
3
+ export type { OwnerAuditQueryInput, OwnerExportSecretInput, OwnerRegisterCapabilityInput, OwnerRegisterCustomHttpFlowInput, OwnerRegisterAgentIdentityInput, OwnerSecretTargetBinding, OwnerWriteSecretInput, } from "./contracts.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Vault secret naming for child identities. CHILD_KEY_PREFIX, getChildIdentitySecretName.
3
+ * Not protocol objects. Protocol talks about public identities and signatures,
4
+ * not local secret names or internal storage prefixes.
5
+ */
6
+ export declare const CHILD_KEY_PREFIX: "cbio:child:";
7
+ export declare function getChildIdentitySecretName(publicKey: string): string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Vault secret naming for child identities. CHILD_KEY_PREFIX, getChildIdentitySecretName.
3
+ * Not protocol objects. Protocol talks about public identities and signatures,
4
+ * not local secret names or internal storage prefixes.
5
+ */
6
+ import * as crypto from 'node:crypto';
7
+ export const CHILD_KEY_PREFIX = 'cbio:child:';
8
+ export function getChildIdentitySecretName(publicKey) {
9
+ const hash = crypto.createHash('sha256').update(publicKey).digest('hex').substring(0, 12);
10
+ return CHILD_KEY_PREFIX + hash;
11
+ }
12
+ //# sourceMappingURL=childSecretNaming.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"childSecretNaming.js","sourceRoot":"","sources":["../../src/protocol/childSecretNaming.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAsB,CAAC;AAEvD,MAAM,UAAU,0BAA0B,CAAC,SAAiB;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1F,OAAO,gBAAgB,GAAG,IAAI,CAAC;AACnC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Claw-biometric Core Identity. Runtime utilities over protocol primitives.
3
+ * getVaultPath (runtime). Re-exports protocol for consumers.
4
+ */
5
+ import { deriveRootAgentId } from '@the-ai-company/cbio-protocol';
6
+ import { getChildIdentitySecretName, CHILD_KEY_PREFIX } from './childSecretNaming.js';
7
+ export { deriveRootAgentId, getChildIdentitySecretName, CHILD_KEY_PREFIX };
8
+ export declare function getVaultPath(publicKey: string): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Claw-biometric Core Identity. Runtime utilities over protocol primitives.
3
+ * getVaultPath (runtime). Re-exports protocol for consumers.
4
+ */
5
+ import * as os from 'node:os';
6
+ import * as path from 'node:path';
7
+ import * as crypto from 'node:crypto';
8
+ import { deriveRootAgentId } from '@the-ai-company/cbio-protocol';
9
+ import { getChildIdentitySecretName, CHILD_KEY_PREFIX } from './childSecretNaming.js';
10
+ export { deriveRootAgentId, getChildIdentitySecretName, CHILD_KEY_PREFIX };
11
+ export function getVaultPath(publicKey) {
12
+ const hash = crypto.createHash('sha256').update(publicKey).digest('hex').substring(0, 12);
13
+ const baseDir = process.env.C_BIO_VAULT_DIR || path.join(os.homedir(), '.c-bio');
14
+ return path.join(baseDir, `vault_${hash}.enc`);
15
+ }
16
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/protocol/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,CAAC;AAE3E,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC1C,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IACjF,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,IAAI,MAAM,CAAC,CAAC;AACnD,CAAC"}
@@ -1,33 +1,31 @@
1
1
  import { type CreatePersistentVaultCoreDependenciesOptions, type InitializedVaultCustody, type InitializeVaultCustodyOptions, type OwnerIdentityRecord, type VaultCore } from "../vault-core/index.js";
2
- import { type VaultService, type VaultCapabilityResolver, type VaultCustomFlowResolver } from "../vault-ingress/index.js";
2
+ import { type VaultService, type VaultCustomFlowResolver } from "../vault-ingress/index.js";
3
3
  import type { IStorageProvider } from "../storage/provider.js";
4
- export interface InitializePersistentVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
4
+ export interface CreateOwnedVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
5
5
  custody?: InitializeVaultCustodyOptions;
6
- bootstrapOwner?: OwnerIdentityRecord;
6
+ bootstrapOwner: OwnerIdentityRecord;
7
7
  vault?: {
8
- capabilities?: VaultCapabilityResolver;
9
8
  customFlows?: VaultCustomFlowResolver;
10
9
  fetchImpl?: typeof fetch;
11
10
  };
12
11
  }
13
- export interface InitializedPersistentVault {
12
+ export interface CreatedOwnedVault {
14
13
  initializedCustody: InitializedVaultCustody;
15
14
  core: VaultCore;
16
15
  vault: VaultService;
17
16
  }
18
- export interface RecoverPersistentVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
17
+ export interface RecoverVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
19
18
  vaultRecoveryKey: string;
20
19
  custodyStorageKey?: string;
21
20
  vault?: {
22
- capabilities?: VaultCapabilityResolver;
23
21
  customFlows?: VaultCustomFlowResolver;
24
22
  fetchImpl?: typeof fetch;
25
23
  };
26
24
  }
27
- export interface RecoveredPersistentVault {
25
+ export interface RecoveredVault {
28
26
  vaultWorkingKey: string;
29
27
  core: VaultCore;
30
28
  vault: VaultService;
31
29
  }
32
- export declare function initializePersistentVault(storage: IStorageProvider, options: InitializePersistentVaultOptions): Promise<InitializedPersistentVault>;
33
- export declare function recoverPersistentVault(storage: IStorageProvider, options: RecoverPersistentVaultOptions): Promise<RecoveredPersistentVault>;
30
+ export declare function createOwnedVault(storage: IStorageProvider, options: CreateOwnedVaultOptions): Promise<CreatedOwnedVault>;
31
+ export declare function recoverVault(storage: IStorageProvider, options: RecoverVaultOptions): Promise<RecoveredVault>;
@@ -1,23 +1,21 @@
1
1
  import { createVaultCore } from "../vault-core/core.js";
2
2
  import { createPersistentVaultCoreDependencies, initializeVaultCustody, recoverVaultWorkingKey, } from "../vault-core/index.js";
3
3
  import { wrapVaultCoreAsVaultService, } from "../vault-ingress/index.js";
4
- export async function initializePersistentVault(storage, options) {
4
+ export async function createOwnedVault(storage, options) {
5
5
  const initializedCustody = await initializeVaultCustody(storage, options.custody);
6
6
  const deps = createPersistentVaultCoreDependencies(storage, {
7
7
  ...options,
8
8
  vaultWorkingKey: initializedCustody.vaultWorkingKey,
9
9
  });
10
10
  const core = createVaultCore(deps);
11
- if (options.bootstrapOwner) {
12
- await core.bootstrapOwnerIdentity(options.bootstrapOwner);
13
- }
11
+ await core.bootstrapOwnerIdentity(options.bootstrapOwner);
14
12
  return {
15
13
  initializedCustody,
16
14
  core,
17
15
  vault: wrapVaultCoreAsVaultService(core, options.vault),
18
16
  };
19
17
  }
20
- export async function recoverPersistentVault(storage, options) {
18
+ export async function recoverVault(storage, options) {
21
19
  const vaultWorkingKey = await recoverVaultWorkingKey(storage, options.vaultRecoveryKey, options.custodyStorageKey);
22
20
  const deps = createPersistentVaultCoreDependencies(storage, {
23
21
  ...options,
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,qCAAqC,EACrC,sBAAsB,EACtB,sBAAsB,GAMvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,2BAA2B,GAI5B,MAAM,2BAA2B,CAAC;AAmCnC,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,OAAyB,EACzB,OAAyC;IAEzC,MAAM,kBAAkB,GAAG,MAAM,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAClF,MAAM,IAAI,GAAG,qCAAqC,CAAC,OAAO,EAAE;QAC1D,GAAG,OAAO;QACV,eAAe,EAAE,kBAAkB,CAAC,eAAe;KACpD,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO;QACL,kBAAkB;QAClB,IAAI;QACJ,KAAK,EAAE,2BAA2B,CAA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,KAAK,EAAE,2BAA2B,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC;KACxD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAyB,EACzB,OAA4B;IAE5B,MAAM,eAAe,GAAG,MAAM,sBAAsB,CAClD,OAAO,EACP,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,iBAAiB,CAC1B,CAAC;IACF,MAAM,IAAI,GAAG,qCAAqC,CAAC,OAAO,EAAE;QAC1D,GAAG,OAAO;QACV,eAAe;KAChB,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO;QACL,eAAe;QACf,IAAI;QACJ,KAAK,EAAE,2BAA2B,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC;KACxD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface CreatedIdentity {
2
+ identityId: string;
3
+ publicKey: string;
4
+ privateKey: string;
5
+ }
6
+ export declare function createIdentity(): CreatedIdentity;
@@ -0,0 +1,14 @@
1
+ import { generateIdentityKeys } from "../protocol/crypto.js";
2
+ import { deriveRootAgentId } from "../protocol/identity.js";
3
+ export function createIdentity() {
4
+ const keyPair = generateIdentityKeys();
5
+ if (!keyPair.publicKey || !keyPair.privateKey) {
6
+ throw new Error("identity generation failed");
7
+ }
8
+ return {
9
+ identityId: deriveRootAgentId(keyPair.publicKey),
10
+ publicKey: keyPair.publicKey,
11
+ privateKey: keyPair.privateKey,
12
+ };
13
+ }
14
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/runtime/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQ5D,MAAM,UAAU,cAAc;IAC5B,MAAM,OAAO,GAAG,oBAAoB,EAAE,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IACD,OAAO;QACL,UAAU,EAAE,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC;QAChD,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC;AACJ,CAAC"}
@@ -3,13 +3,14 @@
3
3
  * Hard-cut public surface: vault core plus explicit clients only.
4
4
  */
5
5
  export { IdentityError, IdentityErrorCode } from "../errors.js";
6
- export { generateIdentityKeys, derivePublicKey, LocalSigner } from "../protocol/crypto.js";
6
+ export { derivePublicKey, LocalSigner } from "../protocol/crypto.js";
7
7
  export type { IStorageProvider } from "../storage/provider.js";
8
8
  export { FsStorageProvider } from "../storage/fs.js";
9
9
  export { MemoryStorageProvider } from "../storage/memory.js";
10
- export { initializePersistentVault, recoverPersistentVault, type InitializePersistentVaultOptions, type InitializedPersistentVault, type RecoverPersistentVaultOptions, type RecoveredPersistentVault, } from "./bootstrap.js";
11
- export { createVaultCore, DefaultVaultCore, VaultCoreError, createDefaultVaultCoreDependencies, type CreateDefaultVaultCoreDependenciesOptions, type DefaultPolicyEngineOptions, DefaultPolicyEngine, createPersistentVaultCoreDependencies, initializeVaultCustody, recoverVaultWorkingKey, DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY, type InitializeVaultCustodyOptions, type InitializedVaultCustody, type CreatePersistentVaultCoreDependenciesOptions, PersistentVaultAuditLog, PersistentVaultCapabilityRevocationRegistry, PersistentVaultCustomHttpFlowRegistry, PersistentVaultRateLimitStore, PersistentVaultReplayGuard, PersistentVaultSecretCustody, PersistentVaultSecretRepository, HttpDispatchExecutor, InMemoryAgentIdentityRegistry, InMemoryCapabilityRevocationRegistry, InMemoryCustomHttpFlowRegistry, InMemoryRateLimitStore, InMemoryReplayGuard, InMemoryAuditLog, InMemoryOwnerIdentityRegistry, InMemorySecretCustody, InMemorySecretRepository, RandomIdGenerator, SignatureOwnerProofVerifier, type SignatureAgentProofVerifierOptions, SignatureAgentProofVerifier, SystemClock, type AgentCapability, type AgentIdentityRecord, type AgentProof, type OwnerAuditRequest, type OwnerExportSecretRequest, type OwnerRegisterAgentIdentityCommand, type OwnerRegisterCustomHttpFlowCommand, type OwnerRegisterOwnerIdentityCommand, type OwnerSecretExport, type OwnerIdentityRecord, type CustomHttpFlowDefinition, type OwnerProof, type AuditEntry, type AuditLog, type AuditQuery, type Clock, type DispatchAuthorization, type DispatchInstruction, type DispatchRequest, type DispatchResult, type IdGenerator, type OwnerIdentityRegistry, type OwnerProofVerifier, type PolicyEngine, type RateLimitStore, type ReplayGuard, type CustomHttpFlowRegistry, type SecretAlias, type SecretCustody, type SecretId, type SecretRecord, type SecretRepository, type SecretVersion, type TrustedExecutor, type VaultCore, type VaultCoreDependencies, type VaultPrincipal, type VaultPrincipalKind, type VaultTargetBinding, type VaultWriteSecretCommand, type VaultId, type AgentIdentityRegistry, type AgentProofVerifier, type CapabilityRevocationRegistry, } from "../vault-core/index.js";
12
- export { createOwnerClient, type OwnerClient, type OwnerIdentity, type OwnerSigner, type OwnerAuditQueryInput, type OwnerExportSecretInput, type OwnerRegisterCustomHttpFlowInput, type OwnerRegisterAgentIdentityInput, type OwnerRegisterOwnerIdentityInput, type OwnerSecretTargetBinding, type OwnerWriteSecretInput, } from "../clients/owner/index.js";
10
+ export { createIdentity, type CreatedIdentity, } from "./identity.js";
11
+ export { createOwnedVault, recoverVault, type CreateOwnedVaultOptions, type CreatedOwnedVault, type RecoverVaultOptions, type RecoveredVault, } from "./bootstrap.js";
12
+ export { createVaultCore, DefaultVaultCore, VaultCoreError, createDefaultVaultCoreDependencies, type CreateDefaultVaultCoreDependenciesOptions, type DefaultPolicyEngineOptions, DefaultPolicyEngine, createPersistentVaultCoreDependencies, initializeVaultCustody, recoverVaultWorkingKey, DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY, type InitializeVaultCustodyOptions, type InitializedVaultCustody, type CreatePersistentVaultCoreDependenciesOptions, PersistentVaultAuditLog, PersistentVaultCapabilityRegistry, PersistentVaultCapabilityRevocationRegistry, PersistentVaultCustomHttpFlowRegistry, PersistentVaultRateLimitStore, PersistentVaultReplayGuard, PersistentVaultSecretCustody, PersistentVaultSecretRepository, HttpDispatchExecutor, InMemoryAgentIdentityRegistry, InMemoryCapabilityRegistry, InMemoryCapabilityRevocationRegistry, InMemoryCustomHttpFlowRegistry, InMemoryRateLimitStore, InMemoryReplayGuard, InMemoryAuditLog, InMemoryOwnerIdentityRegistry, InMemorySecretCustody, InMemorySecretRepository, RandomIdGenerator, SignatureOwnerProofVerifier, type SignatureAgentProofVerifierOptions, SignatureAgentProofVerifier, SystemClock, type AgentCapability, type AgentIdentityRecord, type AgentProof, type OwnerAuditRequest, type OwnerExportSecretRequest, type OwnerRegisterCapabilityCommand, type OwnerRegisterAgentIdentityCommand, type OwnerRegisterCustomHttpFlowCommand, type OwnerSecretExport, type OwnerIdentityRecord, type CustomHttpFlowDefinition, type OwnerProof, type AuditEntry, type AuditLog, type AuditQuery, type Clock, type DispatchAuthorization, type DispatchInstruction, type DispatchRequest, type DispatchResult, type IdGenerator, type OwnerIdentityRegistry, type OwnerProofVerifier, type PolicyEngine, type RateLimitStore, type ReplayGuard, type CustomHttpFlowRegistry, type SecretAlias, type SecretCustody, type SecretId, type SecretRecord, type SecretRepository, type SecretVersion, type TrustedExecutor, type VaultCore, type VaultCoreDependencies, type VaultPrincipal, type VaultPrincipalKind, type VaultTargetBinding, type VaultWriteSecretCommand, type VaultId, type AgentIdentityRegistry, type AgentProofVerifier, type CapabilityRevocationRegistry, type CapabilityRegistry, } from "../vault-core/index.js";
13
+ export { createOwnerClient, type OwnerClient, type OwnerIdentity, type OwnerSigner, type OwnerAuditQueryInput, type OwnerExportSecretInput, type OwnerRegisterCapabilityInput, type OwnerRegisterCustomHttpFlowInput, type OwnerRegisterAgentIdentityInput, type OwnerSecretTargetBinding, type OwnerWriteSecretInput, } from "../clients/owner/index.js";
13
14
  export { createAgentClient, type AgentClient, type AgentIdentity, type AgentCapabilityEnvelope, type AgentDispatchIntent, type AgentDispatchTransport, type AgentSigner, } from "../clients/agent/index.js";
14
- export { createVaultService, wrapVaultCoreAsVaultService, createOwnerHttpFlowBoundary, createStandardAcquireBoundary, createStandardDispatchBoundary, toOwnerHttpFlowBoundary, type VaultService, type VaultAcquireSecretInput, type VaultAcquireSecretResult, type VaultAcquireSecretFlow, type VaultCustomFlowResolver, type VaultCapabilityResolver, type VaultAgentDispatchRequest, type VaultAgentDispatchResponse, type VaultAgentDispatchErrorResponse, type RedactedResponseShape, type OwnerHttpFlowBoundary, } from "../vault-ingress/index.js";
15
- export { InMemoryVaultCapabilityResolver, LocalVaultTransport, } from "../vault-ingress/defaults.js";
15
+ export { createVaultService, wrapVaultCoreAsVaultService, createOwnerHttpFlowBoundary, createStandardAcquireBoundary, createStandardDispatchBoundary, toOwnerHttpFlowBoundary, type VaultService, type VaultAcquireSecretInput, type VaultAcquireSecretResult, type VaultAcquireSecretFlow, type VaultCustomFlowResolver, type VaultAgentDispatchRequest, type VaultAgentDispatchResponse, type VaultAgentDispatchErrorResponse, type RedactedResponseShape, type OwnerHttpFlowBoundary, } from "../vault-ingress/index.js";
16
+ export { LocalVaultTransport, } from "../vault-ingress/defaults.js";
@@ -3,13 +3,14 @@
3
3
  * Hard-cut public surface: vault core plus explicit clients only.
4
4
  */
5
5
  export { IdentityError, IdentityErrorCode } from "../errors.js";
6
- export { generateIdentityKeys, derivePublicKey, LocalSigner } from "../protocol/crypto.js";
6
+ export { derivePublicKey, LocalSigner } from "../protocol/crypto.js";
7
7
  export { FsStorageProvider } from "../storage/fs.js";
8
8
  export { MemoryStorageProvider } from "../storage/memory.js";
9
- export { initializePersistentVault, recoverPersistentVault, } from "./bootstrap.js";
10
- export { createVaultCore, DefaultVaultCore, VaultCoreError, createDefaultVaultCoreDependencies, DefaultPolicyEngine, createPersistentVaultCoreDependencies, initializeVaultCustody, recoverVaultWorkingKey, DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY, PersistentVaultAuditLog, PersistentVaultCapabilityRevocationRegistry, PersistentVaultCustomHttpFlowRegistry, PersistentVaultRateLimitStore, PersistentVaultReplayGuard, PersistentVaultSecretCustody, PersistentVaultSecretRepository, HttpDispatchExecutor, InMemoryAgentIdentityRegistry, InMemoryCapabilityRevocationRegistry, InMemoryCustomHttpFlowRegistry, InMemoryRateLimitStore, InMemoryReplayGuard, InMemoryAuditLog, InMemoryOwnerIdentityRegistry, InMemorySecretCustody, InMemorySecretRepository, RandomIdGenerator, SignatureOwnerProofVerifier, SignatureAgentProofVerifier, SystemClock, } from "../vault-core/index.js";
9
+ export { createIdentity, } from "./identity.js";
10
+ export { createOwnedVault, recoverVault, } from "./bootstrap.js";
11
+ export { createVaultCore, DefaultVaultCore, VaultCoreError, createDefaultVaultCoreDependencies, DefaultPolicyEngine, createPersistentVaultCoreDependencies, initializeVaultCustody, recoverVaultWorkingKey, DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY, PersistentVaultAuditLog, PersistentVaultCapabilityRegistry, PersistentVaultCapabilityRevocationRegistry, PersistentVaultCustomHttpFlowRegistry, PersistentVaultRateLimitStore, PersistentVaultReplayGuard, PersistentVaultSecretCustody, PersistentVaultSecretRepository, HttpDispatchExecutor, InMemoryAgentIdentityRegistry, InMemoryCapabilityRegistry, InMemoryCapabilityRevocationRegistry, InMemoryCustomHttpFlowRegistry, InMemoryRateLimitStore, InMemoryReplayGuard, InMemoryAuditLog, InMemoryOwnerIdentityRegistry, InMemorySecretCustody, InMemorySecretRepository, RandomIdGenerator, SignatureOwnerProofVerifier, SignatureAgentProofVerifier, SystemClock, } from "../vault-core/index.js";
11
12
  export { createOwnerClient, } from "../clients/owner/index.js";
12
13
  export { createAgentClient, } from "../clients/agent/index.js";
13
14
  export { createVaultService, wrapVaultCoreAsVaultService, createOwnerHttpFlowBoundary, createStandardAcquireBoundary, createStandardDispatchBoundary, toOwnerHttpFlowBoundary, } from "../vault-ingress/index.js";
14
- export { InMemoryVaultCapabilityResolver, LocalVaultTransport, } from "../vault-ingress/defaults.js";
15
+ export { LocalVaultTransport, } from "../vault-ingress/defaults.js";
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GAKvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,kCAAkC,EAGlC,mBAAmB,EACnB,qCAAqC,EACrC,sBAAsB,EACtB,sBAAsB,EACtB,kCAAkC,EAIlC,uBAAuB,EACvB,2CAA2C,EAC3C,qCAAqC,EACrC,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,oBAAoB,EACpB,6BAA6B,EAC7B,oCAAoC,EACpC,8BAA8B,EAC9B,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAE3B,2BAA2B,EAC3B,WAAW,GA6CZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,iBAAiB,GAWlB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,iBAAiB,GAOlB,MA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,GAOlB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EAC9B,uBAAuB,GAWxB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,mBAAmB,GACpB,MAAM,8BAA8B,CAAC"}
@@ -68,16 +68,6 @@ export interface OwnerRegisterAgentIdentityCommand {
68
68
  requestedAt: string;
69
69
  proof: OwnerProof;
70
70
  }
71
- export interface OwnerRegisterOwnerIdentityCommand {
72
- vaultId: VaultId;
73
- requestId: string;
74
- owner: VaultPrincipal & {
75
- kind: "owner";
76
- };
77
- ownerIdentity: OwnerIdentityRecord;
78
- requestedAt: string;
79
- proof: OwnerProof;
80
- }
81
71
  export interface CustomHttpFlowDefinition {
82
72
  vaultId: VaultId;
83
73
  flowId: string;
@@ -114,6 +104,16 @@ export interface OwnerRegisterCustomHttpFlowCommand {
114
104
  requestedAt: string;
115
105
  proof: OwnerProof;
116
106
  }
107
+ export interface OwnerRegisterCapabilityCommand {
108
+ vaultId: VaultId;
109
+ requestId: string;
110
+ owner: VaultPrincipal & {
111
+ kind: "owner";
112
+ };
113
+ capability: AgentCapability;
114
+ requestedAt: string;
115
+ proof: OwnerProof;
116
+ }
117
117
  export interface AgentCapability {
118
118
  vaultId: VaultId;
119
119
  capabilityId: string;
@@ -198,7 +198,7 @@ export interface AuditEntry {
198
198
  occurredAt: string;
199
199
  vaultId: string;
200
200
  actor: VaultPrincipal;
201
- action: "bootstrap_owner_identity" | "register_agent_identity" | "register_owner_identity" | "register_custom_flow" | "write_secret" | "export_secret" | "reassign_alias" | "authorize_dispatch" | "dispatch_secret" | "read_audit";
201
+ action: "bootstrap_owner_identity" | "register_agent_identity" | "register_custom_flow" | "register_capability" | "write_secret" | "export_secret" | "reassign_alias" | "authorize_dispatch" | "dispatch_secret" | "read_audit";
202
202
  requestId?: string;
203
203
  capabilityId?: string;
204
204
  operation?: AgentCapability["operation"] | AuditEntry["action"];
@@ -1,4 +1,4 @@
1
- import type { AuditEntry, AuditQuery, CustomHttpFlowDefinition, DispatchAuthorization, DispatchRequest, DispatchResult, OwnerExportSecretRequest, OwnerRegisterAgentIdentityCommand, OwnerRegisterCustomHttpFlowCommand, OwnerRegisterOwnerIdentityCommand, OwnerSecretExport, SecretRecord, VaultPrincipal, VaultWriteSecretCommand } from "./contracts.js";
1
+ import type { AuditEntry, AuditQuery, CustomHttpFlowDefinition, DispatchAuthorization, DispatchRequest, DispatchResult, OwnerExportSecretRequest, OwnerRegisterCapabilityCommand, OwnerRegisterAgentIdentityCommand, OwnerRegisterCustomHttpFlowCommand, OwnerSecretExport, SecretRecord, VaultPrincipal, VaultWriteSecretCommand } from "./contracts.js";
2
2
  import type { VaultCore, VaultCoreDependencies } from "./ports.js";
3
3
  export declare class DefaultVaultCore implements VaultCore {
4
4
  private readonly _deps;
@@ -8,7 +8,8 @@ export declare class DefaultVaultCore implements VaultCore {
8
8
  private appendDecisionAudit;
9
9
  bootstrapOwnerIdentity(identity: import("./contracts.js").OwnerIdentityRecord): Promise<void>;
10
10
  registerAgentIdentity(command: OwnerRegisterAgentIdentityCommand): Promise<void>;
11
- registerOwnerIdentity(command: OwnerRegisterOwnerIdentityCommand): Promise<void>;
11
+ registerCapability(command: OwnerRegisterCapabilityCommand): Promise<void>;
12
+ getCapability(vaultId: import("./contracts.js").VaultId, agentId: string, capabilityId: string): Promise<import("./contracts.js").AgentCapability | null>;
12
13
  registerCustomFlow(command: OwnerRegisterCustomHttpFlowCommand): Promise<void>;
13
14
  storeCustomFlowSecret(flow: CustomHttpFlowDefinition, alias: string, plaintext: string): Promise<SecretRecord>;
14
15
  writeSecret(command: VaultWriteSecretCommand): Promise<SecretRecord>;
@@ -86,24 +86,42 @@ export class DefaultVaultCore {
86
86
  throw error;
87
87
  }
88
88
  }
89
- async registerOwnerIdentity(command) {
89
+ async registerCapability(command) {
90
90
  if (command.vaultId.value !== this._deps.vaultId.value) {
91
- throw new VaultCoreError("identity registration vault mismatch", "VAULT_IDENTITY_DENIED");
91
+ throw new VaultCoreError("capability registration vault mismatch", "VAULT_IDENTITY_DENIED");
92
92
  }
93
- if (command.ownerIdentity.vaultId.value !== this._deps.vaultId.value) {
94
- throw new VaultCoreError("owner identity vault mismatch", "VAULT_IDENTITY_DENIED");
93
+ if (command.capability.vaultId.value !== this._deps.vaultId.value) {
94
+ throw new VaultCoreError("capability vault mismatch", "VAULT_IDENTITY_DENIED");
95
+ }
96
+ if (command.capability.agentId !== command.capability.agentId.trim() || !command.capability.agentId.trim()) {
97
+ throw new VaultCoreError("capability agent id required", "VAULT_IDENTITY_DENIED");
98
+ }
99
+ if (!command.capability.capabilityId.trim()) {
100
+ throw new VaultCoreError("capability id required", "VAULT_IDENTITY_DENIED");
95
101
  }
96
102
  try {
97
- await this._deps.ownerProofVerifier.verifyRegisterOwnerIdentity(command);
98
- await this._deps.ownerIdentities.register(command.ownerIdentity);
99
- await this.appendAudit(toAuditEntry(this._deps, command.owner, "register_owner_identity", "succeeded", `owner identity registered: ${command.ownerIdentity.ownerId}`));
103
+ await this._deps.ownerProofVerifier.verifyRegisterCapability(command);
104
+ await this._deps.capabilities.register(command.capability);
105
+ await this.appendAudit(toAuditEntry(this._deps, command.owner, "register_capability", "succeeded", `capability registered: ${command.capability.capabilityId}`, {
106
+ capabilityId: command.capability.capabilityId,
107
+ operation: command.capability.operation,
108
+ }));
100
109
  }
101
110
  catch (error) {
102
111
  const detail = error instanceof Error ? error.message : String(error);
103
- await this.appendAudit(toAuditEntry(this._deps, command.owner, "register_owner_identity", "denied", detail));
112
+ await this.appendAudit(toAuditEntry(this._deps, command.owner, "register_capability", "denied", detail, {
113
+ capabilityId: command.capability.capabilityId,
114
+ operation: command.capability.operation,
115
+ }));
104
116
  throw error;
105
117
  }
106
118
  }
119
+ async getCapability(vaultId, agentId, capabilityId) {
120
+ if (vaultId.value !== this._deps.vaultId.value) {
121
+ throw new VaultCoreError("capability lookup vault mismatch", "VAULT_IDENTITY_DENIED");
122
+ }
123
+ return this._deps.capabilities.get(vaultId, agentId, capabilityId);
124
+ }
107
125
  async registerCustomFlow(command) {
108
126
  if (command.vaultId.value !== this._deps.vaultId.value) {
109
127
  throw new VaultCoreError("custom flow vault mismatch", "VAULT_IDENTITY_DENIED");