@learncard/types 5.23.0 → 5.23.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/dist/auth.d.ts +63 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/obv3.d.ts +2 -0
- package/dist/obv3.d.ts.map +1 -1
- package/dist/skillIcons.d.ts +18 -0
- package/dist/skillIcons.d.ts.map +1 -0
- package/dist/types.cjs.development.cjs +30 -1
- package/dist/types.cjs.development.cjs.map +3 -3
- package/dist/types.cjs.production.min.cjs +6 -6
- package/dist/types.cjs.production.min.cjs.map +4 -4
- package/dist/types.esm.js +31 -1
- package/dist/types.esm.js.map +4 -4
- package/dist/vc.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auth.ts +65 -3
- package/src/index.ts +1 -0
- package/src/obv3.ts +1 -0
- package/src/skillIcons.ts +31 -0
- package/src/vc.test.ts +10 -3
- package/src/vc.ts +13 -1
package/dist/vc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vc.d.ts","sourceRoot":"","sources":["../src/vc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,eAAO,MAAM,gBAAgB,2EAAwD,CAAC;AACtF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvD,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAE/E,eAAO,MAAM,cAAc;;;;mBAM1B,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEnD,eAAO,MAAM,uBAAuB;;;;iBAIl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.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -271,6 +271,8 @@ export interface RecoveryResult {
|
|
|
271
271
|
export interface IdentityRecoverySession {
|
|
272
272
|
recoverySessionToken: string;
|
|
273
273
|
recoveryMethods: RecoveryMethodInfo[];
|
|
274
|
+
/** The verified account's DID (same source as `ServerKeyStatus.primaryDid`). */
|
|
275
|
+
primaryDid: string | null;
|
|
274
276
|
}
|
|
275
277
|
|
|
276
278
|
// ---------------------------------------------------------------------------
|
|
@@ -280,7 +282,15 @@ export interface IdentityRecoverySession {
|
|
|
280
282
|
export type SssActivationState = 'provisional' | 'active';
|
|
281
283
|
|
|
282
284
|
/** Optional PIN enrollment requires rotating the existing escrow share. */
|
|
283
|
-
export type EscrowEnrollmentOptions = {
|
|
285
|
+
export type EscrowEnrollmentOptions = {
|
|
286
|
+
pin?: string;
|
|
287
|
+
/** P9.1 (attack C): required by the enclave for nitro/authority-mode
|
|
288
|
+
* enroll/replace; bound into the sealed blob + signed intent, never read
|
|
289
|
+
* or changed by lca-api. The authenticated account's email + the app's
|
|
290
|
+
* current locale (one of the compiled template languages). */
|
|
291
|
+
recoveryEmail?: string;
|
|
292
|
+
recoveryLanguage?: string;
|
|
293
|
+
};
|
|
284
294
|
|
|
285
295
|
/** Stable error-message contract shared by PIN recovery clients and servers. */
|
|
286
296
|
export const ESCROW_PIN_LOCKED_MESSAGE =
|
|
@@ -385,6 +395,20 @@ export interface KeyDerivationCapabilities {
|
|
|
385
395
|
// Key Derivation Strategy (generic)
|
|
386
396
|
// ---------------------------------------------------------------------------
|
|
387
397
|
|
|
398
|
+
/** Initiating-client bindings. Persist with the recovery secrets and never replace
|
|
399
|
+
* these with fields from a status response. Missing bindings require a new start. */
|
|
400
|
+
export interface EscrowRecoveryExpectations {
|
|
401
|
+
tenant: string;
|
|
402
|
+
did: string;
|
|
403
|
+
holdId: string;
|
|
404
|
+
clientEphemeralPublicKey: string;
|
|
405
|
+
blobHash: string;
|
|
406
|
+
authorityGeneration: string;
|
|
407
|
+
holdDigest: string;
|
|
408
|
+
ledgerPublicKey: string;
|
|
409
|
+
keyId: string;
|
|
410
|
+
}
|
|
411
|
+
|
|
388
412
|
/**
|
|
389
413
|
* Key Derivation Strategy
|
|
390
414
|
*
|
|
@@ -550,18 +574,27 @@ export interface KeyDerivationStrategy<
|
|
|
550
574
|
privateKey: string;
|
|
551
575
|
signDidAuthVp: DidAuthVpSigner;
|
|
552
576
|
pin: string;
|
|
577
|
+
/** P9.1: only `recoveryEmail`/`recoveryLanguage` apply here; `options.pin`
|
|
578
|
+
* is ignored in favor of the required top-level `pin`. */
|
|
579
|
+
options?: EscrowEnrollmentOptions;
|
|
553
580
|
}): Promise<void>;
|
|
554
581
|
|
|
555
|
-
/** Remove a PIN by rotating escrow material with an owner proof.
|
|
582
|
+
/** Remove a PIN by rotating escrow material with an owner proof. In
|
|
583
|
+
* nitro/authority mode this is a `replace` enrollment action, which
|
|
584
|
+
* requires `options.recoveryEmail`/`recoveryLanguage`, same as
|
|
585
|
+
* `setEscrowPin`. */
|
|
556
586
|
clearEscrowPin?(params: {
|
|
557
587
|
token: string;
|
|
558
588
|
providerType: AuthProviderType;
|
|
559
589
|
privateKey: string;
|
|
560
590
|
signDidAuthVp: DidAuthVpSigner;
|
|
591
|
+
options?: EscrowEnrollmentOptions;
|
|
561
592
|
}): Promise<void>;
|
|
562
593
|
|
|
563
594
|
/** Start an escrow hold. Securely persist the returned secrets; null means an existing hold. */
|
|
564
595
|
startEscrowRecovery?(params: {
|
|
596
|
+
/** Account selected by the initiating client, required for Nitro recovery. */
|
|
597
|
+
expectedDid?: string;
|
|
565
598
|
token?: string;
|
|
566
599
|
providerType?: AuthProviderType;
|
|
567
600
|
recoverySessionToken?: string;
|
|
@@ -576,15 +609,19 @@ export interface KeyDerivationStrategy<
|
|
|
576
609
|
completedAt?: string;
|
|
577
610
|
resumeToken: string | null;
|
|
578
611
|
clientEphemeralPrivateKey: string;
|
|
612
|
+
/** Persist alongside the private key; pass unchanged on status, confirm and restore. */
|
|
613
|
+
expectations?: EscrowRecoveryExpectations;
|
|
579
614
|
pinSalt?: string;
|
|
580
615
|
/** Absent on legacy hold-only strategies. */
|
|
581
616
|
releasePolicy?: 'hold' | 'pin';
|
|
617
|
+
/** Present only for an authority-mode hold-policy hold; see confirmEscrowRecovery. */
|
|
618
|
+
requiresConfirmation?: boolean;
|
|
582
619
|
}>;
|
|
583
620
|
|
|
584
621
|
/** Read a hold using its resume proof or the active device's provider session. */
|
|
585
622
|
getEscrowRecoveryStatus?(
|
|
586
623
|
params:
|
|
587
|
-
| { holdId: string; resumeToken: string }
|
|
624
|
+
| { holdId: string; resumeToken: string; expectations?: EscrowRecoveryExpectations }
|
|
588
625
|
| { token: string; providerType: AuthProviderType }
|
|
589
626
|
): Promise<{
|
|
590
627
|
holdId: string;
|
|
@@ -595,6 +632,9 @@ export interface KeyDerivationStrategy<
|
|
|
595
632
|
releasePolicy?: 'hold' | 'pin';
|
|
596
633
|
cancelledAt?: string;
|
|
597
634
|
completedAt?: string;
|
|
635
|
+
/** Only present for an authority-mode hold-policy hold; `confirmed` only appears alongside it. */
|
|
636
|
+
requiresConfirmation?: boolean;
|
|
637
|
+
confirmed?: boolean;
|
|
598
638
|
} | null>;
|
|
599
639
|
|
|
600
640
|
/** Cancel a pending hold with a fresh, owner-signed DID challenge. */
|
|
@@ -605,6 +645,28 @@ export interface KeyDerivationStrategy<
|
|
|
605
645
|
signDidAuthVp: DidAuthVpSigner;
|
|
606
646
|
}): Promise<{ cancelled: boolean }>;
|
|
607
647
|
|
|
648
|
+
/**
|
|
649
|
+
* Submit the confirmation code the enclave emailed to the account's
|
|
650
|
+
* recovery address. Only meaningful when startEscrowRecovery returned
|
|
651
|
+
* `requiresConfirmation: true`; the resume proof (no DID session exists
|
|
652
|
+
* yet at this point in the flow) is the only credential.
|
|
653
|
+
*/
|
|
654
|
+
confirmEscrowRecovery?(params: {
|
|
655
|
+
/** Retained initiating-client bindings, required in Nitro mode, including after reload. */
|
|
656
|
+
expectations?: EscrowRecoveryExpectations;
|
|
657
|
+
holdId: string;
|
|
658
|
+
resumeToken: string;
|
|
659
|
+
code: string;
|
|
660
|
+
tenantId?: string;
|
|
661
|
+
}): Promise<{ success: true }>;
|
|
662
|
+
|
|
663
|
+
/** Request a fresh confirmation code for a hold awaiting confirmation. */
|
|
664
|
+
resendEscrowRecoveryCode?(params: {
|
|
665
|
+
holdId: string;
|
|
666
|
+
resumeToken: string;
|
|
667
|
+
tenantId?: string;
|
|
668
|
+
}): Promise<{ success: true }>;
|
|
669
|
+
|
|
608
670
|
/** Execute a recovery flow and return the recovered private key + DID */
|
|
609
671
|
executeRecovery(params: {
|
|
610
672
|
token: string;
|
package/src/index.ts
CHANGED
package/src/obv3.ts
CHANGED
|
@@ -234,6 +234,7 @@ export const AchievementSubjectValidator = z
|
|
|
234
234
|
export type AchievementSubject = z.infer<typeof AchievementSubjectValidator>;
|
|
235
235
|
|
|
236
236
|
export const UnsignedAchievementCredentialValidator = UnsignedVCValidator.extend({
|
|
237
|
+
awardedDate: z.string().optional(),
|
|
237
238
|
name: z.string().optional(),
|
|
238
239
|
description: z.string().optional(),
|
|
239
240
|
image: ImageValidator.optional(),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Per-request limits for AI skill icon generation (`ai.generateSkillIcons`).
|
|
5
|
+
*
|
|
6
|
+
* Clients split large skill frameworks into batches that fit within these limits, and the
|
|
7
|
+
* server rejects anything larger. The limits exist because:
|
|
8
|
+
* - `ai.generateSkillIcons` is sent as a GET with every name in the URL, and API Gateway
|
|
9
|
+
* returns HTTP 431 once the request line passes ~10KB (browsers add headers on top).
|
|
10
|
+
* - Generation takes ~80ms per name, and the server enforces a 25s model timeout.
|
|
11
|
+
*/
|
|
12
|
+
export const SKILL_ICON_MAX_NAMES_PER_REQUEST = 100;
|
|
13
|
+
export const SKILL_ICON_MAX_CHARACTERS_PER_REQUEST = 2500;
|
|
14
|
+
|
|
15
|
+
export const SkillIconNamesValidator = z
|
|
16
|
+
.array(z.string().nonempty())
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(SKILL_ICON_MAX_NAMES_PER_REQUEST, {
|
|
19
|
+
message: `A maximum of ${SKILL_ICON_MAX_NAMES_PER_REQUEST} skill names can be sent per request`,
|
|
20
|
+
})
|
|
21
|
+
.refine(
|
|
22
|
+
names =>
|
|
23
|
+
names.reduce((total, name) => total + name.length, 0) <=
|
|
24
|
+
SKILL_ICON_MAX_CHARACTERS_PER_REQUEST,
|
|
25
|
+
{
|
|
26
|
+
message: `Skill names may total at most ${SKILL_ICON_MAX_CHARACTERS_PER_REQUEST} characters per request`,
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const GenerateSkillIconsInputValidator = z.object({ names: SkillIconNamesValidator });
|
|
31
|
+
export type GenerateSkillIconsInput = z.infer<typeof GenerateSkillIconsInputValidator>;
|
package/src/vc.test.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import { expect, test } from 'vitest';
|
|
2
2
|
import { ProofValidator } from './vc';
|
|
3
3
|
|
|
4
|
-
test(
|
|
4
|
+
test.each([
|
|
5
|
+
'ecdsa-rdfc-2019',
|
|
6
|
+
'ecdsa-jcs-2019',
|
|
7
|
+
'ecdsa-sd-2023',
|
|
8
|
+
'eddsa-rdfc-2022',
|
|
9
|
+
'eddsa-jcs-2022',
|
|
10
|
+
'bbs-2023',
|
|
11
|
+
])('final %s DataIntegrityProofs may omit created', cryptosuite => {
|
|
5
12
|
const proof = {
|
|
6
13
|
type: 'DataIntegrityProof',
|
|
7
|
-
cryptosuite
|
|
14
|
+
cryptosuite,
|
|
8
15
|
proofPurpose: 'authentication',
|
|
9
16
|
verificationMethod: 'did:example:holder#key',
|
|
10
17
|
proofValue: 'zSignature',
|
|
11
18
|
};
|
|
12
19
|
|
|
13
20
|
expect(ProofValidator.parse(proof)).toEqual(proof);
|
|
14
|
-
const legacy = { ...proof, cryptosuite: '
|
|
21
|
+
const legacy = { ...proof, cryptosuite: 'unknown-suite' };
|
|
15
22
|
expect(ProofValidator.safeParse(legacy).success).toBe(false);
|
|
16
23
|
expect(ProofValidator.safeParse({ ...legacy, created: '2026-01-01T00:00:00Z' }).success).toBe(
|
|
17
24
|
true
|
package/src/vc.ts
CHANGED
|
@@ -200,7 +200,19 @@ export const ProofValidator = z
|
|
|
200
200
|
.superRefine((proof, ctx) => {
|
|
201
201
|
if (
|
|
202
202
|
proof.created === undefined &&
|
|
203
|
-
|
|
203
|
+
// These standardized Data Integrity suites make created optional.
|
|
204
|
+
// Keep the prior requirement for legacy and unknown proof suites.
|
|
205
|
+
// https://www.w3.org/TR/vc-di-eddsa/#proof-configuration-eddsa-jcs-2022
|
|
206
|
+
// https://www.w3.org/TR/vc-di-bbs/#proof-configuration
|
|
207
|
+
(proof.type !== 'DataIntegrityProof' ||
|
|
208
|
+
![
|
|
209
|
+
'ecdsa-rdfc-2019',
|
|
210
|
+
'ecdsa-jcs-2019',
|
|
211
|
+
'ecdsa-sd-2023',
|
|
212
|
+
'eddsa-rdfc-2022',
|
|
213
|
+
'eddsa-jcs-2022',
|
|
214
|
+
'bbs-2023',
|
|
215
|
+
].includes(proof.cryptosuite as string))
|
|
204
216
|
) {
|
|
205
217
|
ctx.addIssue({
|
|
206
218
|
code: 'custom',
|