@learncard/types 5.18.0 → 5.18.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/vc.d.ts CHANGED
@@ -151,7 +151,7 @@ export declare const CredentialSubjectValidator: z.ZodObject<{
151
151
  export type CredentialSubject = z.infer<typeof CredentialSubjectValidator>;
152
152
  export declare const CredentialStatusValidator: z.ZodObject<{
153
153
  type: z.ZodString;
154
- id: z.ZodString;
154
+ id: z.ZodOptional<z.ZodString>;
155
155
  }, z.core.$catchall<z.ZodAny>>;
156
156
  export type CredentialStatus = z.infer<typeof CredentialStatusValidator>;
157
157
  export declare const CredentialSchemaValidator: z.ZodObject<{
@@ -290,10 +290,10 @@ export declare const UnsignedVCValidator: z.ZodObject<{
290
290
  expirationDate: z.ZodOptional<z.ZodString>;
291
291
  credentialStatus: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
292
292
  type: z.ZodString;
293
- id: z.ZodString;
293
+ id: z.ZodOptional<z.ZodString>;
294
294
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
295
295
  type: z.ZodString;
296
- id: z.ZodString;
296
+ id: z.ZodOptional<z.ZodString>;
297
297
  }, z.core.$catchall<z.ZodAny>>>]>>;
298
298
  name: z.ZodOptional<z.ZodString>;
299
299
  description: z.ZodOptional<z.ZodString>;
@@ -301,10 +301,10 @@ export declare const UnsignedVCValidator: z.ZodObject<{
301
301
  validUntil: z.ZodOptional<z.ZodString>;
302
302
  status: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
303
303
  type: z.ZodString;
304
- id: z.ZodString;
304
+ id: z.ZodOptional<z.ZodString>;
305
305
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
306
306
  type: z.ZodString;
307
- id: z.ZodString;
307
+ id: z.ZodOptional<z.ZodString>;
308
308
  }, z.core.$catchall<z.ZodAny>>>]>>;
309
309
  termsOfUse: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
310
310
  type: z.ZodString;
@@ -451,10 +451,10 @@ export declare const VCValidator: z.ZodObject<{
451
451
  expirationDate: z.ZodOptional<z.ZodString>;
452
452
  credentialStatus: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
453
453
  type: z.ZodString;
454
- id: z.ZodString;
454
+ id: z.ZodOptional<z.ZodString>;
455
455
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
456
456
  type: z.ZodString;
457
- id: z.ZodString;
457
+ id: z.ZodOptional<z.ZodString>;
458
458
  }, z.core.$catchall<z.ZodAny>>>]>>;
459
459
  name: z.ZodOptional<z.ZodString>;
460
460
  description: z.ZodOptional<z.ZodString>;
@@ -462,10 +462,10 @@ export declare const VCValidator: z.ZodObject<{
462
462
  validUntil: z.ZodOptional<z.ZodString>;
463
463
  status: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
464
464
  type: z.ZodString;
465
- id: z.ZodString;
465
+ id: z.ZodOptional<z.ZodString>;
466
466
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
467
467
  type: z.ZodString;
468
- id: z.ZodString;
468
+ id: z.ZodOptional<z.ZodString>;
469
469
  }, z.core.$catchall<z.ZodAny>>>]>>;
470
470
  termsOfUse: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
471
471
  type: z.ZodString;
@@ -624,10 +624,10 @@ export declare const UnsignedVPValidator: z.ZodObject<{
624
624
  expirationDate: z.ZodOptional<z.ZodString>;
625
625
  credentialStatus: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
626
626
  type: z.ZodString;
627
- id: z.ZodString;
627
+ id: z.ZodOptional<z.ZodString>;
628
628
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
629
629
  type: z.ZodString;
630
- id: z.ZodString;
630
+ id: z.ZodOptional<z.ZodString>;
631
631
  }, z.core.$catchall<z.ZodAny>>>]>>;
632
632
  name: z.ZodOptional<z.ZodString>;
633
633
  description: z.ZodOptional<z.ZodString>;
@@ -635,10 +635,10 @@ export declare const UnsignedVPValidator: z.ZodObject<{
635
635
  validUntil: z.ZodOptional<z.ZodString>;
636
636
  status: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
637
637
  type: z.ZodString;
638
- id: z.ZodString;
638
+ id: z.ZodOptional<z.ZodString>;
639
639
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
640
640
  type: z.ZodString;
641
- id: z.ZodString;
641
+ id: z.ZodOptional<z.ZodString>;
642
642
  }, z.core.$catchall<z.ZodAny>>>]>>;
643
643
  termsOfUse: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
644
644
  type: z.ZodString;
@@ -791,10 +791,10 @@ export declare const UnsignedVPValidator: z.ZodObject<{
791
791
  expirationDate: z.ZodOptional<z.ZodString>;
792
792
  credentialStatus: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
793
793
  type: z.ZodString;
794
- id: z.ZodString;
794
+ id: z.ZodOptional<z.ZodString>;
795
795
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
796
796
  type: z.ZodString;
797
- id: z.ZodString;
797
+ id: z.ZodOptional<z.ZodString>;
798
798
  }, z.core.$catchall<z.ZodAny>>>]>>;
799
799
  name: z.ZodOptional<z.ZodString>;
800
800
  description: z.ZodOptional<z.ZodString>;
@@ -802,10 +802,10 @@ export declare const UnsignedVPValidator: z.ZodObject<{
802
802
  validUntil: z.ZodOptional<z.ZodString>;
803
803
  status: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
804
804
  type: z.ZodString;
805
- id: z.ZodString;
805
+ id: z.ZodOptional<z.ZodString>;
806
806
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
807
807
  type: z.ZodString;
808
- id: z.ZodString;
808
+ id: z.ZodOptional<z.ZodString>;
809
809
  }, z.core.$catchall<z.ZodAny>>>]>>;
810
810
  termsOfUse: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
811
811
  type: z.ZodString;
@@ -966,10 +966,10 @@ export declare const VPValidator: z.ZodObject<{
966
966
  expirationDate: z.ZodOptional<z.ZodString>;
967
967
  credentialStatus: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
968
968
  type: z.ZodString;
969
- id: z.ZodString;
969
+ id: z.ZodOptional<z.ZodString>;
970
970
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
971
971
  type: z.ZodString;
972
- id: z.ZodString;
972
+ id: z.ZodOptional<z.ZodString>;
973
973
  }, z.core.$catchall<z.ZodAny>>>]>>;
974
974
  name: z.ZodOptional<z.ZodString>;
975
975
  description: z.ZodOptional<z.ZodString>;
@@ -977,10 +977,10 @@ export declare const VPValidator: z.ZodObject<{
977
977
  validUntil: z.ZodOptional<z.ZodString>;
978
978
  status: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
979
979
  type: z.ZodString;
980
- id: z.ZodString;
980
+ id: z.ZodOptional<z.ZodString>;
981
981
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
982
982
  type: z.ZodString;
983
- id: z.ZodString;
983
+ id: z.ZodOptional<z.ZodString>;
984
984
  }, z.core.$catchall<z.ZodAny>>>]>>;
985
985
  termsOfUse: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
986
986
  type: z.ZodString;
@@ -1133,10 +1133,10 @@ export declare const VPValidator: z.ZodObject<{
1133
1133
  expirationDate: z.ZodOptional<z.ZodString>;
1134
1134
  credentialStatus: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1135
1135
  type: z.ZodString;
1136
- id: z.ZodString;
1136
+ id: z.ZodOptional<z.ZodString>;
1137
1137
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
1138
1138
  type: z.ZodString;
1139
- id: z.ZodString;
1139
+ id: z.ZodOptional<z.ZodString>;
1140
1140
  }, z.core.$catchall<z.ZodAny>>>]>>;
1141
1141
  name: z.ZodOptional<z.ZodString>;
1142
1142
  description: z.ZodOptional<z.ZodString>;
@@ -1144,10 +1144,10 @@ export declare const VPValidator: z.ZodObject<{
1144
1144
  validUntil: z.ZodOptional<z.ZodString>;
1145
1145
  status: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1146
1146
  type: z.ZodString;
1147
- id: z.ZodString;
1147
+ id: z.ZodOptional<z.ZodString>;
1148
1148
  }, z.core.$catchall<z.ZodAny>>, z.ZodArray<z.ZodObject<{
1149
1149
  type: z.ZodString;
1150
- id: z.ZodString;
1150
+ id: z.ZodOptional<z.ZodString>;
1151
1151
  }, z.core.$catchall<z.ZodAny>>>]>>;
1152
1152
  termsOfUse: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
1153
1153
  type: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/types",
3
- "version": "5.18.0",
3
+ "version": "5.18.2",
4
4
  "description": "Shared types for learn card",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -10,7 +10,7 @@ export const BitstringStatusListEntryValidator = z.object({
10
10
  id: z.string().optional(),
11
11
  type: z.literal('BitstringStatusListEntry'),
12
12
  statusPurpose: BitstringStatusPurposeValidator,
13
- statusListIndex: z.string(),
13
+ statusListIndex: z.string().or(z.number().int().nonnegative()),
14
14
  statusListCredential: z.string(),
15
15
  });
16
16
  export type BitstringStatusListEntry = z.infer<typeof BitstringStatusListEntryValidator>;
package/src/lcn.ts CHANGED
@@ -102,6 +102,47 @@ export const LCNPublicProfileValidator = LCNProfileValidator.pick({
102
102
  });
103
103
  export type LCNPublicProfile = z.infer<typeof LCNPublicProfileValidator>;
104
104
 
105
+ export const LCNConnectionPromptStatusValidator = z.enum(['PENDING', 'SKIPPED', 'CONNECTED']);
106
+ export type LCNConnectionPromptStatus = z.infer<typeof LCNConnectionPromptStatusValidator>;
107
+
108
+ export const LCNConnectionPromptSurfaceValidator = z.enum(['POST_CLAIM', 'NOTIFICATION']);
109
+ export type LCNConnectionPromptSurface = z.infer<typeof LCNConnectionPromptSurfaceValidator>;
110
+
111
+ export const LCNConnectionPromptActionStatusValidator = z.enum([
112
+ 'PENDING',
113
+ 'SKIPPED',
114
+ 'CONNECTED',
115
+ 'STALE',
116
+ ]);
117
+ export type LCNConnectionPromptActionStatus = z.infer<
118
+ typeof LCNConnectionPromptActionStatusValidator
119
+ >;
120
+
121
+ export const LCNConnectionPromptValidator = z.object({
122
+ promptId: z.string().uuid(),
123
+ status: LCNConnectionPromptStatusValidator,
124
+ surface: LCNConnectionPromptSurfaceValidator,
125
+ triggerId: z.string(),
126
+ triggeredAt: z.iso.datetime(),
127
+ updatedAt: z.iso.datetime(),
128
+ counterpart: LCNPublicProfileValidator,
129
+ });
130
+ export type LCNConnectionPrompt = z.infer<typeof LCNConnectionPromptValidator>;
131
+
132
+ export const LCNConnectionPromptActionResultValidator = z.object({
133
+ promptId: z.string().uuid(),
134
+ status: LCNConnectionPromptActionStatusValidator,
135
+ });
136
+ export type LCNConnectionPromptActionResult = z.infer<
137
+ typeof LCNConnectionPromptActionResultValidator
138
+ >;
139
+
140
+ export const LCNConnectionPromptMetadataValidator = z.object({
141
+ promptId: z.string().uuid(),
142
+ counterpartProfileId: z.string(),
143
+ });
144
+ export type LCNConnectionPromptMetadata = z.infer<typeof LCNConnectionPromptMetadataValidator>;
145
+
105
146
  export const LCNAuthedProfileValidator = LCNPublicProfileValidator.extend({
106
147
  bio: LCNProfileValidator.shape.bio,
107
148
  websiteLink: LCNProfileValidator.shape.websiteLink,
@@ -966,13 +1007,20 @@ export const LCNNotificationInboxValidator = z.object({
966
1007
 
967
1008
  export type LCNNotificationInbox = z.infer<typeof LCNNotificationInboxValidator>;
968
1009
 
1010
+ export const LCNNotificationMetadataValidator = z
1011
+ .object({
1012
+ connectionPrompt: LCNConnectionPromptMetadataValidator.optional(),
1013
+ })
1014
+ .catchall(z.unknown());
1015
+ export type LCNNotificationMetadata = z.infer<typeof LCNNotificationMetadataValidator>;
1016
+
969
1017
  export const LCNNotificationDataValidator = z
970
1018
  .object({
971
1019
  vcUris: z.array(z.string()).optional(),
972
1020
  vpUris: z.array(z.string()).optional(),
973
1021
  transaction: ConsentFlowTransactionValidator.optional(),
974
1022
  inbox: LCNNotificationInboxValidator.optional(),
975
- metadata: z.record(z.string(), z.unknown()).optional(),
1023
+ metadata: LCNNotificationMetadataValidator.optional(),
976
1024
  })
977
1025
  .loose();
978
1026
  export type LCNNotificationData = z.infer<typeof LCNNotificationDataValidator>;
package/src/learncard.ts CHANGED
@@ -44,8 +44,17 @@ export const StatusCheckEntryValidator = z.object({
44
44
  export type StatusCheckEntry = z.infer<typeof StatusCheckEntryValidator>;
45
45
 
46
46
  export const VerificationCheckValidator = z.object({
47
+ /**
48
+ * Checks that completed successfully. This does not imply that warnings can be ignored.
49
+ */
47
50
  checks: z.string().array(),
51
+ /**
52
+ * Security-relevant conditions that did not prevent the requested cryptographic checks from
53
+ * completing. In particular, a non-DID issuer warning means the signature is valid but the
54
+ * named URL issuer's authorization of that signing key was not established.
55
+ */
48
56
  warnings: z.string().array(),
57
+ /** Verification failures that prevented one or more requested checks from succeeding. */
49
58
  errors: z.string().array(),
50
59
  /**
51
60
  * Per-entry results for the `credentialStatus` check, populated
package/src/vc.ts CHANGED
@@ -102,7 +102,7 @@ export const CredentialSubjectValidator = z.object({ id: z.string().optional() }
102
102
  export type CredentialSubject = z.infer<typeof CredentialSubjectValidator>;
103
103
 
104
104
  export const CredentialStatusValidator = z
105
- .object({ type: z.string(), id: z.string() })
105
+ .object({ type: z.string(), id: z.string().optional() })
106
106
  .catchall(z.any());
107
107
  export type CredentialStatus = z.infer<typeof CredentialStatusValidator>;
108
108