@vess-id/ai-identity 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) 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 +5569 -1849
  12. package/dist/index.d.ts +16 -13
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +10990 -3080
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +10991 -3080
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/registry/action-registry-json.d.ts +4688 -1478
  19. package/dist/registry/action-registry-json.d.ts.map +1 -1
  20. package/dist/registry/action-registry.d.ts +21 -0
  21. package/dist/registry/action-registry.d.ts.map +1 -1
  22. package/dist/registry/action-risk.d.ts +42 -19
  23. package/dist/registry/action-risk.d.ts.map +1 -1
  24. package/dist/registry/index.d.ts +3 -3
  25. package/dist/registry/index.d.ts.map +1 -1
  26. package/dist/types/connector-plugin.d.ts +33 -1
  27. package/dist/types/connector-plugin.d.ts.map +1 -1
  28. package/dist/types/grant.d.ts +2 -2
  29. package/dist/types/grant.d.ts.map +1 -1
  30. package/dist/types/intent.d.ts +1 -1
  31. package/dist/types/intent.d.ts.map +1 -1
  32. package/dist/types/permission-mode.d.ts +1 -1
  33. package/dist/types/permission-mode.d.ts.map +1 -1
  34. package/dist/utils/sdjwt-client.d.ts +242 -5
  35. package/dist/utils/sdjwt-client.d.ts.map +1 -1
  36. package/dist/vc/api-vc-manager.d.ts +5 -0
  37. package/dist/vc/api-vc-manager.d.ts.map +1 -1
  38. package/dist/vc/vc-manager.d.ts.map +1 -1
  39. package/dist/vp/vp-manager.d.ts +35 -0
  40. package/dist/vp/vp-manager.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts +0 -56
  43. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts.map +0 -1
  44. package/dist/internal-signature/__tests__/canonical.spec.d.ts +0 -2
  45. package/dist/internal-signature/__tests__/canonical.spec.d.ts.map +0 -1
  46. package/dist/internal-signature/__tests__/signer-roundtrip.spec.d.ts +0 -2
  47. package/dist/internal-signature/__tests__/signer-roundtrip.spec.d.ts.map +0 -1
  48. package/dist/internal-signature/__tests__/signer.spec.d.ts +0 -2
  49. package/dist/internal-signature/__tests__/signer.spec.d.ts.map +0 -1
  50. package/dist/monitoring/metrics-manager.d.ts +0 -74
  51. package/dist/monitoring/metrics-manager.d.ts.map +0 -1
  52. package/dist/policy/__tests__/cedar-engine.spec.d.ts +0 -17
  53. package/dist/policy/__tests__/cedar-engine.spec.d.ts.map +0 -1
  54. package/dist/policy/__tests__/cedar-entities.spec.d.ts +0 -14
  55. package/dist/policy/__tests__/cedar-entities.spec.d.ts.map +0 -1
  56. package/dist/policy/__tests__/decision-enum.spec.d.ts +0 -16
  57. package/dist/policy/__tests__/decision-enum.spec.d.ts.map +0 -1
  58. package/dist/registry/__tests__/action-input-validator.spec.d.ts +0 -10
  59. package/dist/registry/__tests__/action-input-validator.spec.d.ts.map +0 -1
  60. package/dist/registry/__tests__/action-registry-doc-review.spec.d.ts +0 -14
  61. package/dist/registry/__tests__/action-registry-doc-review.spec.d.ts.map +0 -1
  62. package/dist/registry/__tests__/action-registry-freebusy.spec.d.ts +0 -13
  63. package/dist/registry/__tests__/action-registry-freebusy.spec.d.ts.map +0 -1
  64. package/dist/registry/__tests__/action-registry-inbox.spec.d.ts +0 -9
  65. package/dist/registry/__tests__/action-registry-inbox.spec.d.ts.map +0 -1
  66. package/dist/registry/__tests__/action-registry-scheduling.spec.d.ts +0 -13
  67. package/dist/registry/__tests__/action-registry-scheduling.spec.d.ts.map +0 -1
  68. package/dist/registry/__tests__/action-registry-validation.spec.d.ts +0 -13
  69. package/dist/registry/__tests__/action-registry-validation.spec.d.ts.map +0 -1
  70. package/dist/registry/__tests__/action-risk-registry-driven.spec.d.ts +0 -15
  71. package/dist/registry/__tests__/action-risk-registry-driven.spec.d.ts.map +0 -1
  72. package/dist/registry/__tests__/action-risk.spec.d.ts +0 -22
  73. package/dist/registry/__tests__/action-risk.spec.d.ts.map +0 -1
  74. package/dist/registry/__tests__/guidance-examples.spec.d.ts +0 -2
  75. package/dist/registry/__tests__/guidance-examples.spec.d.ts.map +0 -1
  76. package/dist/registry/__tests__/high-risk-resource-binding-invariant.spec.d.ts +0 -30
  77. package/dist/registry/__tests__/high-risk-resource-binding-invariant.spec.d.ts.map +0 -1
  78. package/dist/registry/__tests__/reauth-constants.spec.d.ts +0 -2
  79. package/dist/registry/__tests__/reauth-constants.spec.d.ts.map +0 -1
  80. package/dist/registry/__tests__/salient-completeness.spec.d.ts +0 -43
  81. package/dist/registry/__tests__/salient-completeness.spec.d.ts.map +0 -1
  82. package/dist/types/__tests__/cedar-policy.spec.d.ts +0 -8
  83. package/dist/types/__tests__/cedar-policy.spec.d.ts.map +0 -1
  84. package/dist/types/__tests__/permission-vc-v3.spec.d.ts +0 -9
  85. package/dist/types/__tests__/permission-vc-v3.spec.d.ts.map +0 -1
  86. package/dist/types/__tests__/phase1-vc-factory.spec.d.ts +0 -9
  87. package/dist/types/__tests__/phase1-vc-factory.spec.d.ts.map +0 -1
  88. package/dist/types/__tests__/policy-ref.spec.d.ts +0 -9
  89. package/dist/types/__tests__/policy-ref.spec.d.ts.map +0 -1
@@ -3,28 +3,196 @@ import { KeyManager } from '../did/key-manager';
3
3
  import type { DisclosureFrame } from '@sd-jwt/types';
4
4
  import type { JWK } from 'jose';
5
5
  export declare class SDJwtClient {
6
+ /**
7
+ * 🔴 Keyed by DID **and** by the identity of the key that was resolved.
8
+ *
9
+ * The instance holds a signer built from a private key the KeyManager
10
+ * handed over, so two stores holding *different* keys for one DID must not
11
+ * share an instance. Keying on the DID alone returned whichever one was
12
+ * built first — and since `setKeyManager` replaces a static field,
13
+ * constructing a second VPManager silently repointed every later lookup at
14
+ * a store that did not have the key. Measured: an agent that generated its
15
+ * DID through one manager could not present with another, failing as
16
+ * `Private key not found for holder` with the key sitting in the first
17
+ * manager's store the whole time.
18
+ *
19
+ * 🔴 The discriminator is the KEY, not the KeyManager object. Keying on
20
+ * object identity (a WeakMap-assigned `km0`/`km1`/…) fixed the mix-up and
21
+ * broke two other things, because the api builds a throwaway KeyManager
22
+ * per request — `new APIVCManager(new KeyManager(ephemeral))` at
23
+ * grant/services/remote-vc-issuer.service.ts:2234, which runs on every
24
+ * tool-invoke auto-issue, plus five more sites:
25
+ *
26
+ * 1. Same key material, new object, new id — so a long-lived issuer
27
+ * (user/services/sdjwt-credential.service.ts:69) could not read back
28
+ * its own warm entry once a per-request manager had replaced the
29
+ * static. It failed outright rather than falling back. Measured:
30
+ * `{"resolved":false,"msg":"Private key not found for issuer: … km1"}`
31
+ * where the DID-only key gave `{"resolved":true}` — by accident, by
32
+ * returning the wrong signer on a cache hit.
33
+ *
34
+ * 2. Entries accumulated without bound. `keyManagerIds` is a WeakMap, so
35
+ * a collected manager releases its id — but the Map entry keyed by
36
+ * that id string stays, and a signer closes over a DECRYPTED PRIVATE
37
+ * KEY. Nothing in the api calls `clearIssuerCache`. Measured over 25
38
+ * issuances of one DID: `{"instanceCount":25,"signerCount":25}` where
39
+ * the DID-only key gave 1.
40
+ *
41
+ * A thumbprint (RFC 7638) is the right granularity for both: same key ⇒
42
+ * same entry whoever holds it, different key ⇒ different entry. It is
43
+ * computed over the public members only (`crv`/`kty`/`x`/`y` — `d`, `kid`
44
+ * and `alg` are excluded by the spec), which is what makes two stores
45
+ * holding the same keypair agree. Two *different* private keys sharing a
46
+ * public half is not a case that exists for a valid EC pair, so nothing is
47
+ * conflated that should not be. Measured at ~1.7µs per call, against an
48
+ * ECDSA signature that follows it.
49
+ */
6
50
  private static instances;
51
+ /**
52
+ * 🔴 Only ever read as a fallback — when a call arrives without a KeyManager.
53
+ *
54
+ * `VCManager`, `VPManager` and `APIVCManager` used to assign it in their
55
+ * constructors. They no longer do — every one of them passes its own
56
+ * KeyManager to each call — so within the SDK this field holds whatever an
57
+ * external consumer set via the deprecated {@link setKeyManager}, and
58
+ * otherwise a default `new KeyManager()` that {@link resolveKey} creates the
59
+ * first time it actually has to fall back. Nothing else writes it, and a
60
+ * call that carries its own store never causes that default to exist.
61
+ *
62
+ * It stays because `SDJwtClient` is a public export and a consumer pairing
63
+ * `setKeyManager` with {@link getSDJwtInstance} would otherwise break on a
64
+ * minor release. Removal belongs to the next major.
65
+ */
7
66
  private static keyManager;
8
67
  private static signerCache;
9
68
  private static verifierCache;
69
+ /**
70
+ * A stable identifier for the key itself, shared by every store holding it.
71
+ *
72
+ * 🔴 Falls back to a per-call unique value rather than to a constant when
73
+ * the thumbprint cannot be computed. A constant would make two unrelated
74
+ * malformed keys collide on one cache entry, which is the mix-up this whole
75
+ * scheme exists to prevent — the safe direction of failure is "cache
76
+ * nothing", never "share an entry". In practice this is unreachable for a
77
+ * key that got through `getKey`; it is here so a future JWK shape degrades
78
+ * into a slow path instead of a wrong one.
79
+ */
80
+ private static keyId;
81
+ private static nextFallbackKeyId;
82
+ /**
83
+ * 🔴 Cache keys are built here and nowhere else.
84
+ *
85
+ * Three maps, three key shapes. When they were assembled inline at each
86
+ * call site, `clearIssuerCache` wrote its own third version from memory and
87
+ * matched only one of them: it deleted `issuerDid` where the instance was
88
+ * stored as `${did}:issuer:${kmId}`, and `signer:${did}` where the signer
89
+ * was stored as `signer:${did}:${kmId}`. Measured before the fix — one
90
+ * issuer cached, then cleared:
91
+ *
92
+ * BEFORE {"instanceCount":1,"signerCount":1,"verifierCount":1}
93
+ * AFTER {"instanceCount":1,"signerCount":1,"verifierCount":0}
94
+ *
95
+ * The signer closes over a decrypted private key, so the two that survived
96
+ * were the two that mattered. Keeping writers and the eraser on one
97
+ * definition is what stops that from drifting apart again.
98
+ */
99
+ private static instanceKey;
100
+ private static signerKey;
101
+ /**
102
+ * The part of a key that identifies the DID, up to and including the
103
+ * delimiter before the key-identity segment.
104
+ *
105
+ * 🔴 `clearIssuerCache` matches on these rather than rebuilding prefixes of
106
+ * its own — writing the shape a second time is the mistake being fixed. The
107
+ * trailing `:` is load-bearing: matching a bare DID would make
108
+ * `did:key:abc` also evict `did:key:abcd`.
109
+ */
110
+ private static instancePrefix;
111
+ private static signerPrefix;
112
+ /**
113
+ * 🔴 Carries the key identity too, symmetrically with {@link signerKey}.
114
+ *
115
+ * It used to be keyed by DID alone, on the reasoning that "a verifier is
116
+ * built from the public half, which is the same value no matter which store
117
+ * the private key came out of". That holds for the case the caches were
118
+ * built for — one keypair, several stores — and fails for the exact case
119
+ * the key segment exists to separate: two stores holding *different* keys
120
+ * under one DID. There the second caller reused the first's verifier and so
121
+ * checked signatures against a public key that was not its own.
122
+ *
123
+ * Costs nothing now that the segment is the key's own thumbprint rather
124
+ * than a per-object id: the same keypair still yields one entry however
125
+ * many managers hold it, which is what the old comment actually wanted.
126
+ */
127
+ private static verifierKey;
128
+ private static verifierPrefix;
10
129
  private constructor();
11
130
  /**
12
131
  * Initialize with KeyManager for DID-based key management
132
+ *
133
+ * @deprecated Pass the KeyManager to the call instead:
134
+ * {@link getIssuerInstance}`(did, keyManager)`,
135
+ * {@link getHolderInstance}`(did, keyManager)`, {@link issueSDJWT} and
136
+ * {@link verifySDJWT} all take one. This setter writes a **static** field,
137
+ * so every manager an application constructs repoints key resolution for
138
+ * every other one — construction order decides which store is searched.
139
+ *
140
+ * 🔴 Not a style preference; it caused a production failure. A long-lived
141
+ * issuer and a per-request `new APIVCManager(new KeyManager(ephemeral))`
142
+ * coexist in the api, and whichever ran last won: the long-lived one then
143
+ * signed with a store that was not its own or failed outright with
144
+ * `Private key not found for issuer: …`. See PR #1441.
145
+ *
146
+ * Retained for external SDK consumers that pair it with
147
+ * {@link getSDJwtInstance}; scheduled for removal in the next major.
13
148
  */
14
149
  static setKeyManager(keyManager: KeyManager): void;
15
150
  /**
16
151
  * Get SDJwtVcInstance for issuer role (VC issuance)
17
152
  */
18
- static getIssuerInstance(issuerDid: string): Promise<SDJwtVcInstance>;
153
+ static getIssuerInstance(issuerDid: string, keyManager?: KeyManager): Promise<SDJwtVcInstance>;
19
154
  /**
20
155
  * Get SDJwtVcInstance for holder role (VP presentation)
21
156
  */
22
- static getHolderInstance(holderDid: string): Promise<SDJwtVcInstance>;
157
+ static getHolderInstance(holderDid: string, keyManager?: KeyManager): Promise<SDJwtVcInstance>;
158
+ /**
159
+ * Resolve the key, then look in the cache — in that order.
160
+ *
161
+ * 🔴 The order is the fix, not an implementation detail. The cache key
162
+ * names the key that was resolved, so it cannot be built before resolving,
163
+ * and the store must therefore be consulted on a hit as well as a miss.
164
+ * That is what makes a warm entry reachable from any manager holding the
165
+ * same key: with the KeyManager object in the key, the caller whose store
166
+ * DID hold the key looked under a name nobody had written to and got
167
+ * `Private key not found` — the store had it the whole time.
168
+ *
169
+ * The extra work on a hit is one `getKey` (an in-memory or DB read the
170
+ * caller would owe anyway on a miss) plus a ~1.7µs thumbprint. What is
171
+ * saved is the SDJwtVcInstance and, more to the point, re-importing the
172
+ * key material into a signer.
173
+ */
174
+ private static getInstance;
175
+ /**
176
+ * Fetch the DID's private key from the given store (or the static one) and
177
+ * derive the identity the caches key on.
178
+ */
179
+ private static resolveKey;
23
180
  /**
24
181
  * Get SDJwtVcInstance with specified role (backward compatibility)
182
+ *
183
+ * @deprecated Call {@link getIssuerInstance}`(did, keyManager)` or
184
+ * {@link getHolderInstance}`(did, keyManager)` directly — this wrapper adds
185
+ * nothing but the role switch, and the role is known at every call site.
186
+ *
187
+ * 🔴 `keyManager` was added here because omitting it was the defect: with no
188
+ * way to name a store, every caller of this wrapper fell through to the
189
+ * static field and so was the one path that could not benefit from the
190
+ * PR #1441 fix. Callers that still omit it keep the old static behaviour, so
191
+ * existing external code is unaffected.
25
192
  */
26
193
  static getSDJwtInstance(did: string, options?: {
27
194
  role?: 'issuer' | 'holder';
195
+ keyManager?: KeyManager;
28
196
  }): Promise<SDJwtVcInstance>;
29
197
  /**
30
198
  * Create a new SDJwtVcInstance with DID-based keys and role
@@ -40,6 +208,55 @@ export declare class SDJwtClient {
40
208
  * - vct: SD-JWT VC credential type discriminator.
41
209
  */
42
210
  private static readonly NEVER_DISCLOSE;
211
+ /**
212
+ * Claims that decide whether an action is PERMITTED, and so must not be
213
+ * withholdable by the party they constrain.
214
+ *
215
+ * 🔴 Separate from NEVER_DISCLOSE on purpose. That set is about structural
216
+ * integrity — hide `cnf` and Proof of Possession cannot be checked at all.
217
+ * This set is about authorisation: these fields are readable, they simply
218
+ * must not be OPTIONAL, because SD-JWT makes an undisclosed field
219
+ * physically absent rather than merely hidden. A holder who omits the
220
+ * disclosure presents a credential with no constraints on it.
221
+ *
222
+ * The harm is not theoretical. Gate-2 permits when the delegate list is
223
+ * empty (tool-executor.service.ts) — deliberate backward compatibility for
224
+ * two credential shapes that genuinely carry no `delegates` — and a
225
+ * withheld disclosure lands in that same branch. Cedar Gate-1 backstops
226
+ * high-risk actions, but only where the Cedar default policy is
227
+ * bootstrapped; that early return's own comment records that a non-Cedar
228
+ * deployment's flat-permission fallback does not risk-gate, making the
229
+ * withholding an unconditional allow there.
230
+ *
231
+ * 🔴 Enforced here rather than by curating each caller's field list. Four
232
+ * issuance paths pass their own arrays — remote-vc-issuer.service.ts,
233
+ * user/services/sdjwt-credential.service.ts (a hardcoded switch that
234
+ * duplicates the SDK config), sdk/src/vc/api-vc-manager.ts, and
235
+ * oauth.service.ts in two places — so fixing one leaves three standing,
236
+ * and a fifth added later would inherit the defect. This function is the
237
+ * single point all of them flow through.
238
+ *
239
+ * It is also the only place that can stop the NESTED case: the recursion
240
+ * below passes every key of a nested object as disclosable regardless of
241
+ * what was requested, which no call-site list can reach.
242
+ *
243
+ * What is NOT here: `approval` and `intent_description`. Those are
244
+ * selective for privacy — an approver's identity, free text — and no gate
245
+ * reads them to decide anything. The line being drawn is "authorisation
246
+ * input", not "sensitive".
247
+ *
248
+ * Field-by-field, with where each is read:
249
+ * - delegates: carries actions/effect/resource (tool-auth.service.ts)
250
+ * - actions: what a delegate may do
251
+ * - tool: prefixes bare actions into the permission string that
252
+ * gates the decision; withheld, `message.post` is emitted
253
+ * instead of `slack.message.post` — a different string
254
+ * - resourceScope: gates the scope match (tool-manager.ts)
255
+ * - permissions: the flat-permission path (tool-auth.service.ts)
256
+ * - effect: whether a delegate rule allows or denies
257
+ * - resource: what a rule applies to
258
+ */
259
+ private static readonly NEVER_SELECTIVE;
43
260
  /**
44
261
  * Create disclosure frame for selective disclosure
45
262
  */
@@ -48,11 +265,11 @@ export declare class SDJwtClient {
48
265
  * Issue an SD-JWT with selective disclosure
49
266
  */
50
267
  static issueSDJWT(payload: Record<string, any>, _privateKey: any, // Not used since we get key from KeyManager based on issuer DID
51
- selectiveDisclosureFields?: string[]): Promise<string>;
268
+ selectiveDisclosureFields?: string[], keyManager?: KeyManager): Promise<string>;
52
269
  /**
53
270
  * Verify an SD-JWT
54
271
  */
55
- static verifySDJWT(credential: string): Promise<{
272
+ static verifySDJWT(credential: string, keyManager?: KeyManager): Promise<{
56
273
  valid: boolean;
57
274
  payload?: any;
58
275
  error?: string;
@@ -70,7 +287,27 @@ export declare class SDJwtClient {
70
287
  */
71
288
  static clearCaches(): void;
72
289
  /**
73
- * Clear cache for specific issuer
290
+ * Drop every cache entry holding key material for one DID.
291
+ *
292
+ * 🔴 Scans rather than deletes by exact key, because the caller cannot
293
+ * build the exact keys. Both the instance and signer keys carry a
294
+ * `keyManagerId`, which is private and WeakMap-derived, and this method
295
+ * takes only a DID. The same DID legitimately has one entry per KeyManager
296
+ * that ever resolved it, so anything short of "all of them" leaves a live
297
+ * signer — and a signer closes over a decrypted private key. The maps hold
298
+ * a handful of entries; a linear pass is not worth optimizing away.
299
+ *
300
+ * 🔴 Clears the holder instance too, despite the `Issuer` in the name.
301
+ * The unit being freed is the DID's key material, not a role: a holder
302
+ * instance is constructed with `kbSigner` set to the very same signer
303
+ * object as the issuer's, so evicting the signer while leaving the holder
304
+ * instance cached would keep the decrypted key reachable through the map
305
+ * we claimed to have cleaned. Roles are not separable here; the DID is the
306
+ * only safe granularity.
307
+ *
308
+ * 🔴 Matches on a delimiter, not a bare prefix. `did:key:abc` and
309
+ * `did:key:abcd` are different DIDs, and `startsWith(did)` would take the
310
+ * second one down with the first.
74
311
  */
75
312
  static clearIssuerCache(issuerDid: string): void;
76
313
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sdjwt-client.d.ts","sourceRoot":"","sources":["../../src/utils/sdjwt-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAG/B,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,SAAS,CAA0C;IAClE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAY;IACrC,OAAO,CAAC,MAAM,CAAC,WAAW,CAA8B;IACxD,OAAO,CAAC,MAAM,CAAC,aAAa,CAA8B;IAE1D,OAAO;IAEP;;OAEG;WACW,aAAa,CAAC,UAAU,EAAE,UAAU;IAIlD;;OAEG;WACiB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IASlF;;OAEG;WACiB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IASlF;;OAEG;WACiB,gBAAgB,CAClC,GAAG,EAAE,MAAM,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AE,KAAK,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA2B3E;;;;;;;;;;;;;;OAcG;WACiB,mBAAmB,CACrC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,GAAG,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAiC/F;;;;;;;;;;;;;;;;;OAiBG;WACiB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QACzE,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,MAAM,CAAC,EAAE,GAAG,CAAA;QACZ,WAAW,CAAC,EAAE,GAAG,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE,GAAG,CAAA;QACZ,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAC;IAuBF;;;;;;OAMG;WACW,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAelE"}
@@ -6,6 +6,11 @@ import { KeyManager } from '../did/key-manager';
6
6
  */
7
7
  export declare class APIVCManager {
8
8
  private keyManager;
9
+ /**
10
+ * 🔴 Deliberately does NOT call `SDJwtClient.setKeyManager` — that assigned a
11
+ * static, so constructing one of these repointed every other manager's key
12
+ * resolution. Every call below passes `this.keyManager` instead (#1449).
13
+ */
9
14
  constructor(keyManager?: KeyManager);
10
15
  /**
11
16
  * Issue an SD-JWT VC with selective disclosure
@@ -1 +1 @@
1
- {"version":3,"file":"api-vc-manager.d.ts","sourceRoot":"","sources":["../../src/vc/api-vc-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,mBAA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AC;IAqGlB;;OAEG;YACW,mBAAmB;IAgCjC;;OAEG;IACG,WAAW,CACf,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,GAAG,EACX,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAA;QACjB,UAAU,EAAE,MAAM,CAAA;KACnB,GACA,OAAO,CAAC,MAAM,CAAC;IAoClB;;OAEG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAC1B,GACA,OAAO,CAAC,GAAG,CAAC;IAgDf;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI;IAI5C,OAAO,CAAC,wBAAwB;IA4BhC,OAAO,CAAC,uBAAuB;CA2BhC"}
@@ -2,11 +2,44 @@ import { VerifiablePresentation, VPRequest } from '../types';
2
2
  import { KeyManager } from '../did/key-manager';
3
3
  export declare class VPManager {
4
4
  private keyManager;
5
+ /**
6
+ * 🔴 Deliberately does NOT call `SDJwtClient.setKeyManager` — that assigned a
7
+ * static, so constructing a VPManager repointed key resolution for every
8
+ * manager already alive. `presentOne` passes `this.keyManager` (#1449).
9
+ */
5
10
  constructor(keyManager?: KeyManager);
6
11
  /**
7
12
  * Create a SD-JWT presentation using the present() method
8
13
  * This properly binds the holder's key to the SD-JWT VC
9
14
  */
15
+ /**
16
+ * Separator between presentations in a multi-credential response.
17
+ *
18
+ * 🔴 A comma, because SD-JWT already owns `~`.
19
+ *
20
+ * Each presentation is `<issuer-jwt>~<disclosure>*~<kb-jwt>`, so splitting a
21
+ * bundle on `~` would take it apart at the wrong level. OID4VP carries
22
+ * several presentations as a JSON array; this transport has one string, so
23
+ * the array becomes a comma-joined list — a character that appears in
24
+ * neither base64url nor the SD-JWT grammar.
25
+ */
26
+ static readonly PRESENTATION_SEPARATOR = ",";
27
+ /**
28
+ * Build a presentation over one or more credentials.
29
+ *
30
+ * 🔴 Every credential gets its own presentation, and its own KB-JWT.
31
+ *
32
+ * An SD-JWT presentation binds one key-binding token to one credential —
33
+ * there is no place in that format for a second. So "present three
34
+ * credentials" is three presentations, joined, exactly as OID4VP carries an
35
+ * array of them. Each one proves holder possession of the credential it
36
+ * belongs to, which a single KB-JWT over a bundle could not do.
37
+ *
38
+ * This used to take `vcs[0]` and drop the rest in silence. The caller got
39
+ * back a presentation missing the authority it thought it was carrying, and
40
+ * found out at the verifier — if at all, since a delegation alone is often
41
+ * enough to reach a permit.
42
+ */
10
43
  create(vcs: string[], // Array of SD-JWT VC strings
11
44
  options: {
12
45
  holderDid: string;
@@ -14,6 +47,8 @@ export declare class VPManager {
14
47
  domain: string;
15
48
  purpose?: string;
16
49
  }): Promise<string>;
50
+ /** One credential, one KB-JWT. */
51
+ private presentOne;
17
52
  /**
18
53
  * Verify a Verifiable Presentation
19
54
  */
@@ -1 +1 @@
1
- {"version":3,"file":"vp-manager.d.ts","sourceRoot":"","sources":["../../src/vp/vp-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAM/C,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAAY;gBAElB,UAAU,CAAC,EAAE,UAAU;IAMnC;;;OAGG;IACG,MAAM,CACV,GAAG,EAAE,MAAM,EAAE,EAAE,6BAA6B;IAC5C,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,GACA,OAAO,CAAC,MAA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,CACV,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QACP,iBAAiB,EAAE,MAAM,CAAA;QACzB,cAAc,EAAE,MAAM,CAAA;QACtB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,GACA,OAAO,CAAC,sBAAsB,CAAC;IAwClC;;OAEG;IACH,aAAa,CACX,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,eAAe,CAAC,EAAE,GAAG,CAAA;KACtB,GACA,SAAS;IAQZ;;OAEG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;CAehD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vess-id/ai-identity",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "TypeScript SDK for AI Identity Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1,56 +0,0 @@
1
- import { GrantConstraints, TimeWindowConstraint, EvaluationContext } from '../../../types';
2
- export declare const mockExecutorDid = "did:key:z6MkiY62766b1LJkExWMsM3QG4WtX23zJpRgVLwZBKQhyt6d";
3
- /**
4
- * Create mock time window constraint
5
- */
6
- export declare const createMockTimeWindow: (overrides?: Partial<TimeWindowConstraint>) => TimeWindowConstraint;
7
- /**
8
- * Create mock constraints
9
- */
10
- export declare const createMockConstraints: (overrides?: Partial<GrantConstraints>) => GrantConstraints;
11
- /**
12
- * Create mock evaluation context
13
- */
14
- export declare const createMockContext: (overrides?: Partial<EvaluationContext>) => EvaluationContext;
15
- /**
16
- * Create constraints that should pass all checks
17
- */
18
- export declare const createPassingConstraints: () => GrantConstraints;
19
- /**
20
- * Create constraints that should fail time window check
21
- */
22
- export declare const createFailingTimeWindowConstraints: () => GrantConstraints;
23
- /**
24
- * Create constraints that should fail invocation limit
25
- */
26
- export declare const createExhaustedConstraints: () => GrantConstraints;
27
- /**
28
- * Create constraints that should fail IP check
29
- */
30
- export declare const createRestrictedIpConstraints: () => GrantConstraints;
31
- /**
32
- * Create overnight time window (e.g., 22:00-06:00)
33
- */
34
- export declare const createOvernightTimeWindow: () => TimeWindowConstraint;
35
- /**
36
- * Test IPs for various scenarios
37
- */
38
- export declare const testIps: {
39
- inRange192: string;
40
- inRange10: string;
41
- outOfRange: string;
42
- localhost: string;
43
- ipv6Localhost: string;
44
- ipv6Public: string;
45
- };
46
- /**
47
- * Test timestamps for various scenarios
48
- */
49
- export declare const createTestTimestamps: () => {
50
- weekdayMorning: Date;
51
- weekdayEvening: Date;
52
- weekendMorning: Date;
53
- midnight: Date;
54
- now: Date;
55
- };
56
- //# sourceMappingURL=constraint.fixtures.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constraint.fixtures.d.ts","sourceRoot":"","sources":["../../../../src/constraint/__tests__/fixtures/constraint.fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AAGvB,eAAO,MAAM,eAAe,6DAA6D,CAAA;AAEzF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAW,OAAO,CAAC,oBAAoB,CAAM,KAAG,oBAMnF,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,YAAW,OAAO,CAAC,gBAAgB,CAAM,KAAG,gBAOhF,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAW,OAAO,CAAC,iBAAiB,CAAM,KAAG,iBAc7E,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,QAAO,gBAW1C,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC,QAAO,gBAOpD,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAO,gBAE5C,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,QAAO,gBAE/C,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,oBAK3C,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;CAOnB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;CAchC,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=canonical.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonical.spec.d.ts","sourceRoot":"","sources":["../../../src/internal-signature/__tests__/canonical.spec.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=signer-roundtrip.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signer-roundtrip.spec.d.ts","sourceRoot":"","sources":["../../../src/internal-signature/__tests__/signer-roundtrip.spec.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=signer.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signer.spec.d.ts","sourceRoot":"","sources":["../../../src/internal-signature/__tests__/signer.spec.ts"],"names":[],"mappings":""}
@@ -1,74 +0,0 @@
1
- export interface SDJWTMetrics {
2
- issuanceCount: number;
3
- verificationCount: number;
4
- failedIssuances: number;
5
- failedVerifications: number;
6
- averageIssuanceTime: number;
7
- averageVerificationTime: number;
8
- cacheHitRate: number;
9
- lastActivity: Date;
10
- }
11
- export interface OperationMetric {
12
- operation: 'issue' | 'verify';
13
- startTime: number;
14
- endTime: number;
15
- success: boolean;
16
- error?: string;
17
- issuerDid?: string;
18
- credentialType?: string;
19
- }
20
- export declare class MetricsManager {
21
- private metrics;
22
- private operations;
23
- private maxOperationHistory;
24
- /**
25
- * Start tracking an operation
26
- */
27
- startOperation(operation: 'issue' | 'verify', metadata?: Record<string, any>): string;
28
- /**
29
- * End tracking an operation
30
- */
31
- endOperation(_operationId: string, success: boolean, error?: string): void;
32
- /**
33
- * Update aggregated metrics
34
- */
35
- private updateMetrics;
36
- /**
37
- * Get metrics for a specific issuer or global
38
- */
39
- getMetrics(issuerDid?: string): SDJWTMetrics | null;
40
- /**
41
- * Get all metrics
42
- */
43
- getAllMetrics(): Map<string, SDJWTMetrics>;
44
- /**
45
- * Get recent operations
46
- */
47
- getRecentOperations(limit?: number): OperationMetric[];
48
- /**
49
- * Get operation statistics
50
- */
51
- getOperationStats(): {
52
- totalOperations: number;
53
- successRate: number;
54
- averageResponseTime: number;
55
- operationsPerMinute: number;
56
- };
57
- /**
58
- * Update cache hit rate
59
- */
60
- updateCacheHitRate(issuerDid: string, hit: boolean): void;
61
- /**
62
- * Reset metrics
63
- */
64
- resetMetrics(issuerDid?: string): void;
65
- /**
66
- * Export metrics as JSON
67
- */
68
- exportMetrics(): {
69
- aggregatedMetrics: Record<string, SDJWTMetrics>;
70
- recentOperations: OperationMetric[];
71
- summary: ReturnType<any>;
72
- };
73
- }
74
- //# sourceMappingURL=metrics-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metrics-manager.d.ts","sourceRoot":"","sources":["../../src/monitoring/metrics-manager.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,mBAAmB,EAAE,MAAM,CAAA;IAC3B,uBAAuB,EAAE,MAAM,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,KAA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"}
@@ -1,17 +0,0 @@
1
- /**
2
- * CedarEngine wrapper tests (Phase 1 Step 1, Task 1.2).
3
- *
4
- * Design ref: docs/specs/2026-05-23-cedar-rar-permission-redesign.md Appendix C
5
- * Plan ref: docs/specs/2026-05-23-cedar-rar-implementation-plan-phase1.md §Step 1
6
- *
7
- * Scope of this spec:
8
- * - load wasm + evaluate basic permit / forbid
9
- * - default-deny when no policy matches
10
- * - I-Cedar-4 regression: forbid alone without paired permit → Deny
11
- * - structured errors (not throws) for malformed schema / policy
12
- * - conditional permit driven by request context.approval.granted
13
- * - C3 TOCTOU regression: concurrent loaders share the in-flight Promise
14
- * - load failure clears cached promise so retry can succeed
15
- */
16
- export {};
17
- //# sourceMappingURL=cedar-engine.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cedar-engine.spec.d.ts","sourceRoot":"","sources":["../../../src/policy/__tests__/cedar-engine.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Tests for buildCedarEntities (Cedar unification Step 1).
3
- *
4
- * Spec refs:
5
- * - docs/specs/2026-05-24-cedar-unification-design.md §7.1 (Action entity attrs)
6
- * - §7.2 (risk_level resolution rule, Phase 1 baseline)
7
- *
8
- * Phase 1 採用方針 (spec §7.1 rev 3 C1): entity attribute と context の
9
- * 二重 bind を採用する。本 helper は **entity 側のみ** を組み立て、
10
- * `context.action.risk_level` は CedarDecisionService 側で `buildCedarEvaluateRequest`
11
- * が別途注入する。
12
- */
13
- export {};
14
- //# sourceMappingURL=cedar-entities.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cedar-entities.spec.d.ts","sourceRoot":"","sources":["../../../src/policy/__tests__/cedar-entities.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Tests for the Decision 7-value enum (Cedar unification Step 1).
3
- *
4
- * Spec refs:
5
- * - docs/specs/2026-05-24-cedar-unification-design.md §3 (Decision 7 値 enum)
6
- * - §3.3 evaluation algorithm (fail-closed: indeterminate when errors[] > 0)
7
- *
8
- * Phase 1 Step 1 scope:
9
- * - Decision type literal accepts the 7 A2A-aligned states
10
- * - isDecision() runtime guard rejects unknown strings
11
- *
12
- * Note: Step 2 will wire the API layer (`CedarDecisionService`) to emit
13
- * these values. This Step 1 only introduces the SDK-side enum.
14
- */
15
- export {};
16
- //# sourceMappingURL=decision-enum.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decision-enum.spec.d.ts","sourceRoot":"","sources":["../../../src/policy/__tests__/decision-enum.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}