@vess-id/ai-identity 0.16.0-alpha.2 → 0.16.0-alpha.21

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 (109) hide show
  1. package/dist/agent/agent-did-manager.d.ts +48 -1
  2. package/dist/agent/agent-did-manager.d.ts.map +1 -1
  3. package/dist/client.d.ts +2 -2
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/config/index.d.ts +54 -0
  6. package/dist/config/index.d.ts.map +1 -1
  7. package/dist/did/agent.d.ts +7 -1
  8. package/dist/did/agent.d.ts.map +1 -1
  9. package/dist/identity/user-identity-manager.d.ts +55 -1
  10. package/dist/identity/user-identity-manager.d.ts.map +1 -1
  11. package/dist/index.d.mts +1336 -22738
  12. package/dist/index.d.ts +25 -14
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +30496 -3235
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +30482 -3233
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/registry/action-registry-json.d.ts +54 -22447
  19. package/dist/registry/action-registry-json.d.ts.map +1 -1
  20. package/dist/registry/action-registry.d.ts +34 -0
  21. package/dist/registry/action-registry.d.ts.map +1 -1
  22. package/dist/registry/action-risk.d.ts +64 -18
  23. package/dist/registry/action-risk.d.ts.map +1 -1
  24. package/dist/registry/action-summary.d.ts +23 -0
  25. package/dist/registry/action-summary.d.ts.map +1 -1
  26. package/dist/registry/index.d.ts +3 -3
  27. package/dist/registry/index.d.ts.map +1 -1
  28. package/dist/registry/providers.d.ts +22 -1
  29. package/dist/registry/providers.d.ts.map +1 -1
  30. package/dist/registry/resource-types.d.ts +17 -4
  31. package/dist/registry/resource-types.d.ts.map +1 -1
  32. package/dist/resolver/approval-time-resolution.d.ts +72 -0
  33. package/dist/resolver/approval-time-resolution.d.ts.map +1 -0
  34. package/dist/resolver/canonical-resource-id.d.ts +13 -0
  35. package/dist/resolver/canonical-resource-id.d.ts.map +1 -1
  36. package/dist/resolver/hierarchical-match.d.ts +60 -0
  37. package/dist/resolver/hierarchical-match.d.ts.map +1 -0
  38. package/dist/resolver/salient-digest.d.ts +48 -0
  39. package/dist/resolver/salient-digest.d.ts.map +1 -0
  40. package/dist/resolver/target-resolver.d.ts +25 -0
  41. package/dist/resolver/target-resolver.d.ts.map +1 -1
  42. package/dist/tool/tool-manager.d.ts.map +1 -1
  43. package/dist/types/connector-plugin.d.ts +72 -2
  44. package/dist/types/connector-plugin.d.ts.map +1 -1
  45. package/dist/types/grant.d.ts +27 -4
  46. package/dist/types/grant.d.ts.map +1 -1
  47. package/dist/types/intent.d.ts +2 -2
  48. package/dist/types/intent.d.ts.map +1 -1
  49. package/dist/types/permission-mode.d.ts +1 -1
  50. package/dist/types/permission-mode.d.ts.map +1 -1
  51. package/dist/types/permission-vc.d.ts +94 -0
  52. package/dist/types/permission-vc.d.ts.map +1 -1
  53. package/dist/types/target-binding.d.ts +29 -1
  54. package/dist/types/target-binding.d.ts.map +1 -1
  55. package/dist/types/vc.d.ts +11 -1
  56. package/dist/types/vc.d.ts.map +1 -1
  57. package/dist/utils/sdjwt-client.d.ts +242 -5
  58. package/dist/utils/sdjwt-client.d.ts.map +1 -1
  59. package/dist/utils/sdjwt-disclosure.d.ts.map +1 -1
  60. package/dist/vc/api-vc-manager.d.ts +5 -0
  61. package/dist/vc/api-vc-manager.d.ts.map +1 -1
  62. package/dist/vc/vc-manager.d.ts.map +1 -1
  63. package/dist/vp/vp-manager.d.ts +35 -0
  64. package/dist/vp/vp-manager.d.ts.map +1 -1
  65. package/package.json +14 -3
  66. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts +0 -56
  67. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts.map +0 -1
  68. package/dist/internal-signature/__tests__/canonical.spec.d.ts +0 -2
  69. package/dist/internal-signature/__tests__/canonical.spec.d.ts.map +0 -1
  70. package/dist/internal-signature/__tests__/signer-roundtrip.spec.d.ts +0 -2
  71. package/dist/internal-signature/__tests__/signer-roundtrip.spec.d.ts.map +0 -1
  72. package/dist/internal-signature/__tests__/signer.spec.d.ts +0 -2
  73. package/dist/internal-signature/__tests__/signer.spec.d.ts.map +0 -1
  74. package/dist/monitoring/metrics-manager.d.ts +0 -74
  75. package/dist/monitoring/metrics-manager.d.ts.map +0 -1
  76. package/dist/policy/__tests__/cedar-engine.spec.d.ts +0 -17
  77. package/dist/policy/__tests__/cedar-engine.spec.d.ts.map +0 -1
  78. package/dist/policy/__tests__/cedar-entities.spec.d.ts +0 -14
  79. package/dist/policy/__tests__/cedar-entities.spec.d.ts.map +0 -1
  80. package/dist/policy/__tests__/decision-enum.spec.d.ts +0 -16
  81. package/dist/policy/__tests__/decision-enum.spec.d.ts.map +0 -1
  82. package/dist/registry/__tests__/action-input-validator.spec.d.ts +0 -10
  83. package/dist/registry/__tests__/action-input-validator.spec.d.ts.map +0 -1
  84. package/dist/registry/__tests__/action-registry-freebusy.spec.d.ts +0 -13
  85. package/dist/registry/__tests__/action-registry-freebusy.spec.d.ts.map +0 -1
  86. package/dist/registry/__tests__/action-registry-inbox.spec.d.ts +0 -9
  87. package/dist/registry/__tests__/action-registry-inbox.spec.d.ts.map +0 -1
  88. package/dist/registry/__tests__/action-registry-scheduling.spec.d.ts +0 -13
  89. package/dist/registry/__tests__/action-registry-scheduling.spec.d.ts.map +0 -1
  90. package/dist/registry/__tests__/action-registry-validation.spec.d.ts +0 -13
  91. package/dist/registry/__tests__/action-registry-validation.spec.d.ts.map +0 -1
  92. package/dist/registry/__tests__/action-risk-registry-driven.spec.d.ts +0 -15
  93. package/dist/registry/__tests__/action-risk-registry-driven.spec.d.ts.map +0 -1
  94. package/dist/registry/__tests__/action-risk.spec.d.ts +0 -17
  95. package/dist/registry/__tests__/action-risk.spec.d.ts.map +0 -1
  96. package/dist/registry/__tests__/guidance-examples.spec.d.ts +0 -2
  97. package/dist/registry/__tests__/guidance-examples.spec.d.ts.map +0 -1
  98. package/dist/registry/__tests__/high-risk-resource-binding-invariant.spec.d.ts +0 -30
  99. package/dist/registry/__tests__/high-risk-resource-binding-invariant.spec.d.ts.map +0 -1
  100. package/dist/registry/__tests__/reauth-constants.spec.d.ts +0 -2
  101. package/dist/registry/__tests__/reauth-constants.spec.d.ts.map +0 -1
  102. package/dist/types/__tests__/cedar-policy.spec.d.ts +0 -8
  103. package/dist/types/__tests__/cedar-policy.spec.d.ts.map +0 -1
  104. package/dist/types/__tests__/permission-vc-v3.spec.d.ts +0 -9
  105. package/dist/types/__tests__/permission-vc-v3.spec.d.ts.map +0 -1
  106. package/dist/types/__tests__/phase1-vc-factory.spec.d.ts +0 -9
  107. package/dist/types/__tests__/phase1-vc-factory.spec.d.ts.map +0 -1
  108. package/dist/types/__tests__/policy-ref.spec.d.ts +0 -9
  109. package/dist/types/__tests__/policy-ref.spec.d.ts.map +0 -1
@@ -1,4 +1,28 @@
1
1
  import { KeyManager } from '../did/key-manager';
2
+ export interface AgentDIDManagerOptions {
3
+ /**
4
+ * Directory holding the `<agentId>.did` files that map an agent ID to its DID.
5
+ *
6
+ * 🔴 Omit this and the default stays exactly what it has always been —
7
+ * `~/.vess-aidentity/agent-dids/`. Every mapping written so far lives there,
8
+ * so changing the default would make existing agents unresolvable.
9
+ *
10
+ * Supply it for either of two reasons:
11
+ *
12
+ * - **Tenant isolation.** With the path hard-coded to `os.homedir()`, one
13
+ * process serving several tenants funnels all of them into a single shared
14
+ * directory, where agent IDs can collide across tenants.
15
+ *
16
+ * - **Test isolation.** Tests could not otherwise steer this path away from
17
+ * the developer's real home. Under jest, `process.env.HOME = x` does not
18
+ * help: jest-environment-node replaces `process.env` with a plain object
19
+ * behind a Proxy, so the assignment never reaches `setenv(3)`, while
20
+ * `os.homedir()` goes through libuv to `getenv("HOME")` and reads the real
21
+ * environ. Both reads and writes therefore escape to the real home and the
22
+ * suite stays green while polluting it.
23
+ */
24
+ mappingDir?: string;
25
+ }
2
26
  /**
3
27
  * Agent DID Manager
4
28
  * Manages DID generation and lifecycle for AI Agents specifically
@@ -6,7 +30,30 @@ import { KeyManager } from '../did/key-manager';
6
30
  export declare class AgentDIDManager {
7
31
  private keyManager;
8
32
  private agentDIDMap;
9
- constructor(keyManager?: KeyManager);
33
+ private readonly mappingDirOverride?;
34
+ constructor(keyManager?: KeyManager, options?: AgentDIDManagerOptions);
35
+ /**
36
+ * 🔴 The one place the mapping directory is derived.
37
+ *
38
+ * It used to be derived independently in four methods, and two of them
39
+ * (`loadAgentDIDMapping` / `deleteAgentDIDMapping`) looked at `~/.vess/`
40
+ * while the writes went to `~/.vess-aidentity/`. Within a single process the
41
+ * in-memory Map answered first, so nobody noticed; across processes
42
+ * `getAgentDID` failed every time — whenever a long-lived host restarts, or
43
+ * on each Lambda invocation. The four copies are now one, so the paths
44
+ * cannot drift apart again.
45
+ *
46
+ * (An earlier version of this note named agentd as the example. It is not
47
+ * one: agentd resolves Agent DIDs through its own store — OS keychain plus
48
+ * SQLite, keyed by project × client — and takes only stateless primitives
49
+ * from this SDK. Nothing in this repo constructs an AgentDIDManager; the
50
+ * callers are SDK consumers.)
51
+ *
52
+ * The default resolves to `.vess-aidentity` because that is where the real
53
+ * files ended up; treating `.vess` as canonical would orphan every existing
54
+ * mapping.
55
+ */
56
+ private mappingDir;
10
57
  /**
11
58
  * Generate a new DID for an AI Agent
12
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-did-manager.d.ts","sourceRoot":"","sources":["../../src/agent/agent-did-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAI/C;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,WAAW,CAAiC;gBAExC,UAAU,CAAC,EAAE,UAAU;IAInC;;OAEG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBxD;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG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;IASpD;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAcpD;;OAEG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBpD;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IA2BvE;;OAEG;YACW,mBAAmB;IAYjC;;OAEG;YACW,mBAAmB;IAcjC;;OAEG;YACW,qBAAqB;CAapC"}
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AIdentityConfig } from './config';
1
+ import { type AIdentityConfig } from './config';
2
2
  import { AgentManager } from './did/agent';
3
3
  import { UserIdentityManager } from './identity/user-identity-manager';
4
4
  import { VCManager } from './vc/vc-manager';
@@ -59,5 +59,5 @@ export declare class AIdentityClient {
59
59
  invokeTool<T = any>(tool: string, action: string, params: Record<string, any>, vcs: string[]): Promise<ConnectorResponse<T>>;
60
60
  }
61
61
  export declare function getClient(config?: AIdentityConfig, password?: string): AIdentityClient;
62
- export { configure, AIdentityConfig } from './config';
62
+ export { configure, type AIdentityConfig } from './config';
63
63
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,UAAU,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,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EAC3B,GAAG,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;CAWjC;AAKD,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,eAAe,CAKtF;AAED,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAA"}
@@ -1,3 +1,4 @@
1
+ import type { KeyStorageProvider } from '../storage/key-storage.interface';
1
2
  export interface AIdentityConfig {
2
3
  didApi?: {
3
4
  baseUrl: string;
@@ -20,6 +21,59 @@ export interface AIdentityConfig {
20
21
  storage?: {
21
22
  keyStorePath?: string;
22
23
  };
24
+ /**
25
+ * Where agentId → DID mappings are kept.
26
+ *
27
+ * 🔴 Leave it unset and the default is unchanged: `~/.vess-aidentity/agent-dids`.
28
+ * Every mapping written so far lives there, so moving the default would make
29
+ * existing agents unresolvable.
30
+ *
31
+ * Set it when a single process serves several tenants — otherwise they all
32
+ * share one directory and agent IDs can collide across them — or when a test
33
+ * must not touch the developer's real home.
34
+ *
35
+ * Reaches `AgentDIDManager` through `AgentManager`; without this field a
36
+ * caller could implement nothing and had no way to move the path, the same
37
+ * gap `keyStorage` closed for private keys.
38
+ */
39
+ agentMappingDir?: string;
40
+ /**
41
+ * Where the user DID (`user-did.txt`) is kept.
42
+ *
43
+ * 🔴 Leave it unset and the default is unchanged: `~/.vess-aidentity`. Note
44
+ * this is the config root itself, not a subdirectory — the user DID is one
45
+ * fixed filename sitting alongside `keys/` and `agent-dids/`. Moving the
46
+ * default would orphan the existing identity, and every VC issued so far
47
+ * names that DID as its issuer.
48
+ *
49
+ * Set it when a single process serves several tenants — the filename is
50
+ * fixed, so without it the last `createUserDID` overwrites every other
51
+ * tenant's issuer identity — or when a test must not touch the developer's
52
+ * real home.
53
+ *
54
+ * Reaches `UserIdentityManager` through `AIdentityClient`; separate from
55
+ * `agentMappingDir` because the two point at different directories and a
56
+ * caller may well want to move only one.
57
+ */
58
+ userMappingDir?: string;
59
+ /**
60
+ * Where private keys are kept.
61
+ *
62
+ * 🔴 Supply this when the filesystem is not durable. On AWS Lambda and
63
+ * similar, the default provider writes to a disk that is wiped between
64
+ * invocations, so keys fail to persist SILENTLY — nothing throws at
65
+ * construction, and the failure surfaces later as a key that cannot be
66
+ * found.
67
+ *
68
+ * `KeyManager` has always accepted a provider; what was missing was a way
69
+ * to reach it from here, so a client could implement the interface and had
70
+ * nowhere to put the result. Distinct from `storage.keyStorePath`, which
71
+ * only moves the filesystem provider's directory and cannot replace it.
72
+ *
73
+ * Implement `KeyStorageProvider` against S3, DynamoDB, Secrets Manager or
74
+ * anything else; `MemoryKeyStorage` is exported for the ephemeral case.
75
+ */
76
+ keyStorage?: KeyStorageProvider;
23
77
  }
24
78
  export declare function configure(config: AIdentityConfig): void;
25
79
  export declare function getConfig(): AIdentityConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;CACF;AAID,wBAAgB,SAAS,C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EAAE,kBAAkB,CAAA;CAChC;AAID,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAEvD;AAED,wBAAgB,SAAS,IAAI,eAAe,CAE3C;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMpD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,GAAG,CA+BzE"}
@@ -1,9 +1,15 @@
1
1
  import { Agent, DIDDocument } from '../types';
2
2
  import { KeyManager } from './key-manager';
3
+ import { AgentDIDManagerOptions } from '../agent/agent-did-manager';
3
4
  export declare class AgentManager {
4
5
  private keyManager;
5
6
  private agentDIDManager;
6
- constructor(keyManager?: KeyManager);
7
+ /**
8
+ * 🔴 `options` is what makes `config.agentMappingDir` mean anything: without
9
+ * forwarding it, a caller's directory is accepted by the config and then
10
+ * ignored, and every tenant lands back in the shared `~/.vess-aidentity`.
11
+ */
12
+ constructor(keyManager?: KeyManager, options?: AgentDIDManagerOptions);
7
13
  /**
8
14
  * Create a new AI agent with unique ID and DID
9
15
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/did/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAI1C,qBAAa,YAAY;IACvB,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,eAAe,CAAiB;gBAE5B,UAAU,CAAC,EAAE,UAAU;IAKnC;;OAEG;IACG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CA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AO,CAAC,EAAE,sBAAsB;IAKrE;;OAEG;IACG,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IA8B7E;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAYhE;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD;;OAEG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBhD;;OAEG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,UAAU,EAAE,GAAG,CAAA;KAAE,CAAC;IAiBrE;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAqBpD,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,oBAAoB;YAQd,WAAW;CAK1B"}
@@ -1,5 +1,36 @@
1
1
  import { KeyManager } from '../did/key-manager';
2
2
  import { DIDDocument } from '../types';
3
+ export interface UserIdentityManagerOptions {
4
+ /**
5
+ * Directory holding `user-did.txt`, the single file naming the DID this
6
+ * installation issues VCs as.
7
+ *
8
+ * 🔴 Omit this and the default stays exactly what it has always been —
9
+ * `~/.vess-aidentity/`. Note this is the config root itself, NOT a
10
+ * subdirectory: unlike `AgentDIDManager`, which owns the whole
11
+ * `agent-dids/` subtree, this manager owns one fixed filename inside a
12
+ * directory it shares with `keys/`, `agent-dids/` and `vc-cache.json`.
13
+ * Changing the default would orphan the existing user identity, and every
14
+ * VC already issued names that DID as its issuer.
15
+ *
16
+ * Supply it for either of two reasons:
17
+ *
18
+ * - **Tenant isolation.** With the path hard-coded to `os.homedir()`, one
19
+ * process serving several tenants has a single user DID for all of them.
20
+ * Worse than the agent case: agent IDs at least namespace the files, while
21
+ * the user DID is one fixed filename, so the last tenant to call
22
+ * `createUserDID` silently overwrites everyone else's issuer identity.
23
+ *
24
+ * - **Test isolation.** Tests could not otherwise steer this path away from
25
+ * the developer's real home. Under jest, `process.env.HOME = x` does not
26
+ * help: jest-environment-node replaces `process.env` with a plain object
27
+ * behind a Proxy, so the assignment never reaches `setenv(3)`, while
28
+ * `os.homedir()` goes through libuv to `getenv("HOME")` and reads the real
29
+ * environ. Both reads and writes therefore escape to the real home and the
30
+ * suite stays green while clobbering the developer's own user DID.
31
+ */
32
+ mappingDir?: string;
33
+ }
3
34
  /**
4
35
  * User Identity Manager
5
36
  * Manages DID generation and lifecycle for Users (Issuers) specifically
@@ -8,7 +39,30 @@ import { DIDDocument } from '../types';
8
39
  export declare class UserIdentityManager {
9
40
  private keyManager;
10
41
  private currentUserDID;
11
- constructor(keyManager?: KeyManager);
42
+ private readonly mappingDirOverride?;
43
+ constructor(keyManager?: KeyManager, options?: UserIdentityManagerOptions);
44
+ /**
45
+ * 🔴 The one place the user-DID directory is derived.
46
+ *
47
+ * It used to be derived independently in `saveUserDID` / `loadUserDID` /
48
+ * `clearUserDID`. That is the same shape `AgentDIDManager` was in before
49
+ * PR #1442, where the copies had actually drifted — load and delete looked
50
+ * at `~/.vess/` while save wrote to `~/.vess-aidentity/`. Nothing caught it
51
+ * in-process because the in-memory field answered first; across processes
52
+ * the load always missed. Here `currentUserDID` plays that same masking
53
+ * role, so a drift would likewise only show up after a restart.
54
+ *
55
+ * The default is the config root `~/.vess-aidentity/` and must stay that
56
+ * way — see the note on `UserIdentityManagerOptions.mappingDir`.
57
+ */
58
+ private userDidDir;
59
+ /**
60
+ * Absolute path of the file holding the user DID.
61
+ *
62
+ * Derived from `userDidDir()` so the filename cannot drift either — the
63
+ * three call sites used to spell `'user-did.txt'` out separately as well.
64
+ */
65
+ private userDidFile;
12
66
  /**
13
67
  * Get or create current user DID
14
68
  * This represents the user who will be the issuer of VCs
@@ -1 +1 @@
1
- {"version":3,"file":"user-identity-manager.d.ts","sourceRoot":"","sources":["../../src/identity/user-identity-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEtC;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,cAAc,CAAsB;gBAEhC,UAAU,CAAC,EAAE,UAAU;IAInC;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAgB1C;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAiBtC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC;IAcpC;;OAEG;IACG,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAUxD;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,GAAG,CAAC;QAAC,WAAW,EAAE,WAAW,CAAA;KAAE,CAAC;IAY/F;;OAEG;IACG,kBAAkB,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,GAAG,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IASjF;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IAY1C;;OAEG;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