@learncard/sss-key-manager 0.2.0 → 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.
- package/README.md +13 -0
- package/dist/escrow-attestation.d.ts +2 -5
- package/dist/escrow-attestation.d.ts.map +1 -1
- package/dist/escrow-authority.d.ts +112 -0
- package/dist/escrow-authority.d.ts.map +1 -0
- package/dist/escrow-authority.types.d.ts +51 -0
- package/dist/escrow-authority.types.d.ts.map +1 -0
- package/dist/escrow-crypto.d.ts +9 -1
- package/dist/escrow-crypto.d.ts.map +1 -1
- package/dist/escrow-enrollment-intent.d.ts +13 -0
- package/dist/escrow-enrollment-intent.d.ts.map +1 -0
- package/dist/escrow-enrollment-intent.types.d.ts +28 -0
- package/dist/escrow-enrollment-intent.types.d.ts.map +1 -0
- package/dist/escrow-nitro-attestation.d.ts +34 -0
- package/dist/escrow-nitro-attestation.d.ts.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/sss-key-manager.cjs.development.js +4478 -424
- package/dist/sss-key-manager.cjs.development.js.map +4 -4
- package/dist/sss-key-manager.cjs.production.min.js +37 -32
- package/dist/sss-key-manager.cjs.production.min.js.map +4 -4
- package/dist/sss-key-manager.esm.js +1813 -265
- package/dist/sss-key-manager.esm.js.map +4 -4
- package/dist/sss-strategy.d.ts.map +1 -1
- package/dist/types.d.ts +31 -5
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/__fixtures__/escrow-authority-v1.json +96 -0
- package/src/__fixtures__/escrow-carry-contact-contract-v1.json +33 -0
- package/src/__fixtures__/escrow-enrollment-intent-v1.json +26 -0
- package/src/__fixtures__/escrow-vectors-rust.json +82 -0
- package/src/__fixtures__/escrow-vectors.json +103 -0
- package/src/__fixtures__/nitro-attestation/bad-signature.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/debug-zero-pcrs.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/legacy-user-data.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/manifest.json +60 -0
- package/src/__fixtures__/nitro-attestation/nonce-mismatch.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/root.pem +12 -0
- package/src/__fixtures__/nitro-attestation/stale-timestamp.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/tampered-previous-key-ids.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/truncated-chain.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/valid.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/wrong-pcr0.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation/wrong-root.cbor.b64 +1 -0
- package/src/__fixtures__/nitro-attestation-real/staging-nsm-document.json +16 -0
- package/src/escrow-attestation.test.ts +7 -2
- package/src/escrow-attestation.ts +72 -10
- package/src/escrow-authority.test.ts +643 -0
- package/src/escrow-authority.ts +597 -0
- package/src/escrow-authority.types.ts +56 -0
- package/src/escrow-crypto.ts +39 -1
- package/src/escrow-enrollment-intent.test.ts +224 -0
- package/src/escrow-enrollment-intent.ts +236 -0
- package/src/escrow-enrollment-intent.types.ts +28 -0
- package/src/escrow-nitro-attestation.test.ts +276 -0
- package/src/escrow-nitro-attestation.ts +317 -0
- package/src/escrow-vectors.test.ts +198 -0
- package/src/index.ts +35 -1
- package/src/sss-authority.test.ts +889 -0
- package/src/sss-session-writes.test.ts +2 -2
- package/src/sss-strategy.test.ts +95 -2
- package/src/sss-strategy.ts +596 -115
- package/src/types.ts +34 -4
package/src/types.ts
CHANGED
|
@@ -23,6 +23,7 @@ export {
|
|
|
23
23
|
type DidAuthVpSigner,
|
|
24
24
|
type EscrowEnrollmentOptions,
|
|
25
25
|
type EscrowEnrollmentState,
|
|
26
|
+
type EscrowBlobStaleReason,
|
|
26
27
|
type EscrowPinStatus,
|
|
27
28
|
} from '@learncard/types';
|
|
28
29
|
|
|
@@ -71,7 +72,17 @@ export type RecoveryMethodType = 'passkey' | 'backup' | 'phrase' | 'email' | 'es
|
|
|
71
72
|
/** Trust policy for the enclave that receives recovery material. */
|
|
72
73
|
export type EscrowAttestationPolicy =
|
|
73
74
|
| { mode: 'software'; pinnedPublicKeys: string[] }
|
|
74
|
-
| {
|
|
75
|
+
| {
|
|
76
|
+
mode: 'nitro';
|
|
77
|
+
/** Legacy image-only pins remain assignable but never match an attestation. */
|
|
78
|
+
pinnedMeasurements: (
|
|
79
|
+
| { pcr0: string; pcr1: string; pcr2: string; imageSha384?: string }
|
|
80
|
+
| { imageSha384: string; pcr0?: string; pcr1?: string; pcr2?: string }
|
|
81
|
+
)[];
|
|
82
|
+
rootCertificateSha256?: string;
|
|
83
|
+
/** Maximum age in milliseconds; defaults to five minutes. */
|
|
84
|
+
maxAgeMs?: number;
|
|
85
|
+
};
|
|
75
86
|
|
|
76
87
|
/** Public status of an escrow recovery waiting period. */
|
|
77
88
|
export interface EscrowHoldStatus {
|
|
@@ -82,10 +93,19 @@ export interface EscrowHoldStatus {
|
|
|
82
93
|
releaseAfter: string;
|
|
83
94
|
cancelledAt?: string;
|
|
84
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;
|
|
85
103
|
}
|
|
86
104
|
|
|
87
105
|
/** Persist these secrets securely until completion; a null token means an existing hold. */
|
|
88
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;
|
|
89
109
|
resumeToken: string | null;
|
|
90
110
|
clientEphemeralPrivateKey: string;
|
|
91
111
|
pinSalt?: string;
|
|
@@ -155,8 +175,15 @@ export type RecoveryMethod =
|
|
|
155
175
|
* SSS-specific recovery input — what the user provides to recover their key.
|
|
156
176
|
*/
|
|
157
177
|
export type RecoveryInput =
|
|
158
|
-
| { method: 'escrow-pin'; pin: string }
|
|
159
|
-
| {
|
|
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
|
+
}
|
|
160
187
|
| { method: 'passkey'; credentialId: string }
|
|
161
188
|
| { method: 'phrase'; phrase: string }
|
|
162
189
|
| { method: 'backup'; fileContents: string; password: string }
|
|
@@ -274,7 +301,10 @@ export type SSSKeyDerivationStrategy = KeyDerivationStrategy<
|
|
|
274
301
|
RecoverySetupInput,
|
|
275
302
|
RecoverySetupResult,
|
|
276
303
|
RecoveryConfirmationInput
|
|
277
|
-
|
|
304
|
+
> & {
|
|
305
|
+
/** Last receipt/snapshot-verified ciphertext for this session, never a freshness oracle. */
|
|
306
|
+
getVerifiedEscrowEnvelope?(): import('./escrow-crypto').EscrowEnvelope | null;
|
|
307
|
+
};
|
|
278
308
|
|
|
279
309
|
// ---------------------------------------------------------------------------
|
|
280
310
|
// Legacy types (deprecated)
|