@the-ai-company/cbio-node-runtime 1.46.0 → 1.47.2
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 +85 -239
- package/dist/clients/agent/client.d.ts +1 -0
- package/dist/clients/agent/client.js +25 -9
- package/dist/clients/agent/client.js.map +1 -1
- package/dist/clients/owner/client.d.ts +6 -4
- package/dist/clients/owner/client.js +41 -0
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +36 -0
- package/dist/clients/owner/index.d.ts +1 -1
- package/dist/runtime/bootstrap.d.ts +7 -7
- package/dist/runtime/bootstrap.js +2 -2
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/vault-metadata.js +1 -1
- package/dist/runtime/vault-metadata.js.map +1 -1
- package/dist/vault-core/contracts.d.ts +28 -2
- package/dist/vault-core/contracts.js +2 -0
- package/dist/vault-core/contracts.js.map +1 -1
- package/dist/vault-core/core.d.ts +10 -2
- package/dist/vault-core/core.js +24 -0
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +15 -3
- package/dist/vault-core/defaults.js +53 -14
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/index.d.ts +1 -1
- package/dist/vault-core/index.js.map +1 -1
- package/dist/vault-core/persistence.js +5 -2
- package/dist/vault-core/persistence.js.map +1 -1
- package/dist/vault-core/ports.d.ts +6 -0
- package/dist/vault-ingress/index.d.ts +11 -2
- package/dist/vault-ingress/index.js +8 -0
- package/dist/vault-ingress/index.js.map +1 -1
- package/dist/vault-ingress/remote-transport.js +4 -1
- package/dist/vault-ingress/remote-transport.js.map +1 -1
- package/docs/ARCHITECTURE.md +34 -107
- package/docs/CUSTODY_MODEL.md +27 -129
- package/docs/IDENTITY_MODEL.md +34 -112
- package/docs/REFERENCE.md +57 -404
- package/docs/api/README.md +4 -3
- package/docs/api/classes/IdentityError.md +2 -2
- package/docs/api/classes/VaultCore.md +43 -1
- package/docs/api/classes/VaultCoreError.md +1 -1
- package/docs/api/enumerations/IdentityErrorCode.md +1 -1
- package/docs/api/functions/createAgentClient.md +1 -1
- package/docs/api/functions/createIdentity.md +1 -1
- package/docs/api/functions/createOwnerHttpFlowBoundary.md +1 -1
- package/docs/api/functions/createPersistentVaultCoreDependencies.md +1 -1
- package/docs/api/functions/createStandardAcquireBoundary.md +1 -1
- package/docs/api/functions/createStandardDispatchBoundary.md +1 -1
- package/docs/api/functions/createVault.md +3 -3
- package/docs/api/functions/createVaultClient.md +1 -1
- package/docs/api/functions/createVaultCore.md +1 -1
- package/docs/api/functions/createVaultCoreDependencies.md +1 -1
- package/docs/api/functions/createVaultService.md +1 -1
- package/docs/api/functions/createWorkspaceStorage.md +1 -1
- package/docs/api/functions/deriveIdentityId.md +1 -1
- package/docs/api/functions/deriveVaultWorkingKeyFromPassword.md +1 -1
- package/docs/api/functions/getDefaultWorkspaceDir.md +1 -1
- package/docs/api/functions/handleVaultHttpDispatch.md +1 -1
- package/docs/api/functions/initializeVaultCustody.md +1 -1
- package/docs/api/functions/listVaults.md +3 -3
- package/docs/api/functions/readVaultProfile.md +1 -1
- package/docs/api/functions/recoverVault.md +4 -4
- package/docs/api/functions/recoverVaultWorkingKey.md +1 -1
- package/docs/api/functions/restoreIdentity.md +1 -1
- package/docs/api/functions/updateVaultMetadata.md +1 -1
- package/docs/api/functions/wrapVaultCoreAsVaultService.md +1 -1
- package/docs/api/functions/writeVaultProfile.md +1 -1
- package/docs/api/interfaces/AgentClient.md +1 -1
- package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
- package/docs/api/interfaces/AgentDispatchTransport.md +1 -1
- package/docs/api/interfaces/AgentIdentity.md +1 -1
- package/docs/api/interfaces/AgentSigner.md +1 -1
- package/docs/api/interfaces/CbioRuntime.md +8 -8
- package/docs/api/interfaces/CreateAgentClientOptions.md +7 -1
- package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
- package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +1 -1
- package/docs/api/interfaces/CreateVaultClientOptions.md +1 -1
- package/docs/api/interfaces/CreateVaultOptions.md +1 -1
- package/docs/api/interfaces/CreatedVault.md +1 -1
- package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -1
- package/docs/api/interfaces/IStorageProvider.md +1 -1
- package/docs/api/interfaces/InitializeVaultCustodyOptions.md +1 -1
- package/docs/api/interfaces/InitializedVaultCustody.md +1 -1
- package/docs/api/interfaces/OwnerDefineSecretTargetsInput.md +1 -1
- package/docs/api/interfaces/OwnerSecretTargetBinding.md +1 -1
- package/docs/api/interfaces/OwnerStoreSecretInput.md +1 -1
- package/docs/api/interfaces/OwnerWriteSecretInput.md +1 -1
- package/docs/api/interfaces/RecoverVaultOptions.md +1 -1
- package/docs/api/interfaces/RecoveredVault.md +1 -1
- package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
- package/docs/api/interfaces/Signer.md +1 -1
- package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
- package/docs/api/interfaces/VaultClient.md +20 -3
- package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -1
- package/docs/api/interfaces/VaultCreateAgentInput.md +29 -0
- package/docs/api/interfaces/VaultDeleteSecretInput.md +1 -1
- package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
- package/docs/api/interfaces/VaultGrantCapabilityInput.md +1 -1
- package/docs/api/interfaces/VaultIdentity.md +1 -1
- package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
- package/docs/api/interfaces/VaultListCapabilitiesInput.md +1 -1
- package/docs/api/interfaces/{VaultPublicMetadata.md → VaultMetadata.md} +2 -2
- package/docs/api/interfaces/VaultObject.md +1 -1
- package/docs/api/interfaces/VaultProfile.md +1 -1
- package/docs/api/interfaces/VaultRegisterAgentInput.md +19 -1
- package/docs/api/interfaces/VaultRegisterFlowInput.md +1 -1
- package/docs/api/interfaces/VaultRevokeCapabilityInput.md +1 -1
- package/docs/api/interfaces/VaultSigner.md +1 -1
- package/docs/api/type-aliases/AgentCapabilityEnvelope.md +1 -1
- package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
- package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
- package/docs/zh/README.md +64 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
# cbio Vault Runtime
|
|
2
2
|
|
|
3
|
-
Node.js vault runtime with a
|
|
3
|
+
Node.js vault runtime with a **Sovereign Vault** architecture: authority is rooted in a master password, and agent identities are fully managed within the vault's encrypted storage.
|
|
4
4
|
|
|
5
5
|
**Source:** [https://github.com/TheAICompany/cbio-node-runtime](https://github.com/TheAICompany/cbio-node-runtime)
|
|
6
6
|
|
|
7
|
-
## Documentation / 文档 / ドキュメント / 문서 / Docs
|
|
8
|
-
|
|
9
|
-
- [English](README.md)
|
|
10
|
-
- [Custody Model](docs/CUSTODY_MODEL.md)
|
|
11
|
-
- [Identity Model](docs/IDENTITY_MODEL.md)
|
|
12
|
-
- [Process Isolation (A/B Architecture)](docs/PROCESS_ISOLATION.md)
|
|
13
|
-
- [中文](docs/zh/README.md)
|
|
14
|
-
- [日本語](docs/ja/README.md)
|
|
15
|
-
- [한국어](docs/ko/README.md)
|
|
16
|
-
- [Español](docs/es/README.md)
|
|
17
|
-
- [Português](docs/pt/README.md)
|
|
18
|
-
- [Français](docs/fr/README.md)
|
|
19
|
-
|
|
20
7
|
---
|
|
21
8
|
|
|
22
|
-
|
|
23
|
-
- No TUI
|
|
9
|
+
## Key Features
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
11
|
+
- **No CLI / No TUI**: Pure library for integration into Node.js applications.
|
|
12
|
+
- **Authority-centric**: Administrative control is tied to the vault's master password, not an external identity.
|
|
13
|
+
- **Managed Agent Custody**: Generate and store agent private keys securely inside the vault.
|
|
14
|
+
- **Process Isolation**: Hard separation between the Security Process (Master) and Agent Processes (Consumers).
|
|
15
|
+
- **Zero-Leak Discovery**: Vault metadata is fully encrypted and hidden until unlocked.
|
|
30
16
|
|
|
31
17
|
## Install
|
|
32
18
|
|
|
@@ -38,267 +24,127 @@ npm install @the-ai-company/cbio-node-runtime
|
|
|
38
24
|
|
|
39
25
|
## Usage
|
|
40
26
|
|
|
41
|
-
|
|
42
|
-
import {
|
|
43
|
-
createChildIdentity,
|
|
44
|
-
createIdentity,
|
|
45
|
-
createWorkspaceStorage,
|
|
46
|
-
ensureIdentityPrivateVault,
|
|
47
|
-
readIdentityPrivateVaultProfile,
|
|
48
|
-
readIdentityPrivateVaultChildrenState,
|
|
49
|
-
restoreIdentity,
|
|
50
|
-
createVault,
|
|
51
|
-
recoverVault,
|
|
52
|
-
createOwnerHttpFlowBoundary,
|
|
53
|
-
createStandardAcquireBoundary,
|
|
54
|
-
createVaultClient,
|
|
55
|
-
createAgentClient,
|
|
56
|
-
FsStorageProvider,
|
|
57
|
-
} from '@the-ai-company/cbio-node-runtime';
|
|
58
|
-
```
|
|
27
|
+
### 1. Bootstrap a New Vault
|
|
59
28
|
|
|
60
|
-
|
|
29
|
+
The Sovereign Vault requires only a storage provider and a master password.
|
|
61
30
|
|
|
62
31
|
```ts
|
|
63
|
-
|
|
64
|
-
|
|
32
|
+
import {
|
|
33
|
+
createVault,
|
|
34
|
+
FsStorageProvider,
|
|
35
|
+
createWorkspaceStorage
|
|
36
|
+
} from '@the-ai-company/cbio-node-runtime';
|
|
65
37
|
|
|
66
|
-
|
|
38
|
+
const storage = new FsStorageProvider('./my-vaults');
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
nickname: 'worker-1',
|
|
40
|
+
const myVault = await createVault(storage, {
|
|
41
|
+
vaultId: 'main-vault',
|
|
42
|
+
password: 'your-secure-password',
|
|
43
|
+
nickname: 'Production Vault'
|
|
73
44
|
});
|
|
74
45
|
|
|
75
|
-
|
|
76
|
-
const identities = await listIdentities(storage);
|
|
77
|
-
const vaults = await listVaults(storage);
|
|
78
|
-
|
|
79
|
-
const profile = await readIdentityMetadata(storage, identities[0].identityId); // Public Discovery
|
|
80
|
-
const fullProfile = await readIdentityMetadata(storage, rootIdentity.identityId, rootIdentity.privateKey); // Full Authorized Profile
|
|
81
|
-
const children = await readIdentityPrivateVaultChildrenState(storage, rootIdentity.privateKey);
|
|
46
|
+
console.log(`Vault created: ${myVault.nickname}`);
|
|
82
47
|
```
|
|
83
48
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
import { type VaultPublicMetadata } from '@the-ai-company/cbio-node-runtime';
|
|
88
|
-
|
|
89
|
-
const publicMetadata: VaultPublicMetadata = {
|
|
90
|
-
displayName: 'Primary Vault',
|
|
91
|
-
tags: ['production', 'main'],
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const createdVault = await createVault({
|
|
95
|
-
ownerIdentity: rootIdentity,
|
|
96
|
-
nickname: 'main-vault',
|
|
97
|
-
publicMetadata,
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
If you want to override the default workspace directory:
|
|
49
|
+
### 2. Recover an Existing Vault
|
|
102
50
|
|
|
103
51
|
```ts
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
52
|
+
import { recoverVault, FsStorageProvider } from '@the-ai-company/cbio-node-runtime';
|
|
53
|
+
|
|
54
|
+
const vault = await recoverVault(storage, {
|
|
55
|
+
vaultId: 'main-vault',
|
|
56
|
+
password: 'your-secure-password'
|
|
108
57
|
});
|
|
109
58
|
```
|
|
110
59
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
By default, the SDK uses a local directory (e.g., `~/cbio/`) as the **Workspace Root**.
|
|
114
|
-
- `createVault({ ... })`: Automatically creates a sub-directory `vaults/<vault-id>/` and returns a **Prefixed Storage** anchored to that sub-directory.
|
|
115
|
-
- **Important**: When you receive a `storage` object from `createVault`, it is already pointing *inside* the vault's own space. Subsequent calls to `recoverVault` or other high-level APIs using this storage will resolve paths correctly relative to this anchor.
|
|
116
|
-
|
|
117
|
-
### CRUD & Metadata
|
|
118
|
-
The SDK provides a complete lifecycle for vaults and secrets:
|
|
119
|
-
1. **Creation**: `createVault`
|
|
120
|
-
2. **Discovery/Read**: `listVaults`, `recoverVault`
|
|
121
|
-
3. **Update**: `updateVaultMetadata` (e.g., for nicknames)
|
|
122
|
-
4. **Management**: `listAgents`, `listCapabilities`, `revokeCapability` (via Client)
|
|
123
|
-
5. **Deletion**: `deleteSecret` (via Client) or manual storage cleanup for entire vaults.
|
|
124
|
-
|
|
125
|
-
and `vault/public/` (signed discovery).
|
|
126
|
-
|
|
127
|
-
Every identity also has its own private namespace for encrypted metadata, and a companion discovery area for public information.
|
|
128
|
-
|
|
129
|
-
## Architecture
|
|
130
|
-
|
|
131
|
-
Core terms:
|
|
132
|
-
|
|
133
|
-
- `identity`
|
|
134
|
-
An external principal represented by a public/private keypair.
|
|
135
|
-
- `owner`
|
|
136
|
-
The single admin role that a vault binds to one identity.
|
|
137
|
-
- `agent`
|
|
138
|
-
A delegated role that a vault binds to an identity registered by the owner.
|
|
139
|
-
|
|
140
|
-
Important role rule:
|
|
141
|
-
|
|
142
|
-
- outside the vault there are only identities
|
|
143
|
-
- inside a specific vault, those identities may be bound to roles such as `owner` or `agent`
|
|
144
|
-
- root identities are independent
|
|
145
|
-
- child identities may be deterministically derived from a parent identity
|
|
146
|
-
|
|
147
|
-
The public runtime surface follows four hard rules:
|
|
148
|
-
|
|
149
|
-
1. Secret plaintext lives only in vault core.
|
|
150
|
-
2. Only owner and vault-trusted acquisition paths may write secrets.
|
|
151
|
-
3. Secrets are dispatched only to owner-approved or issuer-bound targets.
|
|
152
|
-
4. Vault validates and audits everything.
|
|
153
|
-
|
|
154
|
-
The current HTTP-facing interface distinguishes two supported secret-flow classes:
|
|
155
|
-
|
|
156
|
-
- `A` / `acquire_secret`
|
|
157
|
-
No secret leaves the vault. A secret is extracted from the response and stored into the vault. Agent-visible output includes only protocol metadata plus a redacted response shape.
|
|
158
|
-
- `B` / `send_secret`
|
|
159
|
-
A stored secret is sent to an owner-approved target. The response is treated as normal business output and may be returned to the agent.
|
|
160
|
-
|
|
161
|
-
This is an intentional boundary choice:
|
|
162
|
-
|
|
163
|
-
- acquisition responses are treated as sensitive because they may contain newly issued secret material
|
|
164
|
-
- dispatch responses are treated as ordinary protocol results because the operation itself is a standard secret-backed HTTP call to an owner-approved target
|
|
60
|
+
### 3. Managed Agent Identities
|
|
165
61
|
|
|
166
|
-
|
|
62
|
+
You can generate and register agents directly within the vault. The vault holds the private keys for full custody.
|
|
167
63
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
- acquisition is explicit and redacted
|
|
171
|
-
- secret-backed dispatch is explicit and capability-gated
|
|
172
|
-
- unsupported `C` / `D` style flows are not part of the current surface
|
|
173
|
-
|
|
174
|
-
Owner-defined HTTP boundaries share one factory layer:
|
|
175
|
-
|
|
176
|
-
- `createOwnerHttpFlowBoundary(...)`
|
|
177
|
-
- `createStandardAcquireBoundary(...)`
|
|
178
|
-
- `createStandardDispatchBoundary(...)`
|
|
179
|
-
|
|
180
|
-
An owner-defined exception path also exists for non-standard but intentional integrations:
|
|
181
|
-
|
|
182
|
-
- owner may register a `custom_http` flow
|
|
183
|
-
- the flow fixes mode, target, method, and response visibility inside the vault
|
|
184
|
-
- agent may only invoke the registered `customFlowId`
|
|
185
|
-
- this is an explicit escape hatch, not the default path
|
|
186
|
-
|
|
187
|
-
## Status
|
|
64
|
+
```ts
|
|
65
|
+
import { createVaultClient } from '@the-ai-company/cbio-node-runtime';
|
|
188
66
|
|
|
189
|
-
|
|
190
|
-
This package now exposes the production local vault runtime surface as the primary API.
|
|
67
|
+
const client = createVaultClient({ vault: vault.vault });
|
|
191
68
|
|
|
192
|
-
|
|
69
|
+
// Generate and register a new agent in one step
|
|
70
|
+
const [agentRecord, agentPrivateKey] = await client.createAgent({
|
|
71
|
+
agentId: 'worker-1',
|
|
72
|
+
nickname: 'Background Worker'
|
|
73
|
+
});
|
|
193
74
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const agentIdentity = createIdentity({ nickname: 'agent-worker' });
|
|
197
|
-
const createdVault = await createVault({ ownerIdentity });
|
|
198
|
-
const client = createVaultClient({ ownerIdentity, vault: createdVault.vault });
|
|
199
|
-
const agent = createAgentClient({ agentIdentity, capability, vault: createdVault.vault });
|
|
75
|
+
console.log(`Agent public key: ${agentRecord.publicKey}`);
|
|
76
|
+
// Private key is returned during creation and stored securely in the vault.
|
|
200
77
|
```
|
|
201
78
|
|
|
202
|
-
|
|
79
|
+
### 4. Secret Management (Owner)
|
|
203
80
|
|
|
204
81
|
```ts
|
|
205
|
-
|
|
82
|
+
// Write a secret and bind it to a target site
|
|
83
|
+
const record = await client.writeSecret({
|
|
206
84
|
alias: 'api-token',
|
|
207
|
-
plaintext: 'secret-value',
|
|
85
|
+
plaintext: 'super-secret-value',
|
|
86
|
+
targetBindings: [{
|
|
87
|
+
kind: 'site',
|
|
88
|
+
targetId: 'my-api',
|
|
89
|
+
targetUrl: 'https://api.example.com/endpoint',
|
|
90
|
+
methods: ['POST']
|
|
91
|
+
}]
|
|
208
92
|
});
|
|
209
93
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
94
|
+
// Grant the agent capability to use this secret
|
|
95
|
+
await client.grantCapability({
|
|
96
|
+
capability: {
|
|
97
|
+
vaultId: vault.vaultId,
|
|
98
|
+
capabilityId: 'cap-1',
|
|
99
|
+
agentId: 'worker-1',
|
|
100
|
+
secretAliases: ['api-token'],
|
|
101
|
+
operation: 'dispatch_http',
|
|
102
|
+
allowedTargets: ['https://api.example.com/endpoint'],
|
|
103
|
+
allowedMethods: ['POST'],
|
|
104
|
+
issuedAt: new Date().toISOString()
|
|
105
|
+
}
|
|
220
106
|
});
|
|
221
107
|
```
|
|
222
108
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
Capability example:
|
|
226
|
-
|
|
227
|
-
```ts
|
|
228
|
-
const capability = {
|
|
229
|
-
vaultId: vault.vaultId,
|
|
230
|
-
capabilityId: 'cap-1',
|
|
231
|
-
agentId: agentIdentity.identityId,
|
|
232
|
-
secretAliases: ['api-token'],
|
|
233
|
-
operation: 'dispatch_http',
|
|
234
|
-
allowedTargets: ['https://api.example.com/endpoint'],
|
|
235
|
-
allowedMethods: ['POST'],
|
|
236
|
-
issuedAt: new Date().toISOString(),
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
await client.grantCapability({ capability });
|
|
240
|
-
```
|
|
109
|
+
### 5. Consuming Secrets (Agent)
|
|
241
110
|
|
|
242
|
-
|
|
111
|
+
Agents run in isolated processes and communicate with the vault via a transport.
|
|
243
112
|
|
|
244
113
|
```ts
|
|
245
|
-
|
|
246
|
-
flowId: 'custom-status-read',
|
|
247
|
-
...createOwnerHttpFlowBoundary({
|
|
248
|
-
mode: 'send_secret',
|
|
249
|
-
targetUrl: 'https://api.example.com/custom-status',
|
|
250
|
-
method: 'POST',
|
|
251
|
-
responseVisibility: 'shape_only',
|
|
252
|
-
}),
|
|
253
|
-
});
|
|
254
|
-
```
|
|
114
|
+
import { createAgentClient, LocalSigner } from '@the-ai-company/cbio-node-runtime';
|
|
255
115
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
responseField: 'access_token',
|
|
262
|
-
storeAlias: 'issuer-token',
|
|
116
|
+
const agent = createAgentClient({
|
|
117
|
+
agentIdentity: { agentId: 'worker-1' },
|
|
118
|
+
capability: myCapability, // Shared with the agent
|
|
119
|
+
vault: vault.vault, // Remote or local transport
|
|
120
|
+
signer: new LocalSigner({ privateKey: agentPrivateKey })
|
|
263
121
|
});
|
|
264
122
|
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
method: acquireBoundary.method,
|
|
123
|
+
const result = await agent.dispatch({
|
|
124
|
+
secretAlias: 'api-token',
|
|
125
|
+
targetUrl: 'https://api.example.com/endpoint',
|
|
126
|
+
method: 'POST',
|
|
127
|
+
body: '{"data": "..."}'
|
|
271
128
|
});
|
|
129
|
+
```
|
|
272
130
|
|
|
273
|
-
|
|
274
|
-
// { token_type: 'Bearer', expires_in: 3600, scope: 'read write' }
|
|
275
|
-
|
|
276
|
-
const exported = await client.exportSecret({
|
|
277
|
-
alias: 'issuer-token',
|
|
278
|
-
});
|
|
131
|
+
---
|
|
279
132
|
|
|
280
|
-
|
|
281
|
-
```
|
|
133
|
+
## Documentation
|
|
282
134
|
|
|
283
|
-
|
|
135
|
+
- [Custody Model](docs/CUSTODY_MODEL.md) - Understanding managed agency and key storage.
|
|
136
|
+
- [Process Isolation](docs/PROCESS_ISOLATION.md) - Guidelines for A/B architecture.
|
|
284
137
|
|
|
285
|
-
|
|
286
|
-
const ownerIdentity = createIdentity({ nickname: 'owner-main' });
|
|
287
|
-
const storage = new FsStorageProvider('/tmp/cbio-vault');
|
|
288
|
-
const createdVault = await createVault(storage, {
|
|
289
|
-
vaultId: 'vault-persistent',
|
|
290
|
-
ownerIdentity,
|
|
291
|
-
});
|
|
138
|
+
## Architecture Rules
|
|
292
139
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
```
|
|
140
|
+
1. **Secret Isolation**: Plane-text secrets never leave the Security Process.
|
|
141
|
+
2. **Authority Root**: The master password is the only source of administrative authority.
|
|
142
|
+
3. **Auditability**: Every administrative and agent action is recorded in the vault's audit log under the `vault-master` or agent principal.
|
|
143
|
+
4. **Binary Discovery**: Either the vault is unlocked and visible, or it is a silent directory of encrypted shards.
|
|
298
144
|
|
|
299
|
-
## Build
|
|
145
|
+
## Build & Test
|
|
300
146
|
|
|
301
147
|
```bash
|
|
302
148
|
npm run build
|
|
303
|
-
npm
|
|
149
|
+
npm test
|
|
304
150
|
```
|
|
@@ -19,17 +19,29 @@ class DefaultAgentClient {
|
|
|
19
19
|
_signer;
|
|
20
20
|
_transport;
|
|
21
21
|
_clock;
|
|
22
|
-
|
|
22
|
+
_token;
|
|
23
|
+
constructor(_identity, _capability, _signer, _transport, _clock, _token) {
|
|
23
24
|
this._identity = _identity;
|
|
24
25
|
this._capability = _capability;
|
|
25
26
|
this._signer = _signer;
|
|
26
27
|
this._transport = _transport;
|
|
27
28
|
this._clock = _clock;
|
|
29
|
+
this._token = _token;
|
|
28
30
|
}
|
|
29
31
|
async dispatch(intent) {
|
|
30
32
|
const requestedAt = intent.requestedAt ?? this._clock.nowIso();
|
|
31
33
|
const requestId = `${this._identity.agentId}:${requestedAt}:${intent.secretAlias ?? "no-secret"}:${intent.method}`;
|
|
32
|
-
|
|
34
|
+
let signature;
|
|
35
|
+
if (this._token) {
|
|
36
|
+
// Use token-based authentication
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Use signature-based authentication
|
|
40
|
+
if (!this._signer) {
|
|
41
|
+
throw new Error("AgentClient: signer required for signature-based authentication when no token is provided");
|
|
42
|
+
}
|
|
43
|
+
signature = await this._signer.sign(createDispatchBinding(requestId, requestedAt, this._identity.agentId, this._capability.capabilityId, intent.secretAlias, intent.targetUrl, intent.method, intent.body));
|
|
44
|
+
}
|
|
33
45
|
return this._transport.dispatch({
|
|
34
46
|
vaultId: this._capability.vaultId,
|
|
35
47
|
requestId,
|
|
@@ -57,6 +69,7 @@ class DefaultAgentClient {
|
|
|
57
69
|
proof: {
|
|
58
70
|
agentId: this._identity.agentId,
|
|
59
71
|
signature,
|
|
72
|
+
token: this._token,
|
|
60
73
|
requestId,
|
|
61
74
|
requestedAt,
|
|
62
75
|
},
|
|
@@ -74,14 +87,17 @@ function isCreateAgentClientOptions(value) {
|
|
|
74
87
|
function isCreatedIdentity(value) {
|
|
75
88
|
return "privateKey" in value && "publicKey" in value;
|
|
76
89
|
}
|
|
77
|
-
function resolveAgentSigner(
|
|
78
|
-
if (signer) {
|
|
79
|
-
return signer;
|
|
90
|
+
function resolveAgentSigner(options) {
|
|
91
|
+
if (options.signer) {
|
|
92
|
+
return options.signer;
|
|
80
93
|
}
|
|
81
|
-
if (isCreatedIdentity(
|
|
82
|
-
return new LocalSigner(
|
|
94
|
+
if (isCreatedIdentity(options.agentIdentity)) {
|
|
95
|
+
return new LocalSigner(options.agentIdentity);
|
|
83
96
|
}
|
|
84
|
-
|
|
97
|
+
if (options.token) {
|
|
98
|
+
return undefined; // No signer needed if token is present
|
|
99
|
+
}
|
|
100
|
+
throw new Error("createAgentClient() requires signer or private key when no session token is provided");
|
|
85
101
|
}
|
|
86
102
|
function resolveAgentIdentity(options) {
|
|
87
103
|
return "agentId" in options.agentIdentity
|
|
@@ -116,6 +132,6 @@ export function createAgentClient(options) {
|
|
|
116
132
|
if (!isCreateAgentClientOptions(options)) {
|
|
117
133
|
throw new Error("createAgentClient() requires a single options object");
|
|
118
134
|
}
|
|
119
|
-
return new DefaultAgentClient(resolveAgentIdentity(options), options.capability, resolveAgentSigner(options
|
|
135
|
+
return new DefaultAgentClient(resolveAgentIdentity(options), options.capability, resolveAgentSigner(options), resolveAgentTransport(options), options.clock ?? new SystemClock(), options.token);
|
|
120
136
|
}
|
|
121
137
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/agent/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/ag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CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,qBAAqB,CAC5B,OAAiC;IAEjC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC,SAAS,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IACjE,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,IAAI,kBAAkB,CAC3B,oBAAoB,CAAC,OAAO,CAAC,EAC7B,OAAO,CAAC,UAAU,EAClB,kBAAkB,CAAC,OAAO,CAAC,EAC3B,qBAAqB,CAAC,OAAO,CAAC,EAC9B,OAAO,CAAC,KAAK,IAAI,IAAI,WAAW,EAAE,EAClC,OAAO,CAAC,KAAK,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CreatedIdentity } from "../../runtime/identity.js";
|
|
2
2
|
import { type Clock } from "../../vault-core/index.js";
|
|
3
3
|
import type { VaultService } from "../../vault-ingress/index.js";
|
|
4
|
-
import type { VaultAuditQueryInput, OwnerDefineSecretTargetsInput, VaultExportSecretInput, VaultGrantCapabilityInput, VaultRegisterFlowInput, VaultRegisterAgentInput, OwnerStoreSecretInput, OwnerWriteSecretInput, VaultDeleteSecretInput, VaultListAgentsInput, VaultListCapabilitiesInput, VaultRevokeCapabilityInput } from "./contracts.js";
|
|
4
|
+
import type { VaultAuditQueryInput, OwnerDefineSecretTargetsInput, VaultExportSecretInput, VaultGrantCapabilityInput, VaultRegisterFlowInput, VaultRegisterAgentInput, VaultCreateAgentInput, OwnerStoreSecretInput, OwnerWriteSecretInput, VaultDeleteSecretInput, VaultListAgentsInput, VaultListCapabilitiesInput, VaultRevokeCapabilityInput } from "./contracts.js";
|
|
5
5
|
export interface VaultIdentity {
|
|
6
6
|
identityId: string;
|
|
7
7
|
}
|
|
@@ -37,10 +37,12 @@ export interface VaultClient {
|
|
|
37
37
|
* Reads the tamper-evident audit log for the vault.
|
|
38
38
|
*/
|
|
39
39
|
readAudit(query?: VaultAuditQueryInput): Promise<readonly import("../../vault-core/index.js").AuditEntry[]>;
|
|
40
|
+
registerAgent(input: VaultRegisterAgentInput): Promise<void>;
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
+
* Generates a new identity and registers it as an agent in one step.
|
|
43
|
+
* The private key is stored in the vault for managed custody.
|
|
42
44
|
*/
|
|
43
|
-
|
|
45
|
+
createAgent(input: VaultCreateAgentInput): Promise<readonly [import("../../vault-core/index.js").AgentIdentityRecord, string]>;
|
|
44
46
|
/**
|
|
45
47
|
* Registers a custom HTTP flow for complex secret usage.
|
|
46
48
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LocalSigner } from "../../protocol/crypto.js";
|
|
2
|
+
import { createIdentity } from "../../runtime/identity.js";
|
|
2
3
|
import { SystemClock } from "../../vault-core/index.js";
|
|
3
4
|
const VAULT_MASTER_ID = "vault-master";
|
|
4
5
|
class DefaultVaultClient {
|
|
@@ -100,6 +101,9 @@ class DefaultVaultClient {
|
|
|
100
101
|
vaultId: this._vault.vaultId,
|
|
101
102
|
agentId: input.agentId,
|
|
102
103
|
publicKey: input.publicKey,
|
|
104
|
+
privateKey: input.privateKey,
|
|
105
|
+
metadata: input.metadata,
|
|
106
|
+
nickname: input.nickname,
|
|
103
107
|
};
|
|
104
108
|
await this._vault.registerAgentIdentity({
|
|
105
109
|
vaultId: this._vault.vaultId,
|
|
@@ -112,6 +116,19 @@ class DefaultVaultClient {
|
|
|
112
116
|
requestedAt,
|
|
113
117
|
});
|
|
114
118
|
}
|
|
119
|
+
async createAgent(input) {
|
|
120
|
+
const identity = createIdentity();
|
|
121
|
+
const record = {
|
|
122
|
+
vaultId: this._vault.vaultId,
|
|
123
|
+
agentId: input.agentId,
|
|
124
|
+
publicKey: identity.publicKey,
|
|
125
|
+
privateKey: identity.privateKey,
|
|
126
|
+
metadata: input.metadata,
|
|
127
|
+
nickname: input.nickname,
|
|
128
|
+
};
|
|
129
|
+
await this.registerAgent(record);
|
|
130
|
+
return [record, identity.privateKey];
|
|
131
|
+
}
|
|
115
132
|
async grantCapability(input) {
|
|
116
133
|
const requestedAt = input.requestedAt ?? this._clock.nowIso();
|
|
117
134
|
const requestId = `${this._identityId}:${requestedAt}:${input.capability.capabilityId}:register_capability`;
|
|
@@ -208,6 +225,30 @@ class DefaultVaultClient {
|
|
|
208
225
|
capabilityId: input.capabilityId,
|
|
209
226
|
});
|
|
210
227
|
}
|
|
228
|
+
async issueSessionToken(input) {
|
|
229
|
+
const requestedAt = input.requestedAt ?? this._clock.nowIso();
|
|
230
|
+
const requestId = `${this._identityId}:${requestedAt}:issue_session_token`;
|
|
231
|
+
return this._vault.issueSessionToken({
|
|
232
|
+
vaultId: this._vault.vaultId,
|
|
233
|
+
actor: {
|
|
234
|
+
kind: "owner",
|
|
235
|
+
id: this._identityId,
|
|
236
|
+
},
|
|
237
|
+
agentId: input.agentId,
|
|
238
|
+
requestId,
|
|
239
|
+
requestedAt,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async revokeSessionToken(input) {
|
|
243
|
+
return this._vault.revokeSessionToken({
|
|
244
|
+
vaultId: this._vault.vaultId,
|
|
245
|
+
actor: {
|
|
246
|
+
kind: "owner",
|
|
247
|
+
id: this._identityId,
|
|
248
|
+
},
|
|
249
|
+
token: input.token,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
211
252
|
}
|
|
212
253
|
function isCreateVaultClientOptions(value) {
|
|
213
254
|
return typeof value === "object" && value !== null && "vault" in value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/owner/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/owner/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAwB,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;AAwGpE,MAAM,eAAe,GAAG,cAAc,CAAC;AAEvC,MAAM,kBAAkB;IAIH;IACA;IACA;IACA;IANF,WAAW,CAAS;IAErC,YACmB,MAAoB,EACpB,SAAyB,EACzB,OAAqB,EACrB,SAAgB,IAAI,WAAW,EAAE;QAHjC,WAAM,GAAN,MAAM,CAAc;QACpB,cAAS,GAAT,SAAS,CAAgB;QACzB,YAAO,GAAP,OAAO,CAAc;QACrB,WAAM,GAAN,MAAM,CAA2B;QAElD,IAAI,CAAC,WAAW,GAAG,SAAS,EAAE,UAAU,IAAI,eAAe,CAAC;IAC9D,CAAC;IAED,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,WAAW,IAAI,WAAW,IAAI,KAAK,CAAC,KAAK,eAAe,CAAC;QAEnF,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;YAC7B,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5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