@the-ai-company/cbio-node-runtime 1.5.0 → 1.7.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 CHANGED
@@ -42,7 +42,8 @@ import {
42
42
  createVaultService,
43
43
  createDefaultVaultCoreDependencies,
44
44
  createIdentity,
45
- createOwnedVault,
45
+ restoreIdentity,
46
+ createVault,
46
47
  recoverVault,
47
48
  createOwnerHttpFlowBoundary,
48
49
  createStandardAcquireBoundary,
@@ -54,6 +55,12 @@ import {
54
55
  } from '@the-ai-company/cbio-node-runtime';
55
56
  ```
56
57
 
58
+ Identity restore example:
59
+
60
+ ```ts
61
+ const identity = restoreIdentity(existingPrivateKey);
62
+ ```
63
+
57
64
  ## Architecture
58
65
 
59
66
  Core terms:
@@ -133,8 +140,8 @@ This package now exposes the production local vault runtime surface as the prima
133
140
  ## Example Shape
134
141
 
135
142
  ```ts
136
- const ownerIdentity = createIdentity();
137
- const agentIdentity = createIdentity();
143
+ const ownerIdentity = createIdentity({ nickname: 'owner-main' });
144
+ const agentIdentity = createIdentity({ nickname: 'agent-worker' });
138
145
  const vault = createVaultService(createDefaultVaultCoreDependencies());
139
146
  const owner = createOwnerClient({ ownerId: ownerIdentity.identityId }, vault, new LocalSigner(ownerIdentity), clock);
140
147
  const transport = new LocalVaultTransport(vault, capability.capabilityId);
@@ -202,15 +209,11 @@ console.log(exported.plaintext);
202
209
  Persistent custody bootstrap example:
203
210
 
204
211
  ```ts
205
- const ownerIdentity = createIdentity();
212
+ const ownerIdentity = createIdentity({ nickname: 'owner-main' });
206
213
  const storage = new FsStorageProvider('/tmp/cbio-vault');
207
- const createdVault = await createOwnedVault(storage, {
214
+ const createdVault = await createVault(storage, {
208
215
  vaultId: 'vault-persistent',
209
- bootstrapOwner: {
210
- vaultId: { value: 'vault-persistent' },
211
- ownerId: ownerIdentity.identityId,
212
- publicKey: ownerIdentity.publicKey,
213
- },
216
+ ownerIdentity,
214
217
  });
215
218
 
216
219
  // Show once to the owner and let them store it offline.
@@ -1,15 +1,16 @@
1
- import { type CreatePersistentVaultCoreDependenciesOptions, type InitializedVaultCustody, type InitializeVaultCustodyOptions, type OwnerIdentityRecord, type VaultCore } from "../vault-core/index.js";
1
+ import { type CreatePersistentVaultCoreDependenciesOptions, type InitializedVaultCustody, type InitializeVaultCustodyOptions, type VaultCore } from "../vault-core/index.js";
2
2
  import { type VaultService, type VaultCustomFlowResolver } from "../vault-ingress/index.js";
3
3
  import type { IStorageProvider } from "../storage/provider.js";
4
- export interface CreateOwnedVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
4
+ import type { CreatedIdentity } from "./identity.js";
5
+ export interface CreateVaultOptions extends Omit<CreatePersistentVaultCoreDependenciesOptions, "vaultWorkingKey"> {
5
6
  custody?: InitializeVaultCustodyOptions;
6
- bootstrapOwner: OwnerIdentityRecord;
7
+ ownerIdentity: CreatedIdentity;
7
8
  vault?: {
8
9
  customFlows?: VaultCustomFlowResolver;
9
10
  fetchImpl?: typeof fetch;
10
11
  };
11
12
  }
12
- export interface CreatedOwnedVault {
13
+ export interface CreatedVault {
13
14
  initializedCustody: InitializedVaultCustody;
14
15
  core: VaultCore;
15
16
  vault: VaultService;
@@ -27,5 +28,5 @@ export interface RecoveredVault {
27
28
  core: VaultCore;
28
29
  vault: VaultService;
29
30
  }
30
- export declare function createOwnedVault(storage: IStorageProvider, options: CreateOwnedVaultOptions): Promise<CreatedOwnedVault>;
31
+ export declare function createVault(storage: IStorageProvider, options: CreateVaultOptions): Promise<CreatedVault>;
31
32
  export declare function recoverVault(storage: IStorageProvider, options: RecoverVaultOptions): Promise<RecoveredVault>;
@@ -1,14 +1,19 @@
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 createOwnedVault(storage, options) {
4
+ export async function createVault(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
- await core.bootstrapOwnerIdentity(options.bootstrapOwner);
11
+ const bootstrapOwner = {
12
+ vaultId: core.vaultId,
13
+ ownerId: options.ownerIdentity.identityId,
14
+ publicKey: options.ownerIdentity.publicKey,
15
+ };
16
+ await core.bootstrapOwnerIdentity(bootstrapOwner);
12
17
  return {
13
18
  initializedCustody,
14
19
  core,
@@ -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,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,MAA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I,CAAC,sBAAsB,CAAC,cAAc,CAAC,CAAC;IAClD,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"}
@@ -1,6 +1,14 @@
1
1
  export interface CreatedIdentity {
2
2
  identityId: string;
3
+ nickname?: string;
3
4
  publicKey: string;
4
5
  privateKey: string;
5
6
  }
6
- export declare function createIdentity(): CreatedIdentity;
7
+ export interface CreateIdentityOptions {
8
+ nickname?: string;
9
+ }
10
+ export interface RestoreIdentityOptions {
11
+ nickname?: string;
12
+ }
13
+ export declare function createIdentity(options?: CreateIdentityOptions): CreatedIdentity;
14
+ export declare function restoreIdentity(privateKey: string, options?: RestoreIdentityOptions): CreatedIdentity;
@@ -1,14 +1,30 @@
1
- import { generateIdentityKeys } from "../protocol/crypto.js";
1
+ import { derivePublicKey, generateIdentityKeys } from "../protocol/crypto.js";
2
2
  import { deriveRootAgentId } from "../protocol/identity.js";
3
- export function createIdentity() {
3
+ export function createIdentity(options = {}) {
4
4
  const keyPair = generateIdentityKeys();
5
5
  if (!keyPair.publicKey || !keyPair.privateKey) {
6
6
  throw new Error("identity generation failed");
7
7
  }
8
+ const nickname = options.nickname?.trim() ? options.nickname.trim() : undefined;
8
9
  return {
9
10
  identityId: deriveRootAgentId(keyPair.publicKey),
11
+ nickname,
10
12
  publicKey: keyPair.publicKey,
11
13
  privateKey: keyPair.privateKey,
12
14
  };
13
15
  }
16
+ export function restoreIdentity(privateKey, options = {}) {
17
+ const normalizedPrivateKey = privateKey.trim();
18
+ if (!normalizedPrivateKey) {
19
+ throw new Error("private key is required");
20
+ }
21
+ const publicKey = derivePublicKey(normalizedPrivateKey);
22
+ const nickname = options.nickname?.trim() ? options.nickname.trim() : undefined;
23
+ return {
24
+ identityId: deriveRootAgentId(publicKey),
25
+ nickname,
26
+ publicKey,
27
+ privateKey: normalizedPrivateKey,
28
+ };
29
+ }
14
30
  //# sourceMappingURL=identity.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../src/runtime/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAiB5D,MAAM,UAAU,cAAc,CAAC,UAAiC,EAAE;IAChE,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,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,OAAO;QACL,UAAU,EAAE,iBAAiB,CAAC,OAAO,CAAC,SAAS,CAAC;QAChD,QAAQ;QACR,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,UAAkC,EAAE;IACtF,MAAM,oBAAoB,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IAC/C,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,SAAS,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,OAAO;QACL,UAAU,EAAE,iBAAiB,CAAC,SAAS,CAAC;QACxC,QAAQ;QACR,SAAS;QACT,UAAU,EAAE,oBAAoB;KACjC,CAAC;AACJ,CAAC"}
@@ -7,8 +7,8 @@ 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 { createIdentity, type CreatedIdentity, } from "./identity.js";
11
- export { createOwnedVault, recoverVault, type CreateOwnedVaultOptions, type CreatedOwnedVault, type RecoverVaultOptions, type RecoveredVault, } from "./bootstrap.js";
10
+ export { createIdentity, restoreIdentity, type CreateIdentityOptions, type RestoreIdentityOptions, type CreatedIdentity, } from "./identity.js";
11
+ export { createVault, recoverVault, type CreateVaultOptions, type CreatedVault, type RecoverVaultOptions, type RecoveredVault, } from "./bootstrap.js";
12
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
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";
14
14
  export { createAgentClient, type AgentClient, type AgentIdentity, type AgentCapabilityEnvelope, type AgentDispatchIntent, type AgentDispatchTransport, type AgentSigner, } from "../clients/agent/index.js";
@@ -6,8 +6,8 @@ export { IdentityError, IdentityErrorCode } from "../errors.js";
6
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 { createIdentity, } from "./identity.js";
10
- export { createOwnedVault, recoverVault, } from "./bootstrap.js";
9
+ export { createIdentity, restoreIdentity, } from "./identity.js";
10
+ export { createVault, recoverVault, } from "./bootstrap.js";
11
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";
12
12
  export { createOwnerClient, } from "../clients/owner/index.js";
13
13
  export { createAgentClient, } from "../clients/agent/index.js";
@@ -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,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EACL,cAAc,GAEf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,YAAY,GAKb,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,iCAAiC,EACjC,2CAA2C,EAC3C,qCAAqC,EACrC,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,oBAAoB,EACpB,6BAA6B,EAC7B,0BAA0B,EAC1B,oCAAoC,EACpC,8BAA8B,EAC9B,sBAAsB,EACtB,mBAAmB,EACnB,gBAAg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AAgB,EAChB,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAE3B,2BAA2B,EAC3B,WAAW,GA8CZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,iBAAiB,GAWlB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,iBAAiB,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"}
@@ -9,7 +9,7 @@ Related design note:
9
9
 
10
10
  Recommended persistent-vault lifecycle:
11
11
 
12
- - create through `createOwnedVault(...)`
12
+ - create through `createVault(...)`
13
13
  - recover through `recoverVault(...)`
14
14
 
15
15
  ## Identity And Roles
@@ -144,7 +144,7 @@ Future hardening such as MFA/TOTP may be added on top of this model, but it does
144
144
 
145
145
  The runtime now includes:
146
146
 
147
- 1. formal owned-vault creation through `createOwnedVault(...)`
147
+ 1. formal vault creation through `createVault(...)`
148
148
  2. formal recovery-key based re-entry through `recoverVault(...)`
149
149
  3. explicit `vaultWorkingKey` terminology in the persistent dependency surface
150
150
  4. continued support for explicit owner export through `exportSecret(...)`
@@ -74,6 +74,10 @@ Examples:
74
74
 
75
75
  These should be treated as labels, aliases, or local names rather than the deepest identity truth.
76
76
 
77
+ The runtime now exposes this concept directly as optional `nickname` on `createIdentity(...)`.
78
+
79
+ For existing private keys, the runtime exposes `restoreIdentity(...)`, which reconstructs the same identity shape from the private key alone.
80
+
77
81
  In other words:
78
82
 
79
83
  - public key or a stable derived id answers "who is this cryptographically"
package/docs/REFERENCE.md CHANGED
@@ -18,7 +18,8 @@ The main constructors are:
18
18
  - `createVaultCore(...)`
19
19
  - `createVaultService(...)`
20
20
  - `createIdentity(...)`
21
- - `createOwnedVault(...)`
21
+ - `restoreIdentity(...)`
22
+ - `createVault(...)`
22
23
  - `recoverVault(...)`
23
24
  - `createOwnerClient(...)`
24
25
  - `createAgentClient(...)`
@@ -30,7 +31,7 @@ Related design note:
30
31
 
31
32
  Recommended persistent-vault entrypoints:
32
33
 
33
- - `createOwnedVault(...)`
34
+ - `createVault(...)`
34
35
  - `recoverVault(...)`
35
36
 
36
37
  Lower-level custody helpers:
@@ -54,6 +55,19 @@ Role rules:
54
55
  - identities are independent; there is no built-in lineage or inheritance between identities
55
56
  - the same identity may be `owner` in one vault and `agent` in another
56
57
 
58
+ ## Identity Creation
59
+
60
+ `createIdentity(...)` returns:
61
+
62
+ - `identityId`
63
+ - `publicKey`
64
+ - `privateKey`
65
+ - optional `nickname`
66
+
67
+ `nickname` is human-readable only. It does not affect the derived `identityId`, cryptographic verification, or vault-local role binding.
68
+
69
+ `restoreIdentity(privateKey)` returns the same shape for an existing private key.
70
+
57
71
  ## Secret-Flow Model
58
72
 
59
73
  The current HTTP-facing API supports two explicit secret-flow classes:
package/docs/es/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @the-ai-company/cbio-node-runtime
20
20
  import {
21
21
  createVaultService,
22
22
  createIdentity,
23
- createOwnedVault,
23
+ createVault,
24
24
  recoverVault,
25
25
  LocalVaultTransport,
26
26
  createOwnerClient,
@@ -38,7 +38,7 @@ import {
38
38
 
39
39
  Ruta principal recomendada para vault persistente:
40
40
 
41
- - crear el vault persistente con `createOwnedVault(...)`
41
+ - crear el vault persistente con `createVault(...)`
42
42
  - recuperar el vault persistente con `recoverVault(...)` usando la recovery key
43
43
 
44
44
  La API antigua centrada en `CbioIdentity` ya no es la superficie principal del producto.
package/docs/fr/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @the-ai-company/cbio-node-runtime
20
20
  import {
21
21
  createVaultService,
22
22
  createIdentity,
23
- createOwnedVault,
23
+ createVault,
24
24
  recoverVault,
25
25
  LocalVaultTransport,
26
26
  createOwnerClient,
@@ -38,7 +38,7 @@ import {
38
38
 
39
39
  Chemin principal recommande pour un vault persistant :
40
40
 
41
- - creer le vault persistant avec `createOwnedVault(...)`
41
+ - creer le vault persistant avec `createVault(...)`
42
42
  - restaurer le vault persistant avec `recoverVault(...)` via la recovery key
43
43
 
44
44
  L'ancienne API centree sur `CbioIdentity` n'est plus la surface principale du produit.
package/docs/ja/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @the-ai-company/cbio-node-runtime
20
20
  import {
21
21
  createVaultService,
22
22
  createIdentity,
23
- createOwnedVault,
23
+ createVault,
24
24
  recoverVault,
25
25
  LocalVaultTransport,
26
26
  createOwnerClient,
@@ -38,7 +38,7 @@ import {
38
38
 
39
39
  推奨される persistent-vault の主経路:
40
40
 
41
- - `createOwnedVault(...)` で persistent vault を作成する
41
+ - `createVault(...)` で persistent vault を作成する
42
42
  - `recoverVault(...)` で recovery key を使って persistent vault を復旧する
43
43
 
44
44
  旧 `CbioIdentity` 中心 API は、もはや主要な公開面ではありません。
package/docs/ko/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @the-ai-company/cbio-node-runtime
20
20
  import {
21
21
  createVaultService,
22
22
  createIdentity,
23
- createOwnedVault,
23
+ createVault,
24
24
  recoverVault,
25
25
  LocalVaultTransport,
26
26
  createOwnerClient,
@@ -38,7 +38,7 @@ import {
38
38
 
39
39
  권장되는 persistent-vault 주 경로:
40
40
 
41
- - `createOwnedVault(...)` 로 persistent vault 를 생성합니다
41
+ - `createVault(...)` 로 persistent vault 를 생성합니다
42
42
  - `recoverVault(...)` 로 recovery key 를 사용해 persistent vault 를 복구합니다
43
43
 
44
44
  이전 `CbioIdentity` 중심 API 는 더 이상 주요 제품 표면이 아닙니다.
package/docs/pt/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @the-ai-company/cbio-node-runtime
20
20
  import {
21
21
  createVaultService,
22
22
  createIdentity,
23
- createOwnedVault,
23
+ createVault,
24
24
  recoverVault,
25
25
  LocalVaultTransport,
26
26
  createOwnerClient,
@@ -38,7 +38,7 @@ import {
38
38
 
39
39
  Caminho principal recomendado para vault persistente:
40
40
 
41
- - criar o vault persistente com `createOwnedVault(...)`
41
+ - criar o vault persistente com `createVault(...)`
42
42
  - recuperar o vault persistente com `recoverVault(...)` usando a recovery key
43
43
 
44
44
  A antiga API centrada em `CbioIdentity` nao e mais a superficie principal do produto.
package/docs/zh/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @the-ai-company/cbio-node-runtime
20
20
  import {
21
21
  createVaultService,
22
22
  createIdentity,
23
- createOwnedVault,
23
+ createVault,
24
24
  recoverVault,
25
25
  LocalVaultTransport,
26
26
  createOwnerClient,
@@ -38,7 +38,7 @@ import {
38
38
 
39
39
  推荐的持久化主路径:
40
40
 
41
- - 通过 `createOwnedVault(...)` 创建持久化 vault
41
+ - 通过 `createVault(...)` 创建持久化 vault
42
42
  - 通过 `recoverVault(...)` 用 recovery key 恢复持久化 vault
43
43
 
44
44
  ## 构建
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-ai-company/cbio-node-runtime",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Node.js runtime for cbio identity and credential vault. Library only, no CLI or TUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/runtime/index.js",