@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.
- package/README.md +34 -14
- package/dist/clients/owner/client.d.ts +2 -2
- package/dist/clients/owner/client.js +7 -8
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +4 -5
- package/dist/clients/owner/index.d.ts +1 -1
- package/dist/protocol/childSecretNaming.d.ts +7 -0
- package/dist/protocol/childSecretNaming.js +12 -0
- package/dist/protocol/childSecretNaming.js.map +1 -0
- package/dist/protocol/identity.d.ts +8 -0
- package/dist/protocol/identity.js +16 -0
- package/dist/protocol/identity.js.map +1 -0
- package/dist/runtime/bootstrap.d.ts +8 -10
- package/dist/runtime/bootstrap.js +3 -5
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/identity.d.ts +6 -0
- package/dist/runtime/identity.js +14 -0
- package/dist/runtime/identity.js.map +1 -0
- package/dist/runtime/index.d.ts +7 -6
- package/dist/runtime/index.js +5 -4
- package/dist/runtime/index.js.map +1 -1
- package/dist/vault-core/contracts.d.ts +11 -11
- package/dist/vault-core/core.d.ts +3 -2
- package/dist/vault-core/core.js +26 -8
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +9 -3
- package/dist/vault-core/defaults.js +18 -8
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/index.d.ts +4 -4
- package/dist/vault-core/index.js +2 -2
- package/dist/vault-core/index.js.map +1 -1
- package/dist/vault-core/persistence.d.ts +33 -4
- package/dist/vault-core/persistence.js +92 -1
- package/dist/vault-core/persistence.js.map +1 -1
- package/dist/vault-core/ports.d.ts +9 -3
- package/dist/vault-ingress/defaults.d.ts +1 -7
- package/dist/vault-ingress/defaults.js +0 -13
- package/dist/vault-ingress/defaults.js.map +1 -1
- package/dist/vault-ingress/index.d.ts +2 -7
- package/dist/vault-ingress/index.js +10 -11
- package/dist/vault-ingress/index.js.map +1 -1
- package/docs/ARCHITECTURE.md +23 -4
- package/docs/CUSTODY_MODEL.md +5 -2
- package/docs/IDENTITY_MODEL.md +120 -0
- package/docs/REFERENCE.md +32 -11
- package/docs/es/README.md +42 -2
- package/docs/fr/README.md +42 -2
- package/docs/ja/README.md +42 -2
- package/docs/ko/README.md +42 -2
- package/docs/pt/README.md +42 -2
- package/docs/zh/README.md +5 -5
- 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
|
-
|
|
44
|
-
|
|
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.
|
|
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
|
|
121
|
-
const
|
|
122
|
-
const
|
|
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,
|
|
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
|
|
207
|
+
const createdVault = await createOwnedVault(storage, {
|
|
188
208
|
vaultId: 'vault-persistent',
|
|
189
209
|
bootstrapOwner: {
|
|
190
210
|
vaultId: { value: 'vault-persistent' },
|
|
191
|
-
ownerId:
|
|
192
|
-
publicKey:
|
|
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(
|
|
217
|
+
console.log(createdVault.initializedCustody.vaultRecoveryKey);
|
|
198
218
|
|
|
199
|
-
const recoveredVault = await
|
|
219
|
+
const recoveredVault = await recoverVault(storage, {
|
|
200
220
|
vaultId: 'vault-persistent',
|
|
201
|
-
|
|
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,
|
|
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
|
|
126
|
+
async registerCapability(input) {
|
|
127
127
|
const requestedAt = input.requestedAt ?? this._clock.nowIso();
|
|
128
|
-
const requestId = `${this._identity.ownerId}:${requestedAt}:${input.
|
|
129
|
-
const
|
|
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
|
-
|
|
137
|
+
capability,
|
|
139
138
|
}));
|
|
140
|
-
await this._vault.
|
|
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
|
-
|
|
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,cAAS,GAAT,SAAS,CAAe;QACxB,WAAM,GAAN,MAAM,CAAc;QACpB,YAAO,GAAP,OAAO,CAAa;QACpB,WAAM,GAAN,MAAM,CAAO;IAC7B,CAAC;IAEJ,KAAK,CAAC,WAAW,CAAC,KAA4B;QAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9D,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,WAAW,IAAI,KAAK,CAAC,KAAK,eAAe,CAAC;QACzF,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,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,cAAc,EAAE,KAAK,CAAC,cAAc;SACrC,CAAC,CAAC,CAAC;QACJ,OA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AI,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,
|
|
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
|
|
2
|
+
import { type VaultService, type VaultCustomFlowResolver } from "../vault-ingress/index.js";
|
|
3
3
|
import type { IStorageProvider } from "../storage/provider.js";
|
|
4
|
-
export interface
|
|
4
|
+
export interface CreateOwnedVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
|
|
5
5
|
custody?: InitializeVaultCustodyOptions;
|
|
6
|
-
bootstrapOwner
|
|
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
|
|
12
|
+
export interface CreatedOwnedVault {
|
|
14
13
|
initializedCustody: InitializedVaultCustody;
|
|
15
14
|
core: VaultCore;
|
|
16
15
|
vault: VaultService;
|
|
17
16
|
}
|
|
18
|
-
export interface
|
|
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
|
|
25
|
+
export interface RecoveredVault {
|
|
28
26
|
vaultWorkingKey: string;
|
|
29
27
|
core: VaultCore;
|
|
30
28
|
vault: VaultService;
|
|
31
29
|
}
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
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
|
|
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
|
-
|
|
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
|
|
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,
|
|
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,GAG5B,MAAM,2BAA2B,CAAC;AAiCnC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAyB,EACzB,OAAgC;IAEhC,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,MAAM,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1D,OAAO;QACL,kBAAkB;QAClB,IAAI;QACJ,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,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"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -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 {
|
|
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 {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
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
|
|
15
|
-
export {
|
|
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";
|
package/dist/runtime/index.js
CHANGED
|
@@ -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 {
|
|
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 {
|
|
10
|
-
export {
|
|
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 {
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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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" | "
|
|
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,
|
|
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
|
-
|
|
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>;
|
package/dist/vault-core/core.js
CHANGED
|
@@ -86,24 +86,42 @@ export class DefaultVaultCore {
|
|
|
86
86
|
throw error;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
async
|
|
89
|
+
async registerCapability(command) {
|
|
90
90
|
if (command.vaultId.value !== this._deps.vaultId.value) {
|
|
91
|
-
throw new VaultCoreError("
|
|
91
|
+
throw new VaultCoreError("capability registration vault mismatch", "VAULT_IDENTITY_DENIED");
|
|
92
92
|
}
|
|
93
|
-
if (command.
|
|
94
|
-
throw new VaultCoreError("
|
|
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.
|
|
98
|
-
await this._deps.
|
|
99
|
-
await this.appendAudit(toAuditEntry(this._deps, command.owner, "
|
|
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, "
|
|
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");
|