@learncard/helpers 1.3.2 → 1.3.3

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.
@@ -0,0 +1,901 @@
1
+ // Generated by dts-bundle-generator v6.13.0
2
+
3
+ import { DataTransformer } from '@trpc/server';
4
+ import { Draft } from 'immer';
5
+ import { Dispatch, SetStateAction } from 'react';
6
+ import { DraftFunction, Updater } from 'use-immer';
7
+
8
+ declare const UnsignedVCValidator: z.ZodObject<{
9
+ "@context": z.ZodArray<z.ZodUnion<[
10
+ z.ZodString,
11
+ z.ZodRecord<z.ZodString, z.ZodAny>
12
+ ]>>;
13
+ id: z.ZodOptional<z.ZodString>;
14
+ type: z.ZodArray<z.ZodString>;
15
+ issuer: z.ZodUnion<[
16
+ z.ZodString,
17
+ z.ZodObject<{
18
+ id: z.ZodOptional<z.ZodString>;
19
+ type: z.ZodUnion<[
20
+ z.ZodString,
21
+ z.ZodOptional<z.ZodArray<z.ZodString>>
22
+ ]>;
23
+ name: z.ZodOptional<z.ZodString>;
24
+ url: z.ZodOptional<z.ZodString>;
25
+ phone: z.ZodOptional<z.ZodString>;
26
+ description: z.ZodOptional<z.ZodString>;
27
+ endorsement: z.ZodOptional<z.ZodArray<z.ZodAny>>;
28
+ image: z.ZodOptional<z.ZodUnion<[
29
+ z.ZodString,
30
+ z.ZodObject<{
31
+ id: z.ZodString;
32
+ type: z.ZodString;
33
+ caption: z.ZodOptional<z.ZodString>;
34
+ }, z.core.$strip>
35
+ ]>>;
36
+ email: z.ZodOptional<z.ZodString>;
37
+ address: z.ZodOptional<z.ZodObject<{
38
+ type: z.ZodUnion<[
39
+ z.ZodString,
40
+ z.ZodArray<z.ZodString>
41
+ ]>;
42
+ addressCountry: z.ZodOptional<z.ZodString>;
43
+ addressCountryCode: z.ZodOptional<z.ZodString>;
44
+ addressRegion: z.ZodOptional<z.ZodString>;
45
+ addressLocality: z.ZodOptional<z.ZodString>;
46
+ streetAddress: z.ZodOptional<z.ZodString>;
47
+ postOfficeBoxNumber: z.ZodOptional<z.ZodString>;
48
+ postalCode: z.ZodOptional<z.ZodString>;
49
+ geo: z.ZodOptional<z.ZodObject<{
50
+ type: z.ZodUnion<[
51
+ z.ZodString,
52
+ z.ZodArray<z.ZodString>
53
+ ]>;
54
+ latitude: z.ZodNumber;
55
+ longitude: z.ZodNumber;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>>;
58
+ otherIdentifier: z.ZodOptional<z.ZodArray<z.ZodObject<{
59
+ type: z.ZodUnion<[
60
+ z.ZodString,
61
+ z.ZodArray<z.ZodString>
62
+ ]>;
63
+ identifier: z.ZodString;
64
+ identifierType: z.ZodUnion<[
65
+ z.ZodEnum<{
66
+ sourcedId: "sourcedId";
67
+ systemId: "systemId";
68
+ productId: "productId";
69
+ userName: "userName";
70
+ accountId: "accountId";
71
+ emailAddress: "emailAddress";
72
+ nationalIdentityNumber: "nationalIdentityNumber";
73
+ isbn: "isbn";
74
+ issn: "issn";
75
+ lisSourcedId: "lisSourcedId";
76
+ oneRosterSourcedId: "oneRosterSourcedId";
77
+ sisSourcedId: "sisSourcedId";
78
+ ltiContextId: "ltiContextId";
79
+ ltiDeploymentId: "ltiDeploymentId";
80
+ ltiToolId: "ltiToolId";
81
+ ltiPlatformId: "ltiPlatformId";
82
+ ltiUserId: "ltiUserId";
83
+ identifier: "identifier";
84
+ }>,
85
+ z.ZodString
86
+ ]>;
87
+ }, z.core.$strip>>>;
88
+ official: z.ZodOptional<z.ZodString>;
89
+ parentOrg: z.ZodOptional<z.ZodAny>;
90
+ familyName: z.ZodOptional<z.ZodString>;
91
+ givenName: z.ZodOptional<z.ZodString>;
92
+ additionalName: z.ZodOptional<z.ZodString>;
93
+ patronymicName: z.ZodOptional<z.ZodString>;
94
+ honorificPrefix: z.ZodOptional<z.ZodString>;
95
+ honorificSuffix: z.ZodOptional<z.ZodString>;
96
+ familyNamePrefix: z.ZodOptional<z.ZodString>;
97
+ dateOfBirth: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$catchall<z.ZodAny>>
99
+ ]>;
100
+ credentialSubject: z.ZodUnion<[
101
+ z.ZodObject<{
102
+ id: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$catchall<z.ZodAny>>,
104
+ z.ZodArray<z.ZodObject<{
105
+ id: z.ZodOptional<z.ZodString>;
106
+ }, z.core.$catchall<z.ZodAny>>>
107
+ ]>;
108
+ refreshService: z.ZodOptional<z.ZodUnion<[
109
+ z.ZodObject<{
110
+ id: z.ZodOptional<z.ZodString>;
111
+ type: z.ZodString;
112
+ }, z.core.$catchall<z.ZodAny>>,
113
+ z.ZodArray<z.ZodObject<{
114
+ id: z.ZodOptional<z.ZodString>;
115
+ type: z.ZodString;
116
+ }, z.core.$catchall<z.ZodAny>>>
117
+ ]>>;
118
+ credentialSchema: z.ZodOptional<z.ZodUnion<[
119
+ z.ZodObject<{
120
+ id: z.ZodString;
121
+ type: z.ZodString;
122
+ }, z.core.$catchall<z.ZodAny>>,
123
+ z.ZodArray<z.ZodObject<{
124
+ id: z.ZodString;
125
+ type: z.ZodString;
126
+ }, z.core.$catchall<z.ZodAny>>>
127
+ ]>>;
128
+ issuanceDate: z.ZodOptional<z.ZodString>;
129
+ expirationDate: z.ZodOptional<z.ZodString>;
130
+ credentialStatus: z.ZodOptional<z.ZodUnion<[
131
+ z.ZodObject<{
132
+ type: z.ZodString;
133
+ id: z.ZodString;
134
+ }, z.core.$catchall<z.ZodAny>>,
135
+ z.ZodArray<z.ZodObject<{
136
+ type: z.ZodString;
137
+ id: z.ZodString;
138
+ }, z.core.$catchall<z.ZodAny>>>
139
+ ]>>;
140
+ name: z.ZodOptional<z.ZodString>;
141
+ description: z.ZodOptional<z.ZodString>;
142
+ validFrom: z.ZodOptional<z.ZodString>;
143
+ validUntil: z.ZodOptional<z.ZodString>;
144
+ status: z.ZodOptional<z.ZodUnion<[
145
+ z.ZodObject<{
146
+ type: z.ZodString;
147
+ id: z.ZodString;
148
+ }, z.core.$catchall<z.ZodAny>>,
149
+ z.ZodArray<z.ZodObject<{
150
+ type: z.ZodString;
151
+ id: z.ZodString;
152
+ }, z.core.$catchall<z.ZodAny>>>
153
+ ]>>;
154
+ termsOfUse: z.ZodOptional<z.ZodUnion<[
155
+ z.ZodObject<{
156
+ type: z.ZodString;
157
+ id: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$catchall<z.ZodAny>>,
159
+ z.ZodArray<z.ZodObject<{
160
+ type: z.ZodString;
161
+ id: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$catchall<z.ZodAny>>>
163
+ ]>>;
164
+ evidence: z.ZodOptional<z.ZodUnion<readonly [
165
+ z.ZodObject<{
166
+ id: z.ZodOptional<z.ZodString>;
167
+ type: z.ZodArray<z.ZodString>;
168
+ name: z.ZodOptional<z.ZodString>;
169
+ narrative: z.ZodOptional<z.ZodString>;
170
+ description: z.ZodOptional<z.ZodString>;
171
+ genre: z.ZodOptional<z.ZodString>;
172
+ audience: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$catchall<z.ZodAny>>,
174
+ z.ZodArray<z.ZodObject<{
175
+ id: z.ZodOptional<z.ZodString>;
176
+ type: z.ZodArray<z.ZodString>;
177
+ name: z.ZodOptional<z.ZodString>;
178
+ narrative: z.ZodOptional<z.ZodString>;
179
+ description: z.ZodOptional<z.ZodString>;
180
+ genre: z.ZodOptional<z.ZodString>;
181
+ audience: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$catchall<z.ZodAny>>>
183
+ ]>>;
184
+ renderMethod: z.ZodOptional<z.ZodUnion<readonly [
185
+ z.ZodUnion<readonly [
186
+ z.ZodObject<{
187
+ type: z.ZodLiteral<"TemplateRenderMethod">;
188
+ renderSuite: z.ZodString;
189
+ template: z.ZodString;
190
+ renderProperty: z.ZodOptional<z.ZodArray<z.ZodString>>;
191
+ outputPreference: z.ZodOptional<z.ZodObject<{
192
+ mediaType: z.ZodString;
193
+ }, z.core.$strip>>;
194
+ }, z.core.$strip>,
195
+ z.ZodRecord<z.ZodString, z.ZodAny>
196
+ ]>,
197
+ z.ZodArray<z.ZodUnion<readonly [
198
+ z.ZodObject<{
199
+ type: z.ZodLiteral<"TemplateRenderMethod">;
200
+ renderSuite: z.ZodString;
201
+ template: z.ZodString;
202
+ renderProperty: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
+ outputPreference: z.ZodOptional<z.ZodObject<{
204
+ mediaType: z.ZodString;
205
+ }, z.core.$strip>>;
206
+ }, z.core.$strip>,
207
+ z.ZodRecord<z.ZodString, z.ZodAny>
208
+ ]>>
209
+ ]>>;
210
+ }, z.core.$catchall<z.ZodAny>>;
211
+ export type UnsignedVC = z.infer<typeof UnsignedVCValidator>;
212
+ declare const VCValidator: z.ZodObject<{
213
+ "@context": z.ZodArray<z.ZodUnion<[
214
+ z.ZodString,
215
+ z.ZodRecord<z.ZodString, z.ZodAny>
216
+ ]>>;
217
+ id: z.ZodOptional<z.ZodString>;
218
+ type: z.ZodArray<z.ZodString>;
219
+ issuer: z.ZodUnion<[
220
+ z.ZodString,
221
+ z.ZodObject<{
222
+ id: z.ZodOptional<z.ZodString>;
223
+ type: z.ZodUnion<[
224
+ z.ZodString,
225
+ z.ZodOptional<z.ZodArray<z.ZodString>>
226
+ ]>;
227
+ name: z.ZodOptional<z.ZodString>;
228
+ url: z.ZodOptional<z.ZodString>;
229
+ phone: z.ZodOptional<z.ZodString>;
230
+ description: z.ZodOptional<z.ZodString>;
231
+ endorsement: z.ZodOptional<z.ZodArray<z.ZodAny>>;
232
+ image: z.ZodOptional<z.ZodUnion<[
233
+ z.ZodString,
234
+ z.ZodObject<{
235
+ id: z.ZodString;
236
+ type: z.ZodString;
237
+ caption: z.ZodOptional<z.ZodString>;
238
+ }, z.core.$strip>
239
+ ]>>;
240
+ email: z.ZodOptional<z.ZodString>;
241
+ address: z.ZodOptional<z.ZodObject<{
242
+ type: z.ZodUnion<[
243
+ z.ZodString,
244
+ z.ZodArray<z.ZodString>
245
+ ]>;
246
+ addressCountry: z.ZodOptional<z.ZodString>;
247
+ addressCountryCode: z.ZodOptional<z.ZodString>;
248
+ addressRegion: z.ZodOptional<z.ZodString>;
249
+ addressLocality: z.ZodOptional<z.ZodString>;
250
+ streetAddress: z.ZodOptional<z.ZodString>;
251
+ postOfficeBoxNumber: z.ZodOptional<z.ZodString>;
252
+ postalCode: z.ZodOptional<z.ZodString>;
253
+ geo: z.ZodOptional<z.ZodObject<{
254
+ type: z.ZodUnion<[
255
+ z.ZodString,
256
+ z.ZodArray<z.ZodString>
257
+ ]>;
258
+ latitude: z.ZodNumber;
259
+ longitude: z.ZodNumber;
260
+ }, z.core.$strip>>;
261
+ }, z.core.$strip>>;
262
+ otherIdentifier: z.ZodOptional<z.ZodArray<z.ZodObject<{
263
+ type: z.ZodUnion<[
264
+ z.ZodString,
265
+ z.ZodArray<z.ZodString>
266
+ ]>;
267
+ identifier: z.ZodString;
268
+ identifierType: z.ZodUnion<[
269
+ z.ZodEnum<{
270
+ sourcedId: "sourcedId";
271
+ systemId: "systemId";
272
+ productId: "productId";
273
+ userName: "userName";
274
+ accountId: "accountId";
275
+ emailAddress: "emailAddress";
276
+ nationalIdentityNumber: "nationalIdentityNumber";
277
+ isbn: "isbn";
278
+ issn: "issn";
279
+ lisSourcedId: "lisSourcedId";
280
+ oneRosterSourcedId: "oneRosterSourcedId";
281
+ sisSourcedId: "sisSourcedId";
282
+ ltiContextId: "ltiContextId";
283
+ ltiDeploymentId: "ltiDeploymentId";
284
+ ltiToolId: "ltiToolId";
285
+ ltiPlatformId: "ltiPlatformId";
286
+ ltiUserId: "ltiUserId";
287
+ identifier: "identifier";
288
+ }>,
289
+ z.ZodString
290
+ ]>;
291
+ }, z.core.$strip>>>;
292
+ official: z.ZodOptional<z.ZodString>;
293
+ parentOrg: z.ZodOptional<z.ZodAny>;
294
+ familyName: z.ZodOptional<z.ZodString>;
295
+ givenName: z.ZodOptional<z.ZodString>;
296
+ additionalName: z.ZodOptional<z.ZodString>;
297
+ patronymicName: z.ZodOptional<z.ZodString>;
298
+ honorificPrefix: z.ZodOptional<z.ZodString>;
299
+ honorificSuffix: z.ZodOptional<z.ZodString>;
300
+ familyNamePrefix: z.ZodOptional<z.ZodString>;
301
+ dateOfBirth: z.ZodOptional<z.ZodString>;
302
+ }, z.core.$catchall<z.ZodAny>>
303
+ ]>;
304
+ credentialSubject: z.ZodUnion<[
305
+ z.ZodObject<{
306
+ id: z.ZodOptional<z.ZodString>;
307
+ }, z.core.$catchall<z.ZodAny>>,
308
+ z.ZodArray<z.ZodObject<{
309
+ id: z.ZodOptional<z.ZodString>;
310
+ }, z.core.$catchall<z.ZodAny>>>
311
+ ]>;
312
+ refreshService: z.ZodOptional<z.ZodUnion<[
313
+ z.ZodObject<{
314
+ id: z.ZodOptional<z.ZodString>;
315
+ type: z.ZodString;
316
+ }, z.core.$catchall<z.ZodAny>>,
317
+ z.ZodArray<z.ZodObject<{
318
+ id: z.ZodOptional<z.ZodString>;
319
+ type: z.ZodString;
320
+ }, z.core.$catchall<z.ZodAny>>>
321
+ ]>>;
322
+ credentialSchema: z.ZodOptional<z.ZodUnion<[
323
+ z.ZodObject<{
324
+ id: z.ZodString;
325
+ type: z.ZodString;
326
+ }, z.core.$catchall<z.ZodAny>>,
327
+ z.ZodArray<z.ZodObject<{
328
+ id: z.ZodString;
329
+ type: z.ZodString;
330
+ }, z.core.$catchall<z.ZodAny>>>
331
+ ]>>;
332
+ issuanceDate: z.ZodOptional<z.ZodString>;
333
+ expirationDate: z.ZodOptional<z.ZodString>;
334
+ credentialStatus: z.ZodOptional<z.ZodUnion<[
335
+ z.ZodObject<{
336
+ type: z.ZodString;
337
+ id: z.ZodString;
338
+ }, z.core.$catchall<z.ZodAny>>,
339
+ z.ZodArray<z.ZodObject<{
340
+ type: z.ZodString;
341
+ id: z.ZodString;
342
+ }, z.core.$catchall<z.ZodAny>>>
343
+ ]>>;
344
+ name: z.ZodOptional<z.ZodString>;
345
+ description: z.ZodOptional<z.ZodString>;
346
+ validFrom: z.ZodOptional<z.ZodString>;
347
+ validUntil: z.ZodOptional<z.ZodString>;
348
+ status: z.ZodOptional<z.ZodUnion<[
349
+ z.ZodObject<{
350
+ type: z.ZodString;
351
+ id: z.ZodString;
352
+ }, z.core.$catchall<z.ZodAny>>,
353
+ z.ZodArray<z.ZodObject<{
354
+ type: z.ZodString;
355
+ id: z.ZodString;
356
+ }, z.core.$catchall<z.ZodAny>>>
357
+ ]>>;
358
+ termsOfUse: z.ZodOptional<z.ZodUnion<[
359
+ z.ZodObject<{
360
+ type: z.ZodString;
361
+ id: z.ZodOptional<z.ZodString>;
362
+ }, z.core.$catchall<z.ZodAny>>,
363
+ z.ZodArray<z.ZodObject<{
364
+ type: z.ZodString;
365
+ id: z.ZodOptional<z.ZodString>;
366
+ }, z.core.$catchall<z.ZodAny>>>
367
+ ]>>;
368
+ evidence: z.ZodOptional<z.ZodUnion<readonly [
369
+ z.ZodObject<{
370
+ id: z.ZodOptional<z.ZodString>;
371
+ type: z.ZodArray<z.ZodString>;
372
+ name: z.ZodOptional<z.ZodString>;
373
+ narrative: z.ZodOptional<z.ZodString>;
374
+ description: z.ZodOptional<z.ZodString>;
375
+ genre: z.ZodOptional<z.ZodString>;
376
+ audience: z.ZodOptional<z.ZodString>;
377
+ }, z.core.$catchall<z.ZodAny>>,
378
+ z.ZodArray<z.ZodObject<{
379
+ id: z.ZodOptional<z.ZodString>;
380
+ type: z.ZodArray<z.ZodString>;
381
+ name: z.ZodOptional<z.ZodString>;
382
+ narrative: z.ZodOptional<z.ZodString>;
383
+ description: z.ZodOptional<z.ZodString>;
384
+ genre: z.ZodOptional<z.ZodString>;
385
+ audience: z.ZodOptional<z.ZodString>;
386
+ }, z.core.$catchall<z.ZodAny>>>
387
+ ]>>;
388
+ renderMethod: z.ZodOptional<z.ZodUnion<readonly [
389
+ z.ZodUnion<readonly [
390
+ z.ZodObject<{
391
+ type: z.ZodLiteral<"TemplateRenderMethod">;
392
+ renderSuite: z.ZodString;
393
+ template: z.ZodString;
394
+ renderProperty: z.ZodOptional<z.ZodArray<z.ZodString>>;
395
+ outputPreference: z.ZodOptional<z.ZodObject<{
396
+ mediaType: z.ZodString;
397
+ }, z.core.$strip>>;
398
+ }, z.core.$strip>,
399
+ z.ZodRecord<z.ZodString, z.ZodAny>
400
+ ]>,
401
+ z.ZodArray<z.ZodUnion<readonly [
402
+ z.ZodObject<{
403
+ type: z.ZodLiteral<"TemplateRenderMethod">;
404
+ renderSuite: z.ZodString;
405
+ template: z.ZodString;
406
+ renderProperty: z.ZodOptional<z.ZodArray<z.ZodString>>;
407
+ outputPreference: z.ZodOptional<z.ZodObject<{
408
+ mediaType: z.ZodString;
409
+ }, z.core.$strip>>;
410
+ }, z.core.$strip>,
411
+ z.ZodRecord<z.ZodString, z.ZodAny>
412
+ ]>>
413
+ ]>>;
414
+ proof: z.ZodUnion<[
415
+ z.ZodObject<{
416
+ type: z.ZodString;
417
+ created: z.ZodString;
418
+ challenge: z.ZodOptional<z.ZodString>;
419
+ domain: z.ZodOptional<z.ZodString>;
420
+ nonce: z.ZodOptional<z.ZodString>;
421
+ proofPurpose: z.ZodString;
422
+ verificationMethod: z.ZodString;
423
+ jws: z.ZodOptional<z.ZodString>;
424
+ }, z.core.$catchall<z.ZodAny>>,
425
+ z.ZodArray<z.ZodObject<{
426
+ type: z.ZodString;
427
+ created: z.ZodString;
428
+ challenge: z.ZodOptional<z.ZodString>;
429
+ domain: z.ZodOptional<z.ZodString>;
430
+ nonce: z.ZodOptional<z.ZodString>;
431
+ proofPurpose: z.ZodString;
432
+ verificationMethod: z.ZodString;
433
+ jws: z.ZodOptional<z.ZodString>;
434
+ }, z.core.$catchall<z.ZodAny>>>
435
+ ]>;
436
+ }, z.core.$catchall<z.ZodAny>>;
437
+ export type VC = z.infer<typeof VCValidator>;
438
+ declare const CredentialFormatValidator: z.ZodEnum<{
439
+ "w3c-vc-2.0": "w3c-vc-2.0";
440
+ "w3c-vc-1.1": "w3c-vc-1.1";
441
+ "jwt-vc-json": "jwt-vc-json";
442
+ "dc+sd-jwt": "dc+sd-jwt";
443
+ "vc+sd-jwt": "vc+sd-jwt";
444
+ mso_mdoc: "mso_mdoc";
445
+ }>;
446
+ export type CredentialFormat = z.infer<typeof CredentialFormatValidator>;
447
+ /**
448
+ * Format-discriminated read view over a stored credential. Returned
449
+ * by `toStoredCredential(record)` in `@learncard/helpers`.
450
+ *
451
+ * The `data` field carries the correct wire-form representation for
452
+ * the credential's format:
453
+ * - W3C VCs: the JSON-LD VC object (also what `record.vc` holds)
454
+ * - JWT-VC: the compact JWS string (extracted from `record.vc.proof.jwt`
455
+ * if the record uses the legacy LDP-around-JWT envelope, otherwise
456
+ * the raw string from `record.rawWireForm`)
457
+ * - SD-JWT-VC: the compact `<JWT>~<disclosures>~` string
458
+ * - mDoc: base64url-encoded CBOR bytes (stored as a string for
459
+ * LearnCloud's JSON-only encrypted store; consumers base64-decode
460
+ * when they need raw bytes)
461
+ *
462
+ * Format-aware consumers pattern-match on `format` and use `data`.
463
+ * Legacy consumers continue to read `record.vc` directly — the
464
+ * projector is opt-in, never required.
465
+ */
466
+ export type StoredCredential = {
467
+ format: "w3c-vc-2.0";
468
+ data: VC;
469
+ } | {
470
+ format: "w3c-vc-1.1";
471
+ data: VC;
472
+ } | {
473
+ format: "jwt-vc-json";
474
+ data: string;
475
+ } | {
476
+ format: "dc+sd-jwt";
477
+ data: string;
478
+ } | {
479
+ format: "vc+sd-jwt";
480
+ data: string;
481
+ } | {
482
+ format: "mso_mdoc";
483
+ data: string;
484
+ };
485
+ export type CredentialRecord<Metadata extends Record<string, any> = Record<never, never>> = {
486
+ id: string;
487
+ uri: string;
488
+ /**
489
+ * Wire-format discriminator for the credential. Optional — when
490
+ * absent, legacy readers infer it from `vc` shape (see
491
+ * `toStoredCredential` in `@learncard/helpers`). Populated on new
492
+ * writes once the consumer is format-aware.
493
+ *
494
+ * Added in ADR-0001 Phase 1 as additive metadata; existing
495
+ * records without this field continue to work unchanged.
496
+ */
497
+ format?: CredentialFormat;
498
+ /**
499
+ * Optional semantic type hint for fast filtering without parsing
500
+ * the full credential — `vct` for SD-JWT-VC, last-non-VC type for
501
+ * W3C VCs, doctype for mDoc. Added in ADR-0001 Phase 1.
502
+ */
503
+ semanticType?: string;
504
+ /**
505
+ * On-the-wire representation for formats whose `vc` field cannot
506
+ * hold the canonical form (SD-JWT compact, JWT-VC compact, base64
507
+ * mDoc CBOR). Undefined for W3C VCs (`vc` IS the wire form). Added
508
+ * in ADR-0001 Phase 1.
509
+ */
510
+ rawWireForm?: string;
511
+ [key: string]: any;
512
+ } & Metadata;
513
+ declare const JWEValidator: z.ZodObject<{
514
+ protected: z.ZodString;
515
+ iv: z.ZodString;
516
+ ciphertext: z.ZodString;
517
+ tag: z.ZodString;
518
+ aad: z.ZodOptional<z.ZodString>;
519
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
520
+ header: z.ZodObject<{
521
+ alg: z.ZodString;
522
+ iv: z.ZodString;
523
+ tag: z.ZodString;
524
+ epk: z.ZodOptional<z.ZodObject<{
525
+ kty: z.ZodOptional<z.ZodString>;
526
+ crv: z.ZodOptional<z.ZodString>;
527
+ x: z.ZodOptional<z.ZodString>;
528
+ y: z.ZodOptional<z.ZodOptional<z.ZodString>>;
529
+ n: z.ZodOptional<z.ZodOptional<z.ZodString>>;
530
+ d: z.ZodOptional<z.ZodOptional<z.ZodString>>;
531
+ }, z.core.$strip>>;
532
+ kid: z.ZodOptional<z.ZodString>;
533
+ apv: z.ZodOptional<z.ZodString>;
534
+ apu: z.ZodOptional<z.ZodString>;
535
+ }, z.core.$strip>;
536
+ encrypted_key: z.ZodString;
537
+ }, z.core.$strip>>>;
538
+ }, z.core.$strip>;
539
+ export type JWE = z.infer<typeof JWEValidator>;
540
+ declare const BitstringStatusPurposeValidator: z.ZodEnum<{
541
+ revocation: "revocation";
542
+ suspension: "suspension";
543
+ }>;
544
+ export type BitstringStatusPurpose = z.infer<typeof BitstringStatusPurposeValidator>;
545
+ declare const BitstringStatusListEntryValidator: z.ZodObject<{
546
+ id: z.ZodOptional<z.ZodString>;
547
+ type: z.ZodLiteral<"BitstringStatusListEntry">;
548
+ statusPurpose: z.ZodEnum<{
549
+ revocation: "revocation";
550
+ suspension: "suspension";
551
+ }>;
552
+ statusListIndex: z.ZodString;
553
+ statusListCredential: z.ZodString;
554
+ }, z.core.$strip>;
555
+ export type BitstringStatusListEntry = z.infer<typeof BitstringStatusListEntryValidator>;
556
+ declare const Providers: {
557
+ filestack: typeof filestack;
558
+ unsplash: typeof unsplash;
559
+ discord: typeof discord;
560
+ };
561
+ export declare const getProvider: (url?: string) => keyof typeof Providers | null;
562
+ export declare const changeQuality: (url: string, quality: number) => string;
563
+ export declare const fixUrl: (url: string, mimetype?: string, webp?: boolean) => string;
564
+ export declare const generateSrcSet: (url: string, resolutions: number[], options?: {
565
+ mimetype?: string;
566
+ fix?: boolean;
567
+ webp?: boolean;
568
+ }) => string;
569
+ export declare const resizeAndChangeQuality: (url: string, size: number, quality: number, options?: {
570
+ mimetype?: string;
571
+ fix?: boolean;
572
+ webp?: boolean;
573
+ }) => string;
574
+ export declare const DEFAULT_RESOLUTIONS: number[];
575
+ /**
576
+ * Gets an array of URLs from a srcSet string
577
+ *
578
+ * @param srcSet HTML srcSet string (e.g. 'test.com/img 100w, test.com/img2 200w')
579
+ *
580
+ * @return URLs
581
+ */
582
+ export declare const getUrlsFromSrcSet: (srcSet: string) => [
583
+ string,
584
+ string
585
+ ][];
586
+ /** Quantizes a number to the closest number in an array of numbers */
587
+ export declare const quantizeValue: (value: number, array: number[]) => number;
588
+ export declare const isNotMaybe: <T>(value?: T | null | undefined) => value is T;
589
+ export declare const filterMaybes: <T>(array?: (T | null | undefined)[]) => T[];
590
+ export declare const capitalizeFirstLetter: (string: string) => string;
591
+ /**
592
+ * Formats a number into a friendlier string i.e. 1,234 becomes 1.2K
593
+ */
594
+ export declare const formatNumber: (num: number) => string;
595
+ export type SetState<T> = Dispatch<SetStateAction<T>>;
596
+ export type UpdaterArgs<T> = T | DraftFunction<T>;
597
+ export type CurriedReturn<ValueArg, Value> = undefined extends ValueArg ? (innerValue: Value) => void : void;
598
+ export type InnerImmerOuterImmer<State> = <Field extends keyof Draft<State>, Value extends UpdaterArgs<Draft<State>[Field]>, ValueArg extends Value | undefined>(field: Field, value?: ValueArg) => CurriedReturn<ValueArg, Value>;
599
+ export type InnerReactOuterImmer<State> = <Field extends keyof Draft<State>, Value extends SetStateAction<Draft<State>[Field]>, ValueArg extends Value | undefined>(field: Field, value?: ValueArg) => CurriedReturn<ValueArg, Value>;
600
+ export type InnerImmerOuterReact<State> = <Field extends keyof State, Value extends UpdaterArgs<State[Field]>, ValueArg extends Value | undefined>(field: Field, value?: ValueArg) => CurriedReturn<ValueArg, Value>;
601
+ export type InnerReactOuterReact<State> = <Field extends keyof State, Value extends SetStateAction<State[Field]>, ValueArg extends Value | undefined>(field: Field, value?: ValueArg) => CurriedReturn<ValueArg, Value>;
602
+ export declare function innerImmerOuterImmer<State, Field extends keyof Draft<State>, Value extends UpdaterArgs<Draft<State>[Field]>>(setState: Updater<State>, field: Field): (innerValue: NonNullable<Value>) => void;
603
+ export declare function innerImmerOuterImmer<State, Field extends keyof Draft<State>, Value extends UpdaterArgs<Draft<State>[Field]>, ValueArg extends Value | undefined>(setState: Updater<State>, field: Field, value: ValueArg): void;
604
+ /**
605
+ * Curry function to allow innerImmerOuterImmer to be used without constantly passing in setState
606
+ *
607
+ * Use like so:
608
+ *
609
+ * [state, setState] = useImmer<{ num: number; string: string; }>({ num: 1, string: 'str' });
610
+ *
611
+ * const updateField = curriedInnerImmerOuterImmer(setState);
612
+ *
613
+ * updateField('num', 3); // Updates state to { num: 3, string: 'str' }
614
+ *
615
+ * updateField(
616
+ * 'num',
617
+ * oldNum => {
618
+ * oldNum += 1;
619
+ * },
620
+ * ); // Updates state to { num: 4, string: 'str' }
621
+ *
622
+ * updateField(setState, 'num', 'three'); // TS Error due to invalid type
623
+ */
624
+ export declare const curriedInnerImmerOuterImmer: <State>(setState: Updater<State>) => InnerImmerOuterImmer<State>;
625
+ export declare function innerReactOuterImmer<State, Field extends keyof Draft<State>, Value extends SetStateAction<Draft<State>[Field]>>(setState: Updater<State>, field: Field): (innerValue: NonNullable<Value>) => void;
626
+ export declare function innerReactOuterImmer<State, Field extends keyof Draft<State>, Value extends SetStateAction<Draft<State>[Field]>, ValueArg extends Value | undefined>(setState: Updater<State>, field: Field, value: ValueArg): void;
627
+ /**
628
+ * Curry function to allow innerReactOuterImmer to be used without constantly passing in setState
629
+ *
630
+ * Use like so:
631
+ *
632
+ * [state, setState] = useImmer<{ num: number; string: string; }>({ num: 1, string: 'str' });
633
+ *
634
+ * const updateField = curriedUpdateImmerSetStateField(setState);
635
+ *
636
+ * updateField('num', 3); // Updates state to { num: 3, string: 'str' }
637
+ *
638
+ * updateField('num', oldNum => oldNum + 1); // Updates state to { num: 4, string: 'str' }
639
+ *
640
+ * updateField(setState, 'num', 'three'); // TS Error due to invalid type
641
+ */
642
+ export declare const curriedInnerReactOuterImmer: <State>(setState: Updater<State>) => InnerReactOuterImmer<State>;
643
+ export declare function innerImmerOuterReact<State, Field extends keyof State, Value extends UpdaterArgs<State[Field]>>(setState: SetState<State>, field: Field): (innerValue: NonNullable<Value>) => void;
644
+ export declare function innerImmerOuterReact<State, Field extends keyof State, Value extends UpdaterArgs<State[Field]>, ValueArg extends Value | undefined>(setState: SetState<State>, field: Field, value: ValueArg): void;
645
+ /**
646
+ * Curry function to allow innerImmerOuterReact to be used without constantly passing in setState
647
+ *
648
+ * Use like so:
649
+ *
650
+ * [state, setState] = useImmer<{ num: number; string: string; }>({ num: 1, string: 'str' });
651
+ *
652
+ * const updateField = curriedInnerImmerOuterImmer(setState);
653
+ *
654
+ * updateField('num', 3); // Updates state to { num: 3, string: 'str' }
655
+ *
656
+ * updateField(
657
+ * 'num',
658
+ * oldNum => {
659
+ * oldNum += 1;
660
+ * },
661
+ * ); // Updates state to { num: 4, string: 'str' }
662
+ *
663
+ * updateField(setState, 'num', 'three'); // TS Error due to invalid type
664
+ */
665
+ export declare const curriedInnerImmerOuterReact: <State>(setState: SetState<State>) => InnerImmerOuterReact<State>;
666
+ export declare function innerReactOuterReact<State, Field extends keyof State, Value extends SetStateAction<State[Field]>>(setState: SetState<State>, field: Field): (innerValue: NonNullable<Value>) => void;
667
+ export declare function innerReactOuterReact<State, Field extends keyof State, Value extends SetStateAction<State[Field]>, ValueArg extends Value | undefined>(setState: SetState<State>, field: Field, value: ValueArg): void;
668
+ /**
669
+ * Curry function to allow updateSetStateField to be used without constantly passing in setState
670
+ *
671
+ * If possible, please consider updating your useState calls to useImmer and using the immer
672
+ * versions of these functions
673
+ *
674
+ * Use like so:
675
+ *
676
+ * [state, setState] = useState<{ num: number; string: string; }>({ num: 1, string: 'str' });
677
+ *
678
+ * const updateField = curriedInnerReactOuterReact(setState);
679
+ *
680
+ * updateField('num', 3); // Updates state to { num: 3, string: 'str' }
681
+ *
682
+ * updateField('num', oldNum => oldNum + 1); // Updates state to { num: 4, string: 'str' }
683
+ *
684
+ * updateField(setState, 'num', 'three'); // TS Error due to invalid type
685
+ */
686
+ export declare const curriedInnerReactOuterReact: <State>(setState: SetState<State>) => InnerReactOuterReact<State>;
687
+ export declare function curriedStateSlice<State>(setState: Updater<State>): InnerImmerOuterImmer<State>;
688
+ export declare function curriedStateSlice<State>(setState: Updater<State>, options: {
689
+ inner: "immer";
690
+ outer: "immer";
691
+ }): InnerImmerOuterImmer<State>;
692
+ export declare function curriedStateSlice<State>(setState: Updater<State>, options: {
693
+ inner: "immer";
694
+ outer: "react";
695
+ }): InnerImmerOuterReact<State>;
696
+ export declare function curriedStateSlice<State>(setState: SetState<State>, options: {
697
+ inner: "react";
698
+ outer: "immer";
699
+ }): InnerReactOuterImmer<State>;
700
+ export declare function curriedStateSlice<State>(setState: SetState<State>, options: {
701
+ inner: "react";
702
+ outer: "react";
703
+ }): InnerReactOuterReact<State>;
704
+ export type UpdateSlice<State> = {
705
+ (index: number): Updater<State>;
706
+ (index: number, value: UpdaterArgs<State>): void;
707
+ };
708
+ export type CurriedArraySlice = {
709
+ <State>(setState: SetState<State[]>): UpdateSlice<State>;
710
+ <State>(setState: SetState<State[]>, index: number): Updater<State>;
711
+ <State>(setState: SetState<State[]>, index: number, value: State): void;
712
+ };
713
+ export declare const curriedArraySlice: CurriedArraySlice;
714
+ export type ImmerArraySlice = {
715
+ <State>(setState: Updater<State[]>): UpdateSlice<State>;
716
+ <State>(setState: Updater<State[]>, index: number): Updater<State>;
717
+ <State>(setState: Updater<State[]>, index: number, value: State): void;
718
+ };
719
+ export declare const immerArraySlice: ImmerArraySlice;
720
+ export declare const getCredentialStatusArray: (credential: unknown) => Record<string, unknown>[];
721
+ export declare const isBitstringStatusListEntry: (status: unknown) => status is BitstringStatusListEntry;
722
+ export declare const getBitstringStatusListEntries: (credential: unknown) => BitstringStatusListEntry[];
723
+ export declare const getBitstringStatusListEntryForPurpose: (credential: unknown, statusPurpose: BitstringStatusPurpose) => BitstringStatusListEntry | undefined;
724
+ export declare const getBitstringStatusListBit: (bitstring: Uint8Array, index: number) => boolean;
725
+ export declare const setBitstringStatusListBit: (bitstring: Uint8Array, index: number, value: boolean) => void;
726
+ export declare const ImageResizingValidator: z.ZodObject<{
727
+ type: z.ZodLiteral<"resizing">;
728
+ }, z.core.$strip>;
729
+ export type ImageResizing = z.infer<typeof ImageResizingValidator>;
730
+ export declare const ImageUploadingValidator: z.ZodObject<{
731
+ type: z.ZodLiteral<"uploading">;
732
+ progress: z.ZodOptional<z.ZodNumber>;
733
+ }, z.core.$strip>;
734
+ export type ImageUploading = z.infer<typeof ImageUploadingValidator>;
735
+ export declare const ImageWithLoadingStateValdator: z.ZodObject<{
736
+ image: z.ZodString;
737
+ loading: z.ZodOptional<z.ZodUnion<readonly [
738
+ z.ZodObject<{
739
+ type: z.ZodLiteral<"resizing">;
740
+ }, z.core.$strip>,
741
+ z.ZodObject<{
742
+ type: z.ZodLiteral<"uploading">;
743
+ progress: z.ZodOptional<z.ZodNumber>;
744
+ }, z.core.$strip>
745
+ ]>>;
746
+ }, z.core.$strip>;
747
+ export type ImageWithLoadingState = z.infer<typeof ImageWithLoadingStateValdator>;
748
+ export type FilestackImage = {
749
+ filename: string;
750
+ handle: string;
751
+ mimetype: string;
752
+ originalFile: {
753
+ name: string;
754
+ size: number;
755
+ type: string;
756
+ };
757
+ originalPath: string;
758
+ size: number;
759
+ source: string;
760
+ status: string;
761
+ uploadId: string;
762
+ url: string;
763
+ };
764
+ export type Simplify<T> = {
765
+ [KeyType in keyof T]: T[KeyType];
766
+ };
767
+ export type Maybify<T> = Simplify<{
768
+ [P in keyof T]?: Maybify<T[P]> | null;
769
+ }>;
770
+ /** If Maybify gives you an exceeds maximum length error, try this one! */
771
+ export type PerformantMaybify<T> = {
772
+ [P in keyof T]?: PerformantMaybify<T[P]> | null;
773
+ };
774
+ export type DeepValues<ObjectType extends object> = {
775
+ [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object ? DeepValues<ObjectType[Key]> : ObjectType[Key];
776
+ }[keyof ObjectType & (string | number)];
777
+ export interface Nothing {
778
+ }
779
+ export type Other<T> = T & Nothing;
780
+ export type SuggestString<Literals extends string> = Literals | Other<string>;
781
+ export type DeepPartial<T> = T extends Date ? T : T extends object ? {
782
+ [P in keyof T]?: DeepPartial<T[P]>;
783
+ } : T;
784
+ export declare const isNotUndefined: <T>(value: T | null | undefined) => value is T;
785
+ export declare const filterUndefined: <T>(arr: (T | null | undefined)[]) => T[];
786
+ /**
787
+ * App installation age restriction logic shared between frontend and backend.
788
+ *
789
+ * This helper evaluates whether a user can install an app based on:
790
+ * - Hard age blocks (min_age) - always blocks, even with guardian approval
791
+ * - Soft age restrictions (age_rating) - can be approved by guardian for child profiles
792
+ * - Contract requirements - require guardian approval for child profiles
793
+ */
794
+ export type AppInstallCheckResult = {
795
+ action: "proceed";
796
+ } | {
797
+ action: "hard_blocked";
798
+ reason: string;
799
+ } | {
800
+ action: "require_dob";
801
+ reason: string;
802
+ } | {
803
+ action: "require_guardian_approval";
804
+ reason: string;
805
+ };
806
+ export type AppInstallCheckInput = {
807
+ /** Whether the user is a child profile (managed account) */
808
+ isChildProfile: boolean;
809
+ /** User's age calculated from DOB, null if DOB is unknown */
810
+ userAge: number | null;
811
+ /** Hard minimum age requirement (blocks completely, no guardian override) */
812
+ minAge?: number;
813
+ /** Soft age rating string (e.g., '4+', '9+', '12+', '17+') */
814
+ ageRating?: string;
815
+ /** Whether the app has an associated consent contract */
816
+ hasContract: boolean;
817
+ /** Whether guardian approval has already been obtained (for backend validation) */
818
+ hasGuardianApproval?: boolean;
819
+ };
820
+ /**
821
+ * Evaluates whether a user can install an app based on age restrictions and profile type.
822
+ *
823
+ * Cases:
824
+ * 1. Hard block: min_age violation (blocks completely, cannot be overridden)
825
+ * 2. Child profile scenarios:
826
+ * 2a. Child age unknown → require DOB entry (with guardian approval)
827
+ * 2b. No age rating specified → require guardian approval
828
+ * 2c. Child too young for age rating → require guardian approval
829
+ * 2d. App has a contract → require guardian approval
830
+ * 2e. Child old enough, no contract → proceed without guardian
831
+ * 3. Adult user old enough → proceed
832
+ *
833
+ * @param input - The check parameters
834
+ * @returns The action to take and reason if blocked/requires approval
835
+ */
836
+ export declare const checkAppInstallEligibility: (input: AppInstallCheckInput) => AppInstallCheckResult;
837
+ /**
838
+ * Map age_rating strings to numeric minimum ages.
839
+ */
840
+ export declare const AGE_RATING_TO_MIN_AGE: Record<string, number>;
841
+ /**
842
+ * Calculate age in years from a date of birth string.
843
+ * @param dob - Date of birth as ISO string or parseable date string
844
+ * @returns Age in years, or null if the date is invalid
845
+ */
846
+ export declare const calculateAgeFromDob: (dob?: string | null) => number | null;
847
+ /**
848
+ * Project a `CredentialRecord` into a format-discriminated read view.
849
+ *
850
+ * Two paths into the same output:
851
+ *
852
+ * 1. **Explicit format**: if the record carries an explicit `format`
853
+ * discriminator (and `rawWireForm` where required), the projector
854
+ * trusts it. This is the path new format-aware writers take.
855
+ *
856
+ * 2. **Inferred from shape** (legacy fallback): for records that
857
+ * pre-date ADR-0001 Phase 1, the projector inspects `record.vc` and
858
+ * infers the format. W3C VCs → `w3c-vc-2.0` / `w3c-vc-1.1` based
859
+ * on `@context`; transitional SD-JWT wrappers (which never shipped
860
+ * but exist on branch `lc-1796-3`) → `dc+sd-jwt` with the compact
861
+ * extracted from `proof.jwt`; legacy JWT-VC envelopes → `jwt-vc-json`.
862
+ *
863
+ * Returns a `StoredCredential` for every conceivable record. Never
864
+ * throws — credentials with unrecognizable shape fall back to
865
+ * `w3c-vc-1.1` with `data = record.vc` so legacy consumers keep
866
+ * something they can read.
867
+ *
868
+ * This projector is the SAFETY NET that makes the ADR-0001 migration
869
+ * non-breaking: writers can adopt format-tagging at their own pace;
870
+ * readers using this projector see the right discriminator either way.
871
+ */
872
+ export declare const toStoredCredential: (record: CredentialRecord) => StoredCredential;
873
+ /**
874
+ * Determines whether or not a string is a valid hexadecimal string
875
+ *
876
+ * E.g. 'abc123' is valid hex, 'zzz' is not
877
+ */
878
+ export declare const isHex: (str: string) => boolean;
879
+ /** Determines whether or not an object is an encrypted JWE */
880
+ export declare const isEncrypted: (item: Record<string, any>) => item is JWE;
881
+ /**
882
+ * tRPC data transformer that handles RegExp serialization/deserialization
883
+ */
884
+ export declare const RegExpTransformer: DataTransformer;
885
+ /**
886
+ * Determines if a credential uses VC 2.0 format by checking the @context array
887
+ */
888
+ export declare const isVC2Format: (credential: UnsignedVC | VC) => boolean;
889
+ /** Unwraps a boost credential from a CertifiedBoostCredential, if it is one */
890
+ export declare const unwrapBoostCredential: (vc?: VC | UnsignedVC) => any;
891
+ /**
892
+ * Checks if a DID is an app-specific did:web
893
+ *
894
+ * App did:webs follow the pattern: did:web:learncard.app:app:<slug>
895
+ *
896
+ * @param did - The DID to check
897
+ * @returns true if the DID is an app did:web, false otherwise
898
+ */
899
+ export declare const isAppDidWeb: (did?: string) => boolean;
900
+
901
+ export {};