@vess-id/ai-identity 0.19.0 → 0.21.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 (93) 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 +6583 -1822
  12. package/dist/index.d.ts +19 -13
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +10737 -2927
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +10720 -2917
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/registry/action-registry-json.d.ts +5371 -1325
  19. package/dist/registry/action-registry-json.d.ts.map +1 -1
  20. package/dist/registry/action-registry.d.ts +13 -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.map +1 -1
  25. package/dist/registry/index.d.ts +3 -3
  26. package/dist/registry/index.d.ts.map +1 -1
  27. package/dist/resolver/approval-time-resolution.d.ts +72 -0
  28. package/dist/resolver/approval-time-resolution.d.ts.map +1 -0
  29. package/dist/resolver/salient-digest.d.ts +48 -0
  30. package/dist/resolver/salient-digest.d.ts.map +1 -0
  31. package/dist/types/grant.d.ts +13 -2
  32. package/dist/types/grant.d.ts.map +1 -1
  33. package/dist/types/intent.d.ts +1 -1
  34. package/dist/types/intent.d.ts.map +1 -1
  35. package/dist/types/permission-mode.d.ts +1 -1
  36. package/dist/types/permission-mode.d.ts.map +1 -1
  37. package/dist/types/permission-vc.d.ts +81 -0
  38. package/dist/types/permission-vc.d.ts.map +1 -1
  39. package/dist/types/vc.d.ts +11 -1
  40. package/dist/types/vc.d.ts.map +1 -1
  41. package/dist/utils/sdjwt-client.d.ts +242 -5
  42. package/dist/utils/sdjwt-client.d.ts.map +1 -1
  43. package/dist/utils/sdjwt-disclosure.d.ts.map +1 -1
  44. package/dist/vc/api-vc-manager.d.ts +5 -0
  45. package/dist/vc/api-vc-manager.d.ts.map +1 -1
  46. package/dist/vc/vc-manager.d.ts.map +1 -1
  47. package/dist/vp/vp-manager.d.ts +35 -0
  48. package/dist/vp/vp-manager.d.ts.map +1 -1
  49. package/package.json +3 -3
  50. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts +0 -56
  51. package/dist/constraint/__tests__/fixtures/constraint.fixtures.d.ts.map +0 -1
  52. package/dist/internal-signature/__tests__/canonical.spec.d.ts +0 -2
  53. package/dist/internal-signature/__tests__/canonical.spec.d.ts.map +0 -1
  54. package/dist/internal-signature/__tests__/signer-roundtrip.spec.d.ts +0 -2
  55. package/dist/internal-signature/__tests__/signer-roundtrip.spec.d.ts.map +0 -1
  56. package/dist/internal-signature/__tests__/signer.spec.d.ts +0 -2
  57. package/dist/internal-signature/__tests__/signer.spec.d.ts.map +0 -1
  58. package/dist/monitoring/metrics-manager.d.ts +0 -74
  59. package/dist/monitoring/metrics-manager.d.ts.map +0 -1
  60. package/dist/policy/__tests__/cedar-engine.spec.d.ts +0 -17
  61. package/dist/policy/__tests__/cedar-engine.spec.d.ts.map +0 -1
  62. package/dist/policy/__tests__/cedar-entities.spec.d.ts +0 -14
  63. package/dist/policy/__tests__/cedar-entities.spec.d.ts.map +0 -1
  64. package/dist/policy/__tests__/decision-enum.spec.d.ts +0 -16
  65. package/dist/policy/__tests__/decision-enum.spec.d.ts.map +0 -1
  66. package/dist/registry/__tests__/action-input-validator.spec.d.ts +0 -10
  67. package/dist/registry/__tests__/action-input-validator.spec.d.ts.map +0 -1
  68. package/dist/registry/__tests__/action-registry-freebusy.spec.d.ts +0 -13
  69. package/dist/registry/__tests__/action-registry-freebusy.spec.d.ts.map +0 -1
  70. package/dist/registry/__tests__/action-registry-inbox.spec.d.ts +0 -9
  71. package/dist/registry/__tests__/action-registry-inbox.spec.d.ts.map +0 -1
  72. package/dist/registry/__tests__/action-registry-scheduling.spec.d.ts +0 -13
  73. package/dist/registry/__tests__/action-registry-scheduling.spec.d.ts.map +0 -1
  74. package/dist/registry/__tests__/action-registry-validation.spec.d.ts +0 -13
  75. package/dist/registry/__tests__/action-registry-validation.spec.d.ts.map +0 -1
  76. package/dist/registry/__tests__/action-risk-registry-driven.spec.d.ts +0 -15
  77. package/dist/registry/__tests__/action-risk-registry-driven.spec.d.ts.map +0 -1
  78. package/dist/registry/__tests__/action-risk.spec.d.ts +0 -17
  79. package/dist/registry/__tests__/action-risk.spec.d.ts.map +0 -1
  80. package/dist/registry/__tests__/guidance-examples.spec.d.ts +0 -2
  81. package/dist/registry/__tests__/guidance-examples.spec.d.ts.map +0 -1
  82. package/dist/registry/__tests__/high-risk-resource-binding-invariant.spec.d.ts +0 -30
  83. package/dist/registry/__tests__/high-risk-resource-binding-invariant.spec.d.ts.map +0 -1
  84. package/dist/registry/__tests__/reauth-constants.spec.d.ts +0 -2
  85. package/dist/registry/__tests__/reauth-constants.spec.d.ts.map +0 -1
  86. package/dist/types/__tests__/cedar-policy.spec.d.ts +0 -8
  87. package/dist/types/__tests__/cedar-policy.spec.d.ts.map +0 -1
  88. package/dist/types/__tests__/permission-vc-v3.spec.d.ts +0 -9
  89. package/dist/types/__tests__/permission-vc-v3.spec.d.ts.map +0 -1
  90. package/dist/types/__tests__/phase1-vc-factory.spec.d.ts +0 -9
  91. package/dist/types/__tests__/phase1-vc-factory.spec.d.ts.map +0 -1
  92. package/dist/types/__tests__/policy-ref.spec.d.ts +0 -9
  93. package/dist/types/__tests__/policy-ref.spec.d.ts.map +0 -1
@@ -233,6 +233,24 @@ export interface PermissionRule {
233
233
  actions: string[];
234
234
  /** Rule-level constraints */
235
235
  constraints?: PermissionConstraints;
236
+ /**
237
+ * RAR authorization-details type (RFC 9396 §2), carried verbatim (#952).
238
+ *
239
+ * A free-form URN naming the kind of authorization this delegate represents,
240
+ * for consumers that speak RAR. Deliberately unvalidated: the registry of
241
+ * types belongs to whoever issues them, and rejecting an unrecognised URN
242
+ * here would make this service the gatekeeper of a vocabulary it does not
243
+ * own.
244
+ *
245
+ * NOT an authorization input. Gate-2 authorises on `provider`, `actions`,
246
+ * `resource.type` and `resource.id`; a credential must not be able to widen
247
+ * or narrow what it may do by naming a type. Note how close this sits to
248
+ * `resource.type`, which Gate-2 *does* read — the two are one level apart
249
+ * and the format is unchecked, so a line reaching for the wrong one would
250
+ * not be caught by the compiler or at runtime. Pinned in
251
+ * `gate2-fast-path.spec.ts` ("delegates[].type is inert at Gate-2").
252
+ */
253
+ type?: string;
236
254
  /**
237
255
  * Cedar policy binding (Phase 1).
238
256
  *
@@ -364,6 +382,16 @@ export interface VcApprovalClaim {
364
382
  * approved (action, resource) tuple. Optional for backward compatibility.
365
383
  */
366
384
  action?: string;
385
+ /**
386
+ * #1205 P1 (decision-bound authorization) — `sha256:` hex of the
387
+ * canonicalized approved salient params. Binds the issued VC to the CONCRETE
388
+ * parameter values the approver consented to, so a caller cannot execute with
389
+ * different (e.g. tampered `body`/`to`) parameters under the same approval.
390
+ * Computed at claimVC (Step 4) from the final persisted `actionParams`;
391
+ * verified fail-closed at the PEP (Step 5). Absent on legacy VCs and on
392
+ * actions that declare no salient set.
393
+ */
394
+ params_hash?: string;
367
395
  }
368
396
  /**
369
397
  * Scheduling Wow Phase 1 §5.3 (Task 7) — the delegation-policy snapshot baked
@@ -493,6 +521,59 @@ export interface PermissionVcClaims_V3 extends Omit<PermissionVcClaims_V2, 'v'>
493
521
  * no enforcement gate reads it. {@link VcSchedulingDelegationClaim}.
494
522
  */
495
523
  schedulingDelegation?: VcSchedulingDelegationClaim;
524
+ /**
525
+ * How this credential came to exist (#954).
526
+ *
527
+ * - `'user_approved'` — a person consented. Paired with {@link approval},
528
+ * which carries the back-reference to the approval request and outcome.
529
+ * - `'auto_issued'` — consent was given on the user's behalf: a Cedar
530
+ * permit, an advance delegation policy, or a signup funnel.
531
+ * - `'unrecorded'` — provenance is genuinely unknown. Credentials issued
532
+ * before the consent type was recorded, and any path where no approval
533
+ * assertion reaches the issuer, land here.
534
+ *
535
+ * Derived from the approval's `consent_type` — HOW the consent was
536
+ * obtained — and never from `granted_by`, which records WHO. Those come
537
+ * apart in practice: booking start writes `granted_by: 'system'` for both
538
+ * an explicit human click and an automatic funnel, because the visitor's
539
+ * identity is gone by the time the credential is issued.
540
+ *
541
+ * The third value is not a placeholder to be tidied away later. Guessing
542
+ * between the other two would fabricate audit data, and this claim is
543
+ * signed — it cannot be corrected once issued.
544
+ *
545
+ * Never taken from the request: `approvalAssertion` is an internal-only
546
+ * extension on `issueVC` precisely so this stays true (see the comment on
547
+ * `IssueVCRequestDto`).
548
+ *
549
+ * Optional, and permanently so. The type describes credentials that are
550
+ * already signed and in circulation; those cannot be re-issued to carry a
551
+ * new field, so a required one would invalidate them at the type layer.
552
+ * Absent means "issued before #954", not "auto-issued".
553
+ *
554
+ * Audit and disclosure metadata — no gate reads it to decide anything. If a
555
+ * gate ever should, the decision belongs in policy, against `approval`,
556
+ * rather than against a label the issuer wrote about itself.
557
+ */
558
+ issuance_mode?: 'user_approved' | 'auto_issued' | 'unrecorded';
559
+ /**
560
+ * Why this credential was requested, in the requester's own words (#955).
561
+ *
562
+ * Free text, deliberately. Narrowing it to a vocabulary would turn a
563
+ * description into a decision input, and Phase 1 neither records nor
564
+ * evaluates it (DEV-INSTRUCTIONS §256) — no gate reads it, and none should
565
+ * without that being a decision someone makes on purpose.
566
+ *
567
+ * SD-protected at issuance. Natural language written by a person tends to
568
+ * name people, accounts and circumstances, so a verifier gets it only when
569
+ * the holder chooses to disclose it. Keep it out of audit logs and error
570
+ * messages for the same reason.
571
+ *
572
+ * Optional, and permanently so: the type describes credentials already
573
+ * signed and in circulation, which cannot be re-issued to carry a new
574
+ * field.
575
+ */
576
+ intent_description?: string;
496
577
  }
497
578
  /**
498
579
  * Permission VC Claims (canonical union of v2 + v3).
@@ -1 +1 @@
1
- {"version":3,"file":"permission-vc.d.ts","sourceRoot":"","sources":["../../src/types/permission-vc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAEjF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,uBAAuB;IACvB,IAAI,CAAC,EAAE,wBAAwB,CAAA;IAC/B,iDAAiD;IACjD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,0CAA0C;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,wCA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ential",
9
9
  TEMPORARY = "TemporaryCredential",
10
10
  ADMIN = "AdminCredential",
11
- RECEIPT = "ReceiptCredential"
11
+ RECEIPT = "ReceiptCredential",
12
+ /**
13
+ * Account attributes asserted by an organisation about the account holder
14
+ * (OEM ⑯). Issued server-to-server, never from a user's own grants.
15
+ */
16
+ ACCOUNT = "AccountCredential",
17
+ /**
18
+ * Agent instance card (OEM ⑯, Model C). Carries a pointer to the service
19
+ * card and the hash that pins it — not the capability description itself.
20
+ */
21
+ AGENT_CARD = "AgentCardCredential"
12
22
  }
13
23
  /**
14
24
  * Credential Status enumeration
@@ -1 +1 @@
1
- {"version":3,"file":"vc.d.ts","sourceRoot":"","sources":["../../src/types/vc.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,cAAc;IACxB,cAAc,4BAA4B;IAC1C,WAAW,yBAAyB;IACpC,SAAS,wBAAwB;IACjC,SAAS,wBAAwB;IACjC,KAAK,oBAAoB;IACzB,OAAO,sBAAsB;CAC9B;AAED;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAED;;;;;;;GAOG;AACH,oBAAY,MAAM;IAChB,iBAAiB,qBAAqB;IACtC,OAAO,YAAY;CACpB;AAED;;;;;;;;;;GAUG;AACH,oBAAY,QAAQ;IAClB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,gBAAgB,GAAG,QAAQ,CAe7E;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,QAAQ,GAAG,gBAAgB,CAgB7E;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;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,QAAQ,CAAC,EAAE,CAAA;KACzC,CAAA;CACF;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IACrB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAA;CAC9B"}
@@ -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,WA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AAG,IAAI;CAelE"}
@@ -1 +1 @@
1
- {"version":3,"file":"sdjwt-disclosure.d.ts","sourceRoot":"","sources":["../../src/utils/sdjwt-disclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB;AAqCD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,gBAAgB,CAYlB"}
1
+ {"version":3,"file":"sdjwt-disclosure.d.ts","sourceRoot":"","sources":["../../src/utils/sdjwt-disclosure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB;AAqED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,gBAAgB,CAYlB"}
@@ -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.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;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,GACA,OAAO,CAAC,MAAM,CAAC;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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EAAE,MAAM,CAAA;KACjB,GACA,OAAO,CAAC,MAAM,CAAC;IAalB,kCAAkC;YACpB,UAAU;IA+CxB;;OAEG;IACG,MAAM,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.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "TypeScript SDK for AI Identity Layer",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -22,7 +22,7 @@
22
22
  "directory": "packages/sdk"
23
23
  },
24
24
  "dependencies": {
25
- "@cedar-policy/cedar-wasm": "4.11.0",
25
+ "@cedar-policy/cedar-wasm": "4.11.2",
26
26
  "@sd-jwt/crypto-nodejs": "^0.15.0",
27
27
  "@sd-jwt/sd-jwt-vc": "^0.15.1",
28
28
  "@sd-jwt/types": "^0.15.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/jest": "^29.5.14",
36
- "@types/node": "^20.19.39",
36
+ "@types/node": "^22.19.17",
37
37
  "@types/uuid": "^9.0.8",
38
38
  "jest": "^29.7.0",
39
39
  "ts-jest": "^29.4.9",