@learncard/sss-key-manager 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/escrow-attestation.d.ts +2 -9
  2. package/dist/escrow-attestation.d.ts.map +1 -1
  3. package/dist/escrow-authority.d.ts +112 -0
  4. package/dist/escrow-authority.d.ts.map +1 -0
  5. package/dist/escrow-authority.types.d.ts +51 -0
  6. package/dist/escrow-authority.types.d.ts.map +1 -0
  7. package/dist/escrow-crypto.d.ts +9 -1
  8. package/dist/escrow-crypto.d.ts.map +1 -1
  9. package/dist/escrow-enrollment-intent.d.ts +13 -0
  10. package/dist/escrow-enrollment-intent.d.ts.map +1 -0
  11. package/dist/escrow-enrollment-intent.types.d.ts +28 -0
  12. package/dist/escrow-enrollment-intent.types.d.ts.map +1 -0
  13. package/dist/escrow-nitro-attestation.d.ts +2 -0
  14. package/dist/escrow-nitro-attestation.d.ts.map +1 -1
  15. package/dist/index.d.ts +8 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/sss-key-manager.cjs.development.js +1592 -213
  18. package/dist/sss-key-manager.cjs.development.js.map +4 -4
  19. package/dist/sss-key-manager.cjs.production.min.js +28 -23
  20. package/dist/sss-key-manager.cjs.production.min.js.map +4 -4
  21. package/dist/sss-key-manager.esm.js +1107 -163
  22. package/dist/sss-key-manager.esm.js.map +4 -4
  23. package/dist/sss-strategy.d.ts.map +1 -1
  24. package/dist/types.d.ts +16 -1
  25. package/dist/types.d.ts.map +1 -1
  26. package/package.json +2 -2
  27. package/src/__fixtures__/escrow-authority-v1.json +96 -0
  28. package/src/__fixtures__/escrow-carry-contact-contract-v1.json +33 -0
  29. package/src/__fixtures__/escrow-enrollment-intent-v1.json +26 -0
  30. package/src/__fixtures__/nitro-attestation-real/staging-nsm-document.json +16 -0
  31. package/src/escrow-attestation.ts +10 -9
  32. package/src/escrow-authority.test.ts +643 -0
  33. package/src/escrow-authority.ts +597 -0
  34. package/src/escrow-authority.types.ts +56 -0
  35. package/src/escrow-crypto.ts +39 -1
  36. package/src/escrow-enrollment-intent.test.ts +224 -0
  37. package/src/escrow-enrollment-intent.ts +236 -0
  38. package/src/escrow-enrollment-intent.types.ts +28 -0
  39. package/src/escrow-nitro-attestation.test.ts +72 -0
  40. package/src/escrow-nitro-attestation.ts +34 -3
  41. package/src/index.ts +27 -0
  42. package/src/sss-authority.test.ts +889 -0
  43. package/src/sss-strategy.ts +479 -38
  44. package/src/types.ts +22 -3
package/src/types.ts CHANGED
@@ -93,10 +93,19 @@ export interface EscrowHoldStatus {
93
93
  releaseAfter: string;
94
94
  cancelledAt?: string;
95
95
  completedAt?: string;
96
+ /** Only present for an authority-mode hold-policy hold; `confirmed` only appears alongside it. */
97
+ requiresConfirmation?: boolean;
98
+ confirmed?: boolean;
99
+ /** Opaque enclave-signed `SignedHoldRecord`; present only in authority
100
+ * (nitro) mode. Callers must verify it with `verifyEscrowHoldRecord`
101
+ * before trusting any field inside it — see escrow-authority.ts. */
102
+ holdRecord?: import('./escrow-authority').EscrowHoldRecordLike;
96
103
  }
97
104
 
98
105
  /** Persist these secrets securely until completion; a null token means an existing hold. */
99
106
  export type EscrowRecoveryStart = EscrowHoldStatus & {
107
+ /** Persist with the secrets, never rebuild from server status. Required for Nitro resume. */
108
+ expectations?: import('@learncard/types').EscrowRecoveryExpectations;
100
109
  resumeToken: string | null;
101
110
  clientEphemeralPrivateKey: string;
102
111
  pinSalt?: string;
@@ -166,8 +175,15 @@ export type RecoveryMethod =
166
175
  * SSS-specific recovery input — what the user provides to recover their key.
167
176
  */
168
177
  export type RecoveryInput =
169
- | { method: 'escrow-pin'; pin: string }
170
- | { method: 'escrow'; holdId: string; resumeToken: string; clientEphemeralPrivateKey: string }
178
+ | { method: 'escrow-pin'; pin: string; expectedDid?: string }
179
+ | {
180
+ method: 'escrow';
181
+ holdId: string;
182
+ resumeToken: string;
183
+ clientEphemeralPrivateKey: string;
184
+ /** Original start bindings loaded with the private key, required for Nitro. */
185
+ expectations?: import('@learncard/types').EscrowRecoveryExpectations;
186
+ }
171
187
  | { method: 'passkey'; credentialId: string }
172
188
  | { method: 'phrase'; phrase: string }
173
189
  | { method: 'backup'; fileContents: string; password: string }
@@ -285,7 +301,10 @@ export type SSSKeyDerivationStrategy = KeyDerivationStrategy<
285
301
  RecoverySetupInput,
286
302
  RecoverySetupResult,
287
303
  RecoveryConfirmationInput
288
- >;
304
+ > & {
305
+ /** Last receipt/snapshot-verified ciphertext for this session, never a freshness oracle. */
306
+ getVerifiedEscrowEnvelope?(): import('./escrow-crypto').EscrowEnvelope | null;
307
+ };
289
308
 
290
309
  // ---------------------------------------------------------------------------
291
310
  // Legacy types (deprecated)