@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/types.esm.js CHANGED
@@ -138,14 +138,22 @@ var UnsignedVCValidator = z.object({
138
138
  }).catchall(z.any());
139
139
  var ProofValidator = z.object({
140
140
  type: z.string(),
141
- created: z.string(),
141
+ created: z.string().optional(),
142
142
  challenge: z.string().optional(),
143
143
  domain: z.string().optional(),
144
144
  nonce: z.string().optional(),
145
145
  proofPurpose: z.string(),
146
146
  verificationMethod: z.string(),
147
147
  jws: z.string().optional()
148
- }).catchall(z.any());
148
+ }).catchall(z.any()).superRefine((proof, ctx) => {
149
+ if (proof.created === void 0 && (proof.type !== "DataIntegrityProof" || proof.cryptosuite !== "ecdsa-rdfc-2019")) {
150
+ ctx.addIssue({
151
+ code: "custom",
152
+ path: ["created"],
153
+ message: "created is required for this proof suite"
154
+ });
155
+ }
156
+ });
149
157
  var VCValidator = UnsignedVCValidator.extend({
150
158
  proof: ProofValidator.or(ProofValidator.array())
151
159
  });
@@ -942,7 +950,10 @@ var SendOptionsValidator = z11.object({
942
950
  webhookUrl: z11.string().url().optional().describe("Webhook URL to receive claim notifications"),
943
951
  suppressDelivery: z11.boolean().optional().describe("If true, returns claimUrl without sending email/SMS"),
944
952
  branding: SendBrandingOptionsValidator.optional().describe("Branding for email/SMS delivery"),
945
- guardianEmail: z11.string().email().optional().describe("Guardian email that must approve before student can claim")
953
+ guardianEmail: z11.string().email().optional().describe("Guardian email that must approve before student can claim"),
954
+ expiresInDays: z11.number().int().min(1).max(720).optional().describe(
955
+ "How many days the credential stays claimable in the Universal Inbox (default 30). Does not change the credential validity period."
956
+ )
946
957
  });
947
958
  var SendBoostInputValidator = z11.object({
948
959
  type: z11.literal("boost"),
@@ -1063,15 +1074,6 @@ var ConsentFlowContractDataValidator = z11.object({
1063
1074
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
1064
1075
  records: ConsentFlowContractDataValidator.array()
1065
1076
  });
1066
- var ConsentFlowContractDataForDidValidator = z11.object({
1067
- credentials: z11.object({ category: z11.string(), uri: z11.string() }).array(),
1068
- personal: z11.record(z11.string(), z11.string()).default({}),
1069
- date: z11.string(),
1070
- contractUri: z11.string()
1071
- });
1072
- var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
1073
- records: ConsentFlowContractDataForDidValidator.array()
1074
- });
1075
1077
  var ConsentFlowTermValidator = z11.object({
1076
1078
  sharing: z11.boolean().optional(),
1077
1079
  shared: z11.string().array().optional(),
@@ -1105,6 +1107,34 @@ var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
1105
1107
  status: ConsentFlowTermsStatusValidator
1106
1108
  }).array()
1107
1109
  });
1110
+ var ConsentFlowGuardianApprovalValidator = z11.object({
1111
+ guardianProfileId: z11.string(),
1112
+ guardianDid: z11.string(),
1113
+ approvedAt: z11.string().datetime(),
1114
+ contractUpdatedAt: z11.string()
1115
+ });
1116
+ var ConsentFlowContractDataForDidValidator = z11.object({
1117
+ credentials: z11.object({ category: z11.string(), uri: z11.string() }).array(),
1118
+ personal: z11.record(z11.string(), z11.string()).default({}),
1119
+ date: z11.string(),
1120
+ createdAt: z11.string().optional(),
1121
+ contractUpdatedAt: z11.string(),
1122
+ contractExpiresAt: z11.string().optional(),
1123
+ reasonForAccessing: z11.string().optional(),
1124
+ guardian: z11.object({
1125
+ required: z11.boolean(),
1126
+ approved: z11.boolean(),
1127
+ approval: ConsentFlowGuardianApprovalValidator.optional()
1128
+ }),
1129
+ contractUri: z11.string(),
1130
+ termsUri: z11.string(),
1131
+ status: ConsentFlowTermsStatusValidator,
1132
+ expiresAt: z11.string().optional(),
1133
+ terms: ConsentFlowTermsValidator
1134
+ });
1135
+ var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
1136
+ records: ConsentFlowContractDataForDidValidator.array()
1137
+ });
1108
1138
  var ConsentFlowContractQueryValidator = z11.object({
1109
1139
  read: z11.object({
1110
1140
  anonymize: z11.boolean().optional(),
@@ -1165,6 +1195,7 @@ var ConsentFlowTransactionValidator = z11.object({
1165
1195
  expiresAt: z11.string().optional(),
1166
1196
  oneTime: z11.boolean().optional(),
1167
1197
  terms: ConsentFlowTermsValidator.optional(),
1198
+ guardianApproval: ConsentFlowGuardianApprovalValidator.optional(),
1168
1199
  id: z11.string(),
1169
1200
  action: ConsentFlowTransactionActionValidator,
1170
1201
  date: z11.string(),
@@ -1237,7 +1268,8 @@ var LCNNotificationTypeEnumValidator = z11.enum([
1237
1268
  "APP_NOTIFICATION",
1238
1269
  "CREDENTIAL_REVOKED",
1239
1270
  "CREDENTIAL_SUSPENDED",
1240
- "CREDENTIAL_UNSUSPENDED"
1271
+ "CREDENTIAL_UNSUSPENDED",
1272
+ "CREDENTIAL_REFRESHED"
1241
1273
  ]);
1242
1274
  var LCNNotificationMessageValidator = z11.object({
1243
1275
  title: z11.string().optional(),
@@ -1369,12 +1401,16 @@ var CreateContactMethodSessionResponseValidator = z11.object({
1369
1401
  });
1370
1402
  var InboxCredentialValidator = z11.object({
1371
1403
  id: z11.string(),
1372
- credential: z11.string(),
1404
+ credential: z11.string().optional(),
1373
1405
  isSigned: z11.boolean(),
1374
1406
  currentStatus: LCNInboxStatusEnumValidator,
1375
1407
  isAccepted: z11.boolean().optional(),
1376
1408
  expiresAt: z11.string(),
1377
1409
  createdAt: z11.string(),
1410
+ finalizedAt: z11.string().optional(),
1411
+ expiredAt: z11.string().optional(),
1412
+ credentialName: z11.string().optional(),
1413
+ achievementType: z11.string().optional(),
1378
1414
  issuerDid: z11.string(),
1379
1415
  webhookUrl: z11.string().optional(),
1380
1416
  boostUri: z11.string().optional(),
@@ -1428,7 +1464,9 @@ var IssueInboxCredentialValidator = z11.object({
1428
1464
  "The signing authority to use for the credential. If not provided, the users default signing authority will be used if the credential is not signed."
1429
1465
  ),
1430
1466
  webhookUrl: z11.string().url().optional().describe("The webhook URL to receive credential issuance events."),
1431
- expiresInDays: z11.number().min(1).max(365).optional().describe("The number of days the credential will be valid for."),
1467
+ expiresInDays: z11.number().int().min(1).max(720).optional().describe(
1468
+ "How many days the encrypted inbox payload remains claimable. This does not change the credential validity period."
1469
+ ),
1432
1470
  templateData: z11.record(z11.string(), z11.unknown()).optional().describe(
1433
1471
  "Template data to render into the boost credential template using Mustache syntax. Only used when boostUri is provided."
1434
1472
  ),
@@ -1491,6 +1529,9 @@ var ClaimInboxCredentialValidator = z11.object({
1491
1529
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
1492
1530
  configuration: z11.object({
1493
1531
  publishableKey: z11.string(),
1532
+ expiresInDays: z11.number().int().min(1).max(720).optional().describe(
1533
+ "Inbox claim window in days. Defaults to 720; use a shorter window for sensitive records."
1534
+ ),
1494
1535
  signingAuthorityName: z11.string().optional(),
1495
1536
  listingId: z11.string().optional(),
1496
1537
  listingSlug: z11.string().optional()
@@ -2133,6 +2174,194 @@ var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
2133
2174
  const result = inAppMessagesFlagValidator.safeParse(raw);
2134
2175
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
2135
2176
  }, "parseInAppMessagesFlag");
2177
+
2178
+ // src/credential-refresh.ts
2179
+ import { z as z14 } from "zod/v4";
2180
+ var LearnCardRefreshAuthorizationValidator = z14.object({ type: z14.literal("LearnCardDIDAuth") }).catchall(z14.any());
2181
+ var ManagedCredentialRefreshServiceValidator = z14.object({
2182
+ id: z14.string().min(1),
2183
+ type: z14.literal("LearnCardCredentialRefresh2026"),
2184
+ authorization: LearnCardRefreshAuthorizationValidator.optional()
2185
+ }).catchall(z14.any());
2186
+ var StandardCredentialRefreshServiceValidator = z14.object({
2187
+ id: z14.string().min(1),
2188
+ type: z14.literal("1EdTechCredentialRefresh")
2189
+ }).catchall(z14.any());
2190
+ var SupportedCredentialRefreshServiceValidator = z14.union([
2191
+ ManagedCredentialRefreshServiceValidator,
2192
+ StandardCredentialRefreshServiceValidator
2193
+ ]);
2194
+ var AllocateCredentialRefreshInputValidator = z14.object({
2195
+ holder: z14.object({
2196
+ profileId: z14.string().optional(),
2197
+ did: z14.string().min(1)
2198
+ }),
2199
+ credentialId: z14.string().min(1)
2200
+ });
2201
+ var AllocateCredentialRefreshResultValidator = z14.object({
2202
+ refreshId: z14.string().min(1),
2203
+ refreshService: ManagedCredentialRefreshServiceValidator.extend({
2204
+ authorization: LearnCardRefreshAuthorizationValidator
2205
+ })
2206
+ });
2207
+ var CredentialRefreshSigningModeValidator = z14.enum(["issuer-signed", "signing-authority"]);
2208
+ var PublishCredentialRefreshBaseFields = {
2209
+ refreshId: z14.string().min(1),
2210
+ notifyHolder: z14.boolean().optional(),
2211
+ updateSummary: z14.string().optional(),
2212
+ idempotencyKey: z14.string().optional()
2213
+ };
2214
+ var PublishIssuerSignedRefreshValidator = z14.object({
2215
+ ...PublishCredentialRefreshBaseFields,
2216
+ mode: z14.literal("issuer-signed"),
2217
+ signedCredential: VCValidator
2218
+ });
2219
+ var PublishSigningAuthorityRefreshValidator = z14.object({
2220
+ ...PublishCredentialRefreshBaseFields,
2221
+ mode: z14.literal("signing-authority"),
2222
+ credential: UnsignedVCValidator,
2223
+ signingAuthority: z14.object({
2224
+ type: z14.string().min(1)
2225
+ }).catchall(z14.any())
2226
+ });
2227
+ var PublishCredentialRefreshInputValidator = z14.object({
2228
+ ...PublishCredentialRefreshBaseFields,
2229
+ mode: CredentialRefreshSigningModeValidator,
2230
+ signedCredential: VCValidator.optional(),
2231
+ credential: UnsignedVCValidator.optional(),
2232
+ signingAuthority: z14.object({
2233
+ type: z14.string().min(1)
2234
+ }).catchall(z14.any()).optional()
2235
+ }).superRefine((input, ctx) => {
2236
+ if (input.mode === "issuer-signed" && !input.signedCredential) {
2237
+ ctx.addIssue({
2238
+ code: "custom",
2239
+ path: ["signedCredential"],
2240
+ message: "signedCredential is required for issuer-signed publication"
2241
+ });
2242
+ }
2243
+ if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
2244
+ ctx.addIssue({
2245
+ code: "custom",
2246
+ path: ["mode"],
2247
+ message: "issuer-signed publication cannot include signing-authority fields"
2248
+ });
2249
+ }
2250
+ if (input.mode === "signing-authority") {
2251
+ if (input.signedCredential !== void 0) {
2252
+ ctx.addIssue({
2253
+ code: "custom",
2254
+ path: ["signedCredential"],
2255
+ message: "signing-authority publication cannot include signedCredential"
2256
+ });
2257
+ }
2258
+ if (!input.credential) {
2259
+ ctx.addIssue({
2260
+ code: "custom",
2261
+ path: ["credential"],
2262
+ message: "credential is required for signing-authority publication"
2263
+ });
2264
+ }
2265
+ if (!input.signingAuthority) {
2266
+ ctx.addIssue({
2267
+ code: "custom",
2268
+ path: ["signingAuthority"],
2269
+ message: "signingAuthority is required for signing-authority publication"
2270
+ });
2271
+ }
2272
+ }
2273
+ });
2274
+ var PublishCredentialRefreshNotificationValidator = z14.enum([
2275
+ "queued",
2276
+ "suppressed",
2277
+ "not-applicable",
2278
+ /** Publication succeeded, but the post-commit notification enqueue must be retried. */
2279
+ "delivery-failed"
2280
+ ]);
2281
+ var PublishCredentialRefreshResultValidator = z14.object({
2282
+ refreshId: z14.string().min(1),
2283
+ version: z14.number().int().positive(),
2284
+ publishedAt: z14.string().min(1),
2285
+ notification: PublishCredentialRefreshNotificationValidator
2286
+ });
2287
+ var CredentialRefreshVersionMetadataValidator = z14.object({
2288
+ version: z14.number().int().positive(),
2289
+ publishedAt: z14.string().min(1),
2290
+ effectiveAt: z14.string().optional(),
2291
+ etag: z14.string().optional(),
2292
+ signingMode: CredentialRefreshSigningModeValidator.optional(),
2293
+ updateSummary: z14.string().optional()
2294
+ });
2295
+ var GetCredentialRefreshHistoryInputValidator = z14.object({
2296
+ refreshId: z14.string().min(1),
2297
+ cursor: z14.string().optional(),
2298
+ limit: z14.number().int().positive().optional()
2299
+ });
2300
+ var GetCredentialRefreshHistoryResultValidator = z14.object({
2301
+ records: CredentialRefreshVersionMetadataValidator.array(),
2302
+ hasMore: z14.boolean(),
2303
+ cursor: z14.string().optional()
2304
+ });
2305
+ var CredentialRefreshChallengeValidator = z14.object({
2306
+ challenge: z14.string().min(1),
2307
+ expiresAt: z14.string().min(1),
2308
+ domain: z14.string().optional(),
2309
+ scheme: z14.literal("LearnCardDIDAuth").optional()
2310
+ });
2311
+ var PublicCredentialRefreshEnvelopeValidator = z14.object({
2312
+ format: z14.literal("vc"),
2313
+ credential: VCValidator,
2314
+ etag: z14.string().optional()
2315
+ });
2316
+ var JweCredentialRefreshEnvelopeValidator = z14.object({
2317
+ format: z14.literal("jwe"),
2318
+ jwe: JWEValidator,
2319
+ etag: z14.string().optional(),
2320
+ /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
2321
+ version: z14.number().int().positive().optional()
2322
+ });
2323
+ var CredentialRefreshResponseEnvelopeValidator = z14.discriminatedUnion("format", [
2324
+ PublicCredentialRefreshEnvelopeValidator,
2325
+ JweCredentialRefreshEnvelopeValidator
2326
+ ]);
2327
+ var CredentialRefreshFailureCodeValidator = z14.enum([
2328
+ "UNAVAILABLE",
2329
+ "TIMEOUT",
2330
+ "UNSUPPORTED_SERVICE",
2331
+ "UNAUTHORIZED",
2332
+ "MALFORMED_RESPONSE",
2333
+ "INVALID_PROOF",
2334
+ "ISSUER_MISMATCH",
2335
+ "ID_MISMATCH",
2336
+ "ROLLBACK",
2337
+ "REVOKED",
2338
+ "UNSAFE_ENDPOINT"
2339
+ ]);
2340
+ var CredentialRefreshUpdatedResultValidator = z14.object({
2341
+ status: z14.literal("updated"),
2342
+ credential: VCValidator,
2343
+ etag: z14.string().optional(),
2344
+ managedVersion: z14.number().int().positive().optional()
2345
+ });
2346
+ var CredentialRefreshUnchangedResultValidator = z14.object({
2347
+ status: z14.literal("unchanged"),
2348
+ checkedAt: z14.string().min(1),
2349
+ etag: z14.string().optional()
2350
+ });
2351
+ var CredentialRefreshUnsupportedResultValidator = z14.object({
2352
+ status: z14.literal("unsupported")
2353
+ });
2354
+ var CredentialRefreshFailedResultValidator = z14.object({
2355
+ status: z14.literal("failed"),
2356
+ code: CredentialRefreshFailureCodeValidator,
2357
+ retryable: z14.boolean()
2358
+ });
2359
+ var CredentialRefreshResultValidator = z14.discriminatedUnion("status", [
2360
+ CredentialRefreshUpdatedResultValidator,
2361
+ CredentialRefreshUnchangedResultValidator,
2362
+ CredentialRefreshUnsupportedResultValidator,
2363
+ CredentialRefreshFailedResultValidator
2364
+ ]);
2136
2365
  export {
2137
2366
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
2138
2367
  AchievementCredentialValidator,
@@ -2145,6 +2374,8 @@ export {
2145
2374
  AgeRatingValidator,
2146
2375
  AlignmentTargetTypeValidator,
2147
2376
  AlignmentValidator,
2377
+ AllocateCredentialRefreshInputValidator,
2378
+ AllocateCredentialRefreshResultValidator,
2148
2379
  AllocateCredentialStatusInputValidator,
2149
2380
  AllocatedBitstringStatusListEntryValidator,
2150
2381
  AllowConnectionRequestsEnum,
@@ -2194,6 +2425,7 @@ export {
2194
2425
  ConsentFlowContractValidator,
2195
2426
  ConsentFlowDataForDidQueryValidator,
2196
2427
  ConsentFlowDataQueryValidator,
2428
+ ConsentFlowGuardianApprovalValidator,
2197
2429
  ConsentFlowTermValidator,
2198
2430
  ConsentFlowTermsQueryValidator,
2199
2431
  ConsentFlowTermsStatusValidator,
@@ -2226,6 +2458,16 @@ export {
2226
2458
  CredentialInfoValidator,
2227
2459
  CredentialNameRefValidator,
2228
2460
  CredentialRecordValidator,
2461
+ CredentialRefreshChallengeValidator,
2462
+ CredentialRefreshFailedResultValidator,
2463
+ CredentialRefreshFailureCodeValidator,
2464
+ CredentialRefreshResponseEnvelopeValidator,
2465
+ CredentialRefreshResultValidator,
2466
+ CredentialRefreshSigningModeValidator,
2467
+ CredentialRefreshUnchangedResultValidator,
2468
+ CredentialRefreshUnsupportedResultValidator,
2469
+ CredentialRefreshUpdatedResultValidator,
2470
+ CredentialRefreshVersionMetadataValidator,
2229
2471
  CredentialSchemaValidator,
2230
2472
  CredentialStatusValidator,
2231
2473
  CredentialSubjectValidator,
@@ -2246,6 +2488,8 @@ export {
2246
2488
  GeoCoordinatesValidator,
2247
2489
  GetCounterEventValidator,
2248
2490
  GetCountersEventValidator,
2491
+ GetCredentialRefreshHistoryInputValidator,
2492
+ GetCredentialRefreshHistoryResultValidator,
2249
2493
  GetFullSkillTreeInputValidator,
2250
2494
  GetFullSkillTreeResultValidator,
2251
2495
  GetSkillPathInputValidator,
@@ -2270,6 +2514,7 @@ export {
2270
2514
  JWEValidator,
2271
2515
  JWKValidator,
2272
2516
  JWKWithPrivateKeyValidator,
2517
+ JweCredentialRefreshEnvelopeValidator,
2273
2518
  KnownAchievementTypeValidator,
2274
2519
  LCNAuthedProfileValidator,
2275
2520
  LCNBoostClaimLinkOptionsValidator,
@@ -2307,7 +2552,9 @@ export {
2307
2552
  LCNSigningAuthorityValidator,
2308
2553
  LCNVisibleProfileValidator,
2309
2554
  LaunchTypeValidator,
2555
+ LearnCardRefreshAuthorizationValidator,
2310
2556
  LinkProviderFrameworkInputValidator,
2557
+ ManagedCredentialRefreshServiceValidator,
2311
2558
  PaginatedAppStoreListingsValidator,
2312
2559
  PaginatedBoostRecipientsValidator,
2313
2560
  PaginatedBoostRecipientsWithChildrenValidator,
@@ -2337,6 +2584,12 @@ export {
2337
2584
  ProfileVisibilityEnum,
2338
2585
  PromotionLevelValidator,
2339
2586
  ProofValidator,
2587
+ PublicCredentialRefreshEnvelopeValidator,
2588
+ PublishCredentialRefreshInputValidator,
2589
+ PublishCredentialRefreshNotificationValidator,
2590
+ PublishCredentialRefreshResultValidator,
2591
+ PublishIssuerSignedRefreshValidator,
2592
+ PublishSigningAuthorityRefreshValidator,
2340
2593
  RefreshServiceValidator,
2341
2594
  RegExpValidator,
2342
2595
  RelatedValidator,
@@ -2377,11 +2630,13 @@ export {
2377
2630
  SkillTreeNodeInputValidator,
2378
2631
  SkillTreeNodeValidator,
2379
2632
  SkillValidator,
2633
+ StandardCredentialRefreshServiceValidator,
2380
2634
  StatusCheckEntryValidator,
2381
2635
  StoredCredentialEnvelopeValidator,
2382
2636
  StringQuery,
2383
2637
  SummaryCredentialDataValidator,
2384
2638
  SummaryCredentialKeywordValidator,
2639
+ SupportedCredentialRefreshServiceValidator,
2385
2640
  SyncFrameworkInputValidator,
2386
2641
  TagValidator,
2387
2642
  TemplateRenderMethodValidator,