@learncard/types 5.18.3 → 5.20.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.
- package/dist/clr.d.ts +8 -8
- package/dist/credential-refresh.d.ts +1634 -0
- package/dist/credential-refresh.d.ts.map +1 -0
- package/dist/did.d.ts +2 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lcn.d.ts +196 -51
- package/dist/lcn.d.ts.map +1 -1
- package/dist/obv3.d.ts +8 -8
- package/dist/types.cjs.development.cjs +269 -15
- package/dist/types.cjs.development.cjs.map +3 -3
- package/dist/types.cjs.production.min.cjs +7 -7
- package/dist/types.cjs.production.min.cjs.map +4 -4
- package/dist/types.esm.js +270 -15
- package/dist/types.esm.js.map +4 -4
- package/dist/vc.d.ts +13 -13
- package/dist/vc.d.ts.map +1 -1
- package/dist/vc.test.d.ts +2 -0
- package/dist/vc.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/credential-refresh.ts +336 -0
- package/src/index.ts +1 -0
- package/src/lcn.ts +66 -18
- package/src/vc.test.ts +35 -0
- package/src/vc.ts +14 -2
package/dist/vc.d.ts
CHANGED
|
@@ -351,7 +351,7 @@ export declare const UnsignedVCValidator: z.ZodObject<{
|
|
|
351
351
|
export type UnsignedVC = z.infer<typeof UnsignedVCValidator>;
|
|
352
352
|
export declare const ProofValidator: z.ZodObject<{
|
|
353
353
|
type: z.ZodString;
|
|
354
|
-
created: z.ZodString
|
|
354
|
+
created: z.ZodOptional<z.ZodString>;
|
|
355
355
|
challenge: z.ZodOptional<z.ZodString>;
|
|
356
356
|
domain: z.ZodOptional<z.ZodString>;
|
|
357
357
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -510,7 +510,7 @@ export declare const VCValidator: z.ZodObject<{
|
|
|
510
510
|
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
|
|
511
511
|
proof: z.ZodUnion<[z.ZodObject<{
|
|
512
512
|
type: z.ZodString;
|
|
513
|
-
created: z.ZodString
|
|
513
|
+
created: z.ZodOptional<z.ZodString>;
|
|
514
514
|
challenge: z.ZodOptional<z.ZodString>;
|
|
515
515
|
domain: z.ZodOptional<z.ZodString>;
|
|
516
516
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -519,7 +519,7 @@ export declare const VCValidator: z.ZodObject<{
|
|
|
519
519
|
jws: z.ZodOptional<z.ZodString>;
|
|
520
520
|
}, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
|
|
521
521
|
type: z.ZodString;
|
|
522
|
-
created: z.ZodString
|
|
522
|
+
created: z.ZodOptional<z.ZodString>;
|
|
523
523
|
challenge: z.ZodOptional<z.ZodString>;
|
|
524
524
|
domain: z.ZodOptional<z.ZodString>;
|
|
525
525
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -683,7 +683,7 @@ export declare const UnsignedVPValidator: z.ZodObject<{
|
|
|
683
683
|
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
|
|
684
684
|
proof: z.ZodUnion<[z.ZodObject<{
|
|
685
685
|
type: z.ZodString;
|
|
686
|
-
created: z.ZodString
|
|
686
|
+
created: z.ZodOptional<z.ZodString>;
|
|
687
687
|
challenge: z.ZodOptional<z.ZodString>;
|
|
688
688
|
domain: z.ZodOptional<z.ZodString>;
|
|
689
689
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -692,7 +692,7 @@ export declare const UnsignedVPValidator: z.ZodObject<{
|
|
|
692
692
|
jws: z.ZodOptional<z.ZodString>;
|
|
693
693
|
}, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
|
|
694
694
|
type: z.ZodString;
|
|
695
|
-
created: z.ZodString
|
|
695
|
+
created: z.ZodOptional<z.ZodString>;
|
|
696
696
|
challenge: z.ZodOptional<z.ZodString>;
|
|
697
697
|
domain: z.ZodOptional<z.ZodString>;
|
|
698
698
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -850,7 +850,7 @@ export declare const UnsignedVPValidator: z.ZodObject<{
|
|
|
850
850
|
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
|
|
851
851
|
proof: z.ZodUnion<[z.ZodObject<{
|
|
852
852
|
type: z.ZodString;
|
|
853
|
-
created: z.ZodString
|
|
853
|
+
created: z.ZodOptional<z.ZodString>;
|
|
854
854
|
challenge: z.ZodOptional<z.ZodString>;
|
|
855
855
|
domain: z.ZodOptional<z.ZodString>;
|
|
856
856
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -859,7 +859,7 @@ export declare const UnsignedVPValidator: z.ZodObject<{
|
|
|
859
859
|
jws: z.ZodOptional<z.ZodString>;
|
|
860
860
|
}, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
|
|
861
861
|
type: z.ZodString;
|
|
862
|
-
created: z.ZodString
|
|
862
|
+
created: z.ZodOptional<z.ZodString>;
|
|
863
863
|
challenge: z.ZodOptional<z.ZodString>;
|
|
864
864
|
domain: z.ZodOptional<z.ZodString>;
|
|
865
865
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -1025,7 +1025,7 @@ export declare const VPValidator: z.ZodObject<{
|
|
|
1025
1025
|
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
|
|
1026
1026
|
proof: z.ZodUnion<[z.ZodObject<{
|
|
1027
1027
|
type: z.ZodString;
|
|
1028
|
-
created: z.ZodString
|
|
1028
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1029
1029
|
challenge: z.ZodOptional<z.ZodString>;
|
|
1030
1030
|
domain: z.ZodOptional<z.ZodString>;
|
|
1031
1031
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -1034,7 +1034,7 @@ export declare const VPValidator: z.ZodObject<{
|
|
|
1034
1034
|
jws: z.ZodOptional<z.ZodString>;
|
|
1035
1035
|
}, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
|
|
1036
1036
|
type: z.ZodString;
|
|
1037
|
-
created: z.ZodString
|
|
1037
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1038
1038
|
challenge: z.ZodOptional<z.ZodString>;
|
|
1039
1039
|
domain: z.ZodOptional<z.ZodString>;
|
|
1040
1040
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -1192,7 +1192,7 @@ export declare const VPValidator: z.ZodObject<{
|
|
|
1192
1192
|
}, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>]>>]>>;
|
|
1193
1193
|
proof: z.ZodUnion<[z.ZodObject<{
|
|
1194
1194
|
type: z.ZodString;
|
|
1195
|
-
created: z.ZodString
|
|
1195
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1196
1196
|
challenge: z.ZodOptional<z.ZodString>;
|
|
1197
1197
|
domain: z.ZodOptional<z.ZodString>;
|
|
1198
1198
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -1201,7 +1201,7 @@ export declare const VPValidator: z.ZodObject<{
|
|
|
1201
1201
|
jws: z.ZodOptional<z.ZodString>;
|
|
1202
1202
|
}, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
|
|
1203
1203
|
type: z.ZodString;
|
|
1204
|
-
created: z.ZodString
|
|
1204
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1205
1205
|
challenge: z.ZodOptional<z.ZodString>;
|
|
1206
1206
|
domain: z.ZodOptional<z.ZodString>;
|
|
1207
1207
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -1213,7 +1213,7 @@ export declare const VPValidator: z.ZodObject<{
|
|
|
1213
1213
|
holder: z.ZodOptional<z.ZodString>;
|
|
1214
1214
|
proof: z.ZodUnion<[z.ZodObject<{
|
|
1215
1215
|
type: z.ZodString;
|
|
1216
|
-
created: z.ZodString
|
|
1216
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1217
1217
|
challenge: z.ZodOptional<z.ZodString>;
|
|
1218
1218
|
domain: z.ZodOptional<z.ZodString>;
|
|
1219
1219
|
nonce: z.ZodOptional<z.ZodString>;
|
|
@@ -1222,7 +1222,7 @@ export declare const VPValidator: z.ZodObject<{
|
|
|
1222
1222
|
jws: z.ZodOptional<z.ZodString>;
|
|
1223
1223
|
}, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
|
|
1224
1224
|
type: z.ZodString;
|
|
1225
|
-
created: z.ZodString
|
|
1225
|
+
created: z.ZodOptional<z.ZodString>;
|
|
1226
1226
|
challenge: z.ZodOptional<z.ZodString>;
|
|
1227
1227
|
domain: z.ZodOptional<z.ZodString>;
|
|
1228
1228
|
nonce: z.ZodOptional<z.ZodString>;
|
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;;;;iBAIlC,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAErE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;iBAU3B,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,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nsignedVCValidator, VCValidator } from './vc';
|
|
4
|
+
import { JWEValidator } from './crypto';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shared contracts for managed credential refresh (LC-2117, LC-2135, LC-2136).
|
|
8
|
+
*
|
|
9
|
+
* The generic `RefreshServiceValidator` in vc.ts intentionally remains permissive so
|
|
10
|
+
* unknown third-party refresh services keep parsing. These validators model the
|
|
11
|
+
* LearnCard-managed `LearnCardCredentialRefresh2026` service, its allocation/publication
|
|
12
|
+
* lifecycle, the holder-facing response envelopes, and safe refresh outcomes.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** LearnCard DID-auth extension descriptor for a managed refresh service */
|
|
16
|
+
export const LearnCardRefreshAuthorizationValidator = z
|
|
17
|
+
.object({ type: z.literal('LearnCardDIDAuth') })
|
|
18
|
+
.catchall(z.any());
|
|
19
|
+
export type LearnCardRefreshAuthorization = z.infer<typeof LearnCardRefreshAuthorizationValidator>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Managed refresh service descriptor.
|
|
23
|
+
*
|
|
24
|
+
* Requires a resolvable `id` and the versioned LearnCard type, and optionally carries a
|
|
25
|
+
* LearnCard authorization descriptor. This is distinct from the 1EdTech protocol.
|
|
26
|
+
*/
|
|
27
|
+
export const ManagedCredentialRefreshServiceValidator = z
|
|
28
|
+
.object({
|
|
29
|
+
id: z.string().min(1),
|
|
30
|
+
type: z.literal('LearnCardCredentialRefresh2026'),
|
|
31
|
+
authorization: LearnCardRefreshAuthorizationValidator.optional(),
|
|
32
|
+
})
|
|
33
|
+
.catchall(z.any());
|
|
34
|
+
export type ManagedCredentialRefreshService = z.infer<
|
|
35
|
+
typeof ManagedCredentialRefreshServiceValidator
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
/** Standard 1EdTech protocol: HTTPS GET returning a signed VC or VC-JWT. */
|
|
39
|
+
export const StandardCredentialRefreshServiceValidator = z
|
|
40
|
+
.object({
|
|
41
|
+
id: z.string().min(1),
|
|
42
|
+
type: z.literal('1EdTechCredentialRefresh'),
|
|
43
|
+
})
|
|
44
|
+
.catchall(z.any());
|
|
45
|
+
export const SupportedCredentialRefreshServiceValidator = z.union([
|
|
46
|
+
ManagedCredentialRefreshServiceValidator,
|
|
47
|
+
StandardCredentialRefreshServiceValidator,
|
|
48
|
+
]);
|
|
49
|
+
export type SupportedCredentialRefreshService = z.infer<
|
|
50
|
+
typeof SupportedCredentialRefreshServiceValidator
|
|
51
|
+
>;
|
|
52
|
+
|
|
53
|
+
// --- Allocation (before signing) -------------------------------------------
|
|
54
|
+
|
|
55
|
+
export const AllocateCredentialRefreshInputValidator = z.object({
|
|
56
|
+
holder: z.object({
|
|
57
|
+
profileId: z.string().optional(),
|
|
58
|
+
did: z.string().min(1),
|
|
59
|
+
}),
|
|
60
|
+
credentialId: z.string().min(1),
|
|
61
|
+
});
|
|
62
|
+
export type AllocateCredentialRefreshInput = z.infer<
|
|
63
|
+
typeof AllocateCredentialRefreshInputValidator
|
|
64
|
+
>;
|
|
65
|
+
|
|
66
|
+
export const AllocateCredentialRefreshResultValidator = z.object({
|
|
67
|
+
refreshId: z.string().min(1),
|
|
68
|
+
refreshService: ManagedCredentialRefreshServiceValidator.extend({
|
|
69
|
+
authorization: LearnCardRefreshAuthorizationValidator,
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
export type AllocateCredentialRefreshResult = z.infer<
|
|
73
|
+
typeof AllocateCredentialRefreshResultValidator
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
// --- Publication ------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
export const CredentialRefreshSigningModeValidator = z.enum(['issuer-signed', 'signing-authority']);
|
|
79
|
+
export type CredentialRefreshSigningMode = z.infer<typeof CredentialRefreshSigningModeValidator>;
|
|
80
|
+
|
|
81
|
+
const PublishCredentialRefreshBaseFields = {
|
|
82
|
+
refreshId: z.string().min(1),
|
|
83
|
+
notifyHolder: z.boolean().optional(),
|
|
84
|
+
updateSummary: z.string().optional(),
|
|
85
|
+
idempotencyKey: z.string().optional(),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** Issuer-signed mode: the caller supplies a fully signed updated VC */
|
|
89
|
+
export const PublishIssuerSignedRefreshValidator = z.object({
|
|
90
|
+
...PublishCredentialRefreshBaseFields,
|
|
91
|
+
mode: z.literal('issuer-signed'),
|
|
92
|
+
signedCredential: VCValidator,
|
|
93
|
+
});
|
|
94
|
+
export type PublishIssuerSignedRefresh = z.infer<typeof PublishIssuerSignedRefreshValidator>;
|
|
95
|
+
|
|
96
|
+
/** Signing-authority mode: the caller supplies updated unsigned claims and brain-service signs */
|
|
97
|
+
export const PublishSigningAuthorityRefreshValidator = z.object({
|
|
98
|
+
...PublishCredentialRefreshBaseFields,
|
|
99
|
+
mode: z.literal('signing-authority'),
|
|
100
|
+
credential: UnsignedVCValidator,
|
|
101
|
+
signingAuthority: z
|
|
102
|
+
.object({
|
|
103
|
+
type: z.string().min(1),
|
|
104
|
+
})
|
|
105
|
+
.catchall(z.any()),
|
|
106
|
+
});
|
|
107
|
+
export type PublishSigningAuthorityRefresh = z.infer<
|
|
108
|
+
typeof PublishSigningAuthorityRefreshValidator
|
|
109
|
+
>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Top-level object form required by trpc-to-openapi.
|
|
113
|
+
*
|
|
114
|
+
* Keep the public TypeScript type discriminated even though the runtime object has
|
|
115
|
+
* optional fields for both modes. The refinement preserves the same required-field
|
|
116
|
+
* behavior as the former z.discriminatedUnion without crashing OpenAPI generation.
|
|
117
|
+
*/
|
|
118
|
+
export const PublishCredentialRefreshInputValidator = z
|
|
119
|
+
.object({
|
|
120
|
+
...PublishCredentialRefreshBaseFields,
|
|
121
|
+
mode: CredentialRefreshSigningModeValidator,
|
|
122
|
+
signedCredential: VCValidator.optional(),
|
|
123
|
+
credential: UnsignedVCValidator.optional(),
|
|
124
|
+
signingAuthority: z
|
|
125
|
+
.object({
|
|
126
|
+
type: z.string().min(1),
|
|
127
|
+
})
|
|
128
|
+
.catchall(z.any())
|
|
129
|
+
.optional(),
|
|
130
|
+
})
|
|
131
|
+
.superRefine((input, ctx) => {
|
|
132
|
+
if (input.mode === 'issuer-signed' && !input.signedCredential) {
|
|
133
|
+
ctx.addIssue({
|
|
134
|
+
code: 'custom',
|
|
135
|
+
path: ['signedCredential'],
|
|
136
|
+
message: 'signedCredential is required for issuer-signed publication',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (
|
|
141
|
+
input.mode === 'issuer-signed' &&
|
|
142
|
+
(input.credential !== undefined || input.signingAuthority !== undefined)
|
|
143
|
+
) {
|
|
144
|
+
ctx.addIssue({
|
|
145
|
+
code: 'custom',
|
|
146
|
+
path: ['mode'],
|
|
147
|
+
message: 'issuer-signed publication cannot include signing-authority fields',
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (input.mode === 'signing-authority') {
|
|
152
|
+
if (input.signedCredential !== undefined) {
|
|
153
|
+
ctx.addIssue({
|
|
154
|
+
code: 'custom',
|
|
155
|
+
path: ['signedCredential'],
|
|
156
|
+
message: 'signing-authority publication cannot include signedCredential',
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!input.credential) {
|
|
161
|
+
ctx.addIssue({
|
|
162
|
+
code: 'custom',
|
|
163
|
+
path: ['credential'],
|
|
164
|
+
message: 'credential is required for signing-authority publication',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!input.signingAuthority) {
|
|
169
|
+
ctx.addIssue({
|
|
170
|
+
code: 'custom',
|
|
171
|
+
path: ['signingAuthority'],
|
|
172
|
+
message: 'signingAuthority is required for signing-authority publication',
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
export type PublishCredentialRefreshInput =
|
|
178
|
+
PublishIssuerSignedRefresh | PublishSigningAuthorityRefresh;
|
|
179
|
+
|
|
180
|
+
export const PublishCredentialRefreshNotificationValidator = z.enum([
|
|
181
|
+
'queued',
|
|
182
|
+
'suppressed',
|
|
183
|
+
'not-applicable',
|
|
184
|
+
/** Publication succeeded, but the post-commit notification enqueue must be retried. */
|
|
185
|
+
'delivery-failed',
|
|
186
|
+
]);
|
|
187
|
+
export type PublishCredentialRefreshNotification = z.infer<
|
|
188
|
+
typeof PublishCredentialRefreshNotificationValidator
|
|
189
|
+
>;
|
|
190
|
+
|
|
191
|
+
export const PublishCredentialRefreshResultValidator = z.object({
|
|
192
|
+
refreshId: z.string().min(1),
|
|
193
|
+
version: z.number().int().positive(),
|
|
194
|
+
publishedAt: z.string().min(1),
|
|
195
|
+
notification: PublishCredentialRefreshNotificationValidator,
|
|
196
|
+
});
|
|
197
|
+
export type PublishCredentialRefreshResult = z.infer<
|
|
198
|
+
typeof PublishCredentialRefreshResultValidator
|
|
199
|
+
>;
|
|
200
|
+
|
|
201
|
+
// --- Version history (metadata only, never credential bodies) ----------------
|
|
202
|
+
|
|
203
|
+
export const CredentialRefreshVersionMetadataValidator = z.object({
|
|
204
|
+
version: z.number().int().positive(),
|
|
205
|
+
publishedAt: z.string().min(1),
|
|
206
|
+
effectiveAt: z.string().optional(),
|
|
207
|
+
etag: z.string().optional(),
|
|
208
|
+
signingMode: CredentialRefreshSigningModeValidator.optional(),
|
|
209
|
+
updateSummary: z.string().optional(),
|
|
210
|
+
});
|
|
211
|
+
export type CredentialRefreshVersionMetadata = z.infer<
|
|
212
|
+
typeof CredentialRefreshVersionMetadataValidator
|
|
213
|
+
>;
|
|
214
|
+
|
|
215
|
+
export const GetCredentialRefreshHistoryInputValidator = z.object({
|
|
216
|
+
refreshId: z.string().min(1),
|
|
217
|
+
cursor: z.string().optional(),
|
|
218
|
+
limit: z.number().int().positive().optional(),
|
|
219
|
+
});
|
|
220
|
+
export type GetCredentialRefreshHistoryInput = z.infer<
|
|
221
|
+
typeof GetCredentialRefreshHistoryInputValidator
|
|
222
|
+
>;
|
|
223
|
+
|
|
224
|
+
export const GetCredentialRefreshHistoryResultValidator = z.object({
|
|
225
|
+
records: CredentialRefreshVersionMetadataValidator.array(),
|
|
226
|
+
hasMore: z.boolean(),
|
|
227
|
+
cursor: z.string().optional(),
|
|
228
|
+
});
|
|
229
|
+
export type GetCredentialRefreshHistoryResult = z.infer<
|
|
230
|
+
typeof GetCredentialRefreshHistoryResultValidator
|
|
231
|
+
>;
|
|
232
|
+
|
|
233
|
+
// --- Holder authentication challenge ------------------------------------------
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Short-lived, single-use challenge returned by a managed refresh endpoint. Contains
|
|
237
|
+
* no holder, issuer, credential, or lifecycle information.
|
|
238
|
+
*/
|
|
239
|
+
export const CredentialRefreshChallengeValidator = z.object({
|
|
240
|
+
challenge: z.string().min(1),
|
|
241
|
+
expiresAt: z.string().min(1),
|
|
242
|
+
domain: z.string().optional(),
|
|
243
|
+
scheme: z.literal('LearnCardDIDAuth').optional(),
|
|
244
|
+
});
|
|
245
|
+
export type CredentialRefreshChallenge = z.infer<typeof CredentialRefreshChallengeValidator>;
|
|
246
|
+
|
|
247
|
+
// --- Response envelopes --------------------------------------------------------
|
|
248
|
+
|
|
249
|
+
/** Plain (interoperable) response: an unencrypted signed VC */
|
|
250
|
+
export const PublicCredentialRefreshEnvelopeValidator = z.object({
|
|
251
|
+
format: z.literal('vc'),
|
|
252
|
+
credential: VCValidator,
|
|
253
|
+
etag: z.string().optional(),
|
|
254
|
+
});
|
|
255
|
+
export type PublicCredentialRefreshEnvelope = z.infer<
|
|
256
|
+
typeof PublicCredentialRefreshEnvelopeValidator
|
|
257
|
+
>;
|
|
258
|
+
|
|
259
|
+
/** Managed response: the credential encrypted to the holder as a JWE */
|
|
260
|
+
export const JweCredentialRefreshEnvelopeValidator = z.object({
|
|
261
|
+
format: z.literal('jwe'),
|
|
262
|
+
jwe: JWEValidator,
|
|
263
|
+
etag: z.string().optional(),
|
|
264
|
+
/** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
|
|
265
|
+
version: z.number().int().positive().optional(),
|
|
266
|
+
});
|
|
267
|
+
export type JweCredentialRefreshEnvelope = z.infer<typeof JweCredentialRefreshEnvelopeValidator>;
|
|
268
|
+
|
|
269
|
+
export const CredentialRefreshResponseEnvelopeValidator = z.discriminatedUnion('format', [
|
|
270
|
+
PublicCredentialRefreshEnvelopeValidator,
|
|
271
|
+
JweCredentialRefreshEnvelopeValidator,
|
|
272
|
+
]);
|
|
273
|
+
export type CredentialRefreshResponseEnvelope = z.infer<
|
|
274
|
+
typeof CredentialRefreshResponseEnvelopeValidator
|
|
275
|
+
>;
|
|
276
|
+
|
|
277
|
+
// --- Refresh outcomes ----------------------------------------------------------
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Safe, machine-readable failure codes. Raw response bodies are never surfaced.
|
|
281
|
+
*/
|
|
282
|
+
export const CredentialRefreshFailureCodeValidator = z.enum([
|
|
283
|
+
'UNAVAILABLE',
|
|
284
|
+
'TIMEOUT',
|
|
285
|
+
'UNSUPPORTED_SERVICE',
|
|
286
|
+
'UNAUTHORIZED',
|
|
287
|
+
'MALFORMED_RESPONSE',
|
|
288
|
+
'INVALID_PROOF',
|
|
289
|
+
'ISSUER_MISMATCH',
|
|
290
|
+
'ID_MISMATCH',
|
|
291
|
+
'ROLLBACK',
|
|
292
|
+
'REVOKED',
|
|
293
|
+
'UNSAFE_ENDPOINT',
|
|
294
|
+
]);
|
|
295
|
+
export type CredentialRefreshFailureCode = z.infer<typeof CredentialRefreshFailureCodeValidator>;
|
|
296
|
+
|
|
297
|
+
export const CredentialRefreshUpdatedResultValidator = z.object({
|
|
298
|
+
status: z.literal('updated'),
|
|
299
|
+
credential: VCValidator,
|
|
300
|
+
etag: z.string().optional(),
|
|
301
|
+
managedVersion: z.number().int().positive().optional(),
|
|
302
|
+
});
|
|
303
|
+
export type CredentialRefreshUpdatedResult = z.infer<
|
|
304
|
+
typeof CredentialRefreshUpdatedResultValidator
|
|
305
|
+
>;
|
|
306
|
+
|
|
307
|
+
export const CredentialRefreshUnchangedResultValidator = z.object({
|
|
308
|
+
status: z.literal('unchanged'),
|
|
309
|
+
checkedAt: z.string().min(1),
|
|
310
|
+
etag: z.string().optional(),
|
|
311
|
+
});
|
|
312
|
+
export type CredentialRefreshUnchangedResult = z.infer<
|
|
313
|
+
typeof CredentialRefreshUnchangedResultValidator
|
|
314
|
+
>;
|
|
315
|
+
|
|
316
|
+
export const CredentialRefreshUnsupportedResultValidator = z.object({
|
|
317
|
+
status: z.literal('unsupported'),
|
|
318
|
+
});
|
|
319
|
+
export type CredentialRefreshUnsupportedResult = z.infer<
|
|
320
|
+
typeof CredentialRefreshUnsupportedResultValidator
|
|
321
|
+
>;
|
|
322
|
+
|
|
323
|
+
export const CredentialRefreshFailedResultValidator = z.object({
|
|
324
|
+
status: z.literal('failed'),
|
|
325
|
+
code: CredentialRefreshFailureCodeValidator,
|
|
326
|
+
retryable: z.boolean(),
|
|
327
|
+
});
|
|
328
|
+
export type CredentialRefreshFailedResult = z.infer<typeof CredentialRefreshFailedResultValidator>;
|
|
329
|
+
|
|
330
|
+
export const CredentialRefreshResultValidator = z.discriminatedUnion('status', [
|
|
331
|
+
CredentialRefreshUpdatedResultValidator,
|
|
332
|
+
CredentialRefreshUnchangedResultValidator,
|
|
333
|
+
CredentialRefreshUnsupportedResultValidator,
|
|
334
|
+
CredentialRefreshFailedResultValidator,
|
|
335
|
+
]);
|
|
336
|
+
export type CredentialRefreshResult = z.infer<typeof CredentialRefreshResultValidator>;
|
package/src/index.ts
CHANGED
package/src/lcn.ts
CHANGED
|
@@ -512,6 +512,15 @@ export const SendOptionsValidator = z.object({
|
|
|
512
512
|
.email()
|
|
513
513
|
.optional()
|
|
514
514
|
.describe('Guardian email that must approve before student can claim'),
|
|
515
|
+
expiresInDays: z
|
|
516
|
+
.number()
|
|
517
|
+
.int()
|
|
518
|
+
.min(1)
|
|
519
|
+
.max(720)
|
|
520
|
+
.optional()
|
|
521
|
+
.describe(
|
|
522
|
+
'How many days the credential stays claimable in the Universal Inbox (default 30). Does not change the credential validity period.'
|
|
523
|
+
),
|
|
515
524
|
});
|
|
516
525
|
export type SendOptions = z.infer<typeof SendOptionsValidator>;
|
|
517
526
|
|
|
@@ -698,21 +707,6 @@ export const PaginatedConsentFlowDataValidator = PaginationResponseValidator.ext
|
|
|
698
707
|
});
|
|
699
708
|
export type PaginatedConsentFlowData = z.infer<typeof PaginatedConsentFlowDataValidator>;
|
|
700
709
|
|
|
701
|
-
export const ConsentFlowContractDataForDidValidator = z.object({
|
|
702
|
-
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
|
703
|
-
personal: z.record(z.string(), z.string()).default({}),
|
|
704
|
-
date: z.string(),
|
|
705
|
-
contractUri: z.string(),
|
|
706
|
-
});
|
|
707
|
-
export type ConsentFlowContractDataForDid = z.infer<typeof ConsentFlowContractDataForDidValidator>;
|
|
708
|
-
|
|
709
|
-
export const PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
710
|
-
records: ConsentFlowContractDataForDidValidator.array(),
|
|
711
|
-
});
|
|
712
|
-
export type PaginatedConsentFlowDataForDid = z.infer<
|
|
713
|
-
typeof PaginatedConsentFlowDataForDidValidator
|
|
714
|
-
>;
|
|
715
|
-
|
|
716
710
|
export const ConsentFlowTermValidator = z.object({
|
|
717
711
|
sharing: z.boolean().optional(),
|
|
718
712
|
shared: z.string().array().optional(),
|
|
@@ -762,6 +756,42 @@ export const PaginatedConsentFlowTermsValidator = PaginationResponseValidator.ex
|
|
|
762
756
|
});
|
|
763
757
|
export type PaginatedConsentFlowTerms = z.infer<typeof PaginatedConsentFlowTermsValidator>;
|
|
764
758
|
|
|
759
|
+
export const ConsentFlowGuardianApprovalValidator = z.object({
|
|
760
|
+
guardianProfileId: z.string(),
|
|
761
|
+
guardianDid: z.string(),
|
|
762
|
+
approvedAt: z.string().datetime(),
|
|
763
|
+
contractUpdatedAt: z.string(),
|
|
764
|
+
});
|
|
765
|
+
export type ConsentFlowGuardianApproval = z.infer<typeof ConsentFlowGuardianApprovalValidator>;
|
|
766
|
+
|
|
767
|
+
export const ConsentFlowContractDataForDidValidator = z.object({
|
|
768
|
+
credentials: z.object({ category: z.string(), uri: z.string() }).array(),
|
|
769
|
+
personal: z.record(z.string(), z.string()).default({}),
|
|
770
|
+
date: z.string(),
|
|
771
|
+
createdAt: z.string().optional(),
|
|
772
|
+
contractUpdatedAt: z.string(),
|
|
773
|
+
contractExpiresAt: z.string().optional(),
|
|
774
|
+
reasonForAccessing: z.string().optional(),
|
|
775
|
+
guardian: z.object({
|
|
776
|
+
required: z.boolean(),
|
|
777
|
+
approved: z.boolean(),
|
|
778
|
+
approval: ConsentFlowGuardianApprovalValidator.optional(),
|
|
779
|
+
}),
|
|
780
|
+
contractUri: z.string(),
|
|
781
|
+
termsUri: z.string(),
|
|
782
|
+
status: ConsentFlowTermsStatusValidator,
|
|
783
|
+
expiresAt: z.string().optional(),
|
|
784
|
+
terms: ConsentFlowTermsValidator,
|
|
785
|
+
});
|
|
786
|
+
export type ConsentFlowContractDataForDid = z.infer<typeof ConsentFlowContractDataForDidValidator>;
|
|
787
|
+
|
|
788
|
+
export const PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
|
|
789
|
+
records: ConsentFlowContractDataForDidValidator.array(),
|
|
790
|
+
});
|
|
791
|
+
export type PaginatedConsentFlowDataForDid = z.infer<
|
|
792
|
+
typeof PaginatedConsentFlowDataForDidValidator
|
|
793
|
+
>;
|
|
794
|
+
|
|
765
795
|
export const ConsentFlowContractQueryValidator = z.object({
|
|
766
796
|
read: z
|
|
767
797
|
.object({
|
|
@@ -875,6 +905,7 @@ export const ConsentFlowTransactionValidator = z.object({
|
|
|
875
905
|
expiresAt: z.string().optional(),
|
|
876
906
|
oneTime: z.boolean().optional(),
|
|
877
907
|
terms: ConsentFlowTermsValidator.optional(),
|
|
908
|
+
guardianApproval: ConsentFlowGuardianApprovalValidator.optional(),
|
|
878
909
|
id: z.string(),
|
|
879
910
|
action: ConsentFlowTransactionActionValidator,
|
|
880
911
|
date: z.string(),
|
|
@@ -972,6 +1003,7 @@ export const LCNNotificationTypeEnumValidator = z.enum([
|
|
|
972
1003
|
'CREDENTIAL_REVOKED',
|
|
973
1004
|
'CREDENTIAL_SUSPENDED',
|
|
974
1005
|
'CREDENTIAL_UNSUSPENDED',
|
|
1006
|
+
'CREDENTIAL_REFRESHED',
|
|
975
1007
|
]);
|
|
976
1008
|
|
|
977
1009
|
export type LCNNotificationTypeEnum = z.infer<typeof LCNNotificationTypeEnumValidator>;
|
|
@@ -1186,12 +1218,16 @@ export type CreateContactMethodSessionResponseType = z.infer<
|
|
|
1186
1218
|
// Inbox Credentials
|
|
1187
1219
|
export const InboxCredentialValidator = z.object({
|
|
1188
1220
|
id: z.string(),
|
|
1189
|
-
credential: z.string(),
|
|
1221
|
+
credential: z.string().optional(),
|
|
1190
1222
|
isSigned: z.boolean(),
|
|
1191
1223
|
currentStatus: LCNInboxStatusEnumValidator,
|
|
1192
1224
|
isAccepted: z.boolean().optional(),
|
|
1193
1225
|
expiresAt: z.string(),
|
|
1194
1226
|
createdAt: z.string(),
|
|
1227
|
+
finalizedAt: z.string().optional(),
|
|
1228
|
+
expiredAt: z.string().optional(),
|
|
1229
|
+
credentialName: z.string().optional(),
|
|
1230
|
+
achievementType: z.string().optional(),
|
|
1195
1231
|
issuerDid: z.string(),
|
|
1196
1232
|
webhookUrl: z.string().optional(),
|
|
1197
1233
|
boostUri: z.string().optional(),
|
|
@@ -1278,10 +1314,13 @@ export const IssueInboxCredentialValidator = z
|
|
|
1278
1314
|
.describe('The webhook URL to receive credential issuance events.'),
|
|
1279
1315
|
expiresInDays: z
|
|
1280
1316
|
.number()
|
|
1317
|
+
.int()
|
|
1281
1318
|
.min(1)
|
|
1282
|
-
.max(
|
|
1319
|
+
.max(720)
|
|
1283
1320
|
.optional()
|
|
1284
|
-
.describe(
|
|
1321
|
+
.describe(
|
|
1322
|
+
'How many days the encrypted inbox payload remains claimable. This does not change the credential validity period.'
|
|
1323
|
+
),
|
|
1285
1324
|
templateData: z
|
|
1286
1325
|
.record(z.string(), z.unknown())
|
|
1287
1326
|
.optional()
|
|
@@ -1401,6 +1440,15 @@ export const ClaimInboxCredentialValidator = z.object({
|
|
|
1401
1440
|
configuration: z
|
|
1402
1441
|
.object({
|
|
1403
1442
|
publishableKey: z.string(),
|
|
1443
|
+
expiresInDays: z
|
|
1444
|
+
.number()
|
|
1445
|
+
.int()
|
|
1446
|
+
.min(1)
|
|
1447
|
+
.max(720)
|
|
1448
|
+
.optional()
|
|
1449
|
+
.describe(
|
|
1450
|
+
'Inbox claim window in days. Defaults to 720; use a shorter window for sensitive records.'
|
|
1451
|
+
),
|
|
1404
1452
|
signingAuthorityName: z.string().optional(),
|
|
1405
1453
|
listingId: z.string().optional(),
|
|
1406
1454
|
listingSlug: z.string().optional(),
|
package/src/vc.test.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { ProofValidator } from './vc';
|
|
3
|
+
|
|
4
|
+
test('only final ecdsa-rdfc-2019 DataIntegrityProofs may omit created', () => {
|
|
5
|
+
const proof = {
|
|
6
|
+
type: 'DataIntegrityProof',
|
|
7
|
+
cryptosuite: 'ecdsa-rdfc-2019',
|
|
8
|
+
proofPurpose: 'authentication',
|
|
9
|
+
verificationMethod: 'did:example:holder#key',
|
|
10
|
+
proofValue: 'zSignature',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
expect(ProofValidator.parse(proof)).toEqual(proof);
|
|
14
|
+
const legacy = { ...proof, cryptosuite: 'eddsa-rdfc-2022' };
|
|
15
|
+
expect(ProofValidator.safeParse(legacy).success).toBe(false);
|
|
16
|
+
expect(ProofValidator.safeParse({ ...legacy, created: '2026-01-01T00:00:00Z' }).success).toBe(
|
|
17
|
+
true
|
|
18
|
+
);
|
|
19
|
+
expect(ProofValidator.safeParse({ ...proof, type: 'Ed25519Signature2018' }).success).toBe(
|
|
20
|
+
false
|
|
21
|
+
);
|
|
22
|
+
expect(ProofValidator.safeParse({ ...proof, created: null }).success).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('malformed final-suite proofs identify missing required fields rather than created', () => {
|
|
26
|
+
const result = ProofValidator.safeParse({
|
|
27
|
+
type: 'DataIntegrityProof',
|
|
28
|
+
cryptosuite: 'ecdsa-rdfc-2019',
|
|
29
|
+
proofPurpose: 'authentication',
|
|
30
|
+
proofValue: 'zSignature',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
expect(result.success).toBe(false);
|
|
34
|
+
expect(result.error?.issues.map(issue => issue.path)).toEqual([['verificationMethod']]);
|
|
35
|
+
});
|