@learncard/types 5.18.3 → 5.19.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
@@ -942,7 +942,10 @@ var SendOptionsValidator = z11.object({
942
942
  webhookUrl: z11.string().url().optional().describe("Webhook URL to receive claim notifications"),
943
943
  suppressDelivery: z11.boolean().optional().describe("If true, returns claimUrl without sending email/SMS"),
944
944
  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")
945
+ guardianEmail: z11.string().email().optional().describe("Guardian email that must approve before student can claim"),
946
+ expiresInDays: z11.number().int().min(1).max(720).optional().describe(
947
+ "How many days the credential stays claimable in the Universal Inbox (default 30). Does not change the credential validity period."
948
+ )
946
949
  });
947
950
  var SendBoostInputValidator = z11.object({
948
951
  type: z11.literal("boost"),
@@ -1237,7 +1240,8 @@ var LCNNotificationTypeEnumValidator = z11.enum([
1237
1240
  "APP_NOTIFICATION",
1238
1241
  "CREDENTIAL_REVOKED",
1239
1242
  "CREDENTIAL_SUSPENDED",
1240
- "CREDENTIAL_UNSUSPENDED"
1243
+ "CREDENTIAL_UNSUSPENDED",
1244
+ "CREDENTIAL_REFRESHED"
1241
1245
  ]);
1242
1246
  var LCNNotificationMessageValidator = z11.object({
1243
1247
  title: z11.string().optional(),
@@ -1369,12 +1373,16 @@ var CreateContactMethodSessionResponseValidator = z11.object({
1369
1373
  });
1370
1374
  var InboxCredentialValidator = z11.object({
1371
1375
  id: z11.string(),
1372
- credential: z11.string(),
1376
+ credential: z11.string().optional(),
1373
1377
  isSigned: z11.boolean(),
1374
1378
  currentStatus: LCNInboxStatusEnumValidator,
1375
1379
  isAccepted: z11.boolean().optional(),
1376
1380
  expiresAt: z11.string(),
1377
1381
  createdAt: z11.string(),
1382
+ finalizedAt: z11.string().optional(),
1383
+ expiredAt: z11.string().optional(),
1384
+ credentialName: z11.string().optional(),
1385
+ achievementType: z11.string().optional(),
1378
1386
  issuerDid: z11.string(),
1379
1387
  webhookUrl: z11.string().optional(),
1380
1388
  boostUri: z11.string().optional(),
@@ -1428,7 +1436,9 @@ var IssueInboxCredentialValidator = z11.object({
1428
1436
  "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
1437
  ),
1430
1438
  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."),
1439
+ expiresInDays: z11.number().int().min(1).max(720).optional().describe(
1440
+ "How many days the encrypted inbox payload remains claimable. This does not change the credential validity period."
1441
+ ),
1432
1442
  templateData: z11.record(z11.string(), z11.unknown()).optional().describe(
1433
1443
  "Template data to render into the boost credential template using Mustache syntax. Only used when boostUri is provided."
1434
1444
  ),
@@ -1491,6 +1501,9 @@ var ClaimInboxCredentialValidator = z11.object({
1491
1501
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
1492
1502
  configuration: z11.object({
1493
1503
  publishableKey: z11.string(),
1504
+ expiresInDays: z11.number().int().min(1).max(720).optional().describe(
1505
+ "Inbox claim window in days. Defaults to 720; use a shorter window for sensitive records."
1506
+ ),
1494
1507
  signingAuthorityName: z11.string().optional(),
1495
1508
  listingId: z11.string().optional(),
1496
1509
  listingSlug: z11.string().optional()
@@ -2133,6 +2146,194 @@ var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
2133
2146
  const result = inAppMessagesFlagValidator.safeParse(raw);
2134
2147
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
2135
2148
  }, "parseInAppMessagesFlag");
2149
+
2150
+ // src/credential-refresh.ts
2151
+ import { z as z14 } from "zod/v4";
2152
+ var LearnCardRefreshAuthorizationValidator = z14.object({ type: z14.literal("LearnCardDIDAuth") }).catchall(z14.any());
2153
+ var ManagedCredentialRefreshServiceValidator = z14.object({
2154
+ id: z14.string().min(1),
2155
+ type: z14.literal("LearnCardCredentialRefresh2026"),
2156
+ authorization: LearnCardRefreshAuthorizationValidator.optional()
2157
+ }).catchall(z14.any());
2158
+ var StandardCredentialRefreshServiceValidator = z14.object({
2159
+ id: z14.string().min(1),
2160
+ type: z14.literal("1EdTechCredentialRefresh")
2161
+ }).catchall(z14.any());
2162
+ var SupportedCredentialRefreshServiceValidator = z14.union([
2163
+ ManagedCredentialRefreshServiceValidator,
2164
+ StandardCredentialRefreshServiceValidator
2165
+ ]);
2166
+ var AllocateCredentialRefreshInputValidator = z14.object({
2167
+ holder: z14.object({
2168
+ profileId: z14.string().optional(),
2169
+ did: z14.string().min(1)
2170
+ }),
2171
+ credentialId: z14.string().min(1)
2172
+ });
2173
+ var AllocateCredentialRefreshResultValidator = z14.object({
2174
+ refreshId: z14.string().min(1),
2175
+ refreshService: ManagedCredentialRefreshServiceValidator.extend({
2176
+ authorization: LearnCardRefreshAuthorizationValidator
2177
+ })
2178
+ });
2179
+ var CredentialRefreshSigningModeValidator = z14.enum(["issuer-signed", "signing-authority"]);
2180
+ var PublishCredentialRefreshBaseFields = {
2181
+ refreshId: z14.string().min(1),
2182
+ notifyHolder: z14.boolean().optional(),
2183
+ updateSummary: z14.string().optional(),
2184
+ idempotencyKey: z14.string().optional()
2185
+ };
2186
+ var PublishIssuerSignedRefreshValidator = z14.object({
2187
+ ...PublishCredentialRefreshBaseFields,
2188
+ mode: z14.literal("issuer-signed"),
2189
+ signedCredential: VCValidator
2190
+ });
2191
+ var PublishSigningAuthorityRefreshValidator = z14.object({
2192
+ ...PublishCredentialRefreshBaseFields,
2193
+ mode: z14.literal("signing-authority"),
2194
+ credential: UnsignedVCValidator,
2195
+ signingAuthority: z14.object({
2196
+ type: z14.string().min(1)
2197
+ }).catchall(z14.any())
2198
+ });
2199
+ var PublishCredentialRefreshInputValidator = z14.object({
2200
+ ...PublishCredentialRefreshBaseFields,
2201
+ mode: CredentialRefreshSigningModeValidator,
2202
+ signedCredential: VCValidator.optional(),
2203
+ credential: UnsignedVCValidator.optional(),
2204
+ signingAuthority: z14.object({
2205
+ type: z14.string().min(1)
2206
+ }).catchall(z14.any()).optional()
2207
+ }).superRefine((input, ctx) => {
2208
+ if (input.mode === "issuer-signed" && !input.signedCredential) {
2209
+ ctx.addIssue({
2210
+ code: "custom",
2211
+ path: ["signedCredential"],
2212
+ message: "signedCredential is required for issuer-signed publication"
2213
+ });
2214
+ }
2215
+ if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
2216
+ ctx.addIssue({
2217
+ code: "custom",
2218
+ path: ["mode"],
2219
+ message: "issuer-signed publication cannot include signing-authority fields"
2220
+ });
2221
+ }
2222
+ if (input.mode === "signing-authority") {
2223
+ if (input.signedCredential !== void 0) {
2224
+ ctx.addIssue({
2225
+ code: "custom",
2226
+ path: ["signedCredential"],
2227
+ message: "signing-authority publication cannot include signedCredential"
2228
+ });
2229
+ }
2230
+ if (!input.credential) {
2231
+ ctx.addIssue({
2232
+ code: "custom",
2233
+ path: ["credential"],
2234
+ message: "credential is required for signing-authority publication"
2235
+ });
2236
+ }
2237
+ if (!input.signingAuthority) {
2238
+ ctx.addIssue({
2239
+ code: "custom",
2240
+ path: ["signingAuthority"],
2241
+ message: "signingAuthority is required for signing-authority publication"
2242
+ });
2243
+ }
2244
+ }
2245
+ });
2246
+ var PublishCredentialRefreshNotificationValidator = z14.enum([
2247
+ "queued",
2248
+ "suppressed",
2249
+ "not-applicable",
2250
+ /** Publication succeeded, but the post-commit notification enqueue must be retried. */
2251
+ "delivery-failed"
2252
+ ]);
2253
+ var PublishCredentialRefreshResultValidator = z14.object({
2254
+ refreshId: z14.string().min(1),
2255
+ version: z14.number().int().positive(),
2256
+ publishedAt: z14.string().min(1),
2257
+ notification: PublishCredentialRefreshNotificationValidator
2258
+ });
2259
+ var CredentialRefreshVersionMetadataValidator = z14.object({
2260
+ version: z14.number().int().positive(),
2261
+ publishedAt: z14.string().min(1),
2262
+ effectiveAt: z14.string().optional(),
2263
+ etag: z14.string().optional(),
2264
+ signingMode: CredentialRefreshSigningModeValidator.optional(),
2265
+ updateSummary: z14.string().optional()
2266
+ });
2267
+ var GetCredentialRefreshHistoryInputValidator = z14.object({
2268
+ refreshId: z14.string().min(1),
2269
+ cursor: z14.string().optional(),
2270
+ limit: z14.number().int().positive().optional()
2271
+ });
2272
+ var GetCredentialRefreshHistoryResultValidator = z14.object({
2273
+ records: CredentialRefreshVersionMetadataValidator.array(),
2274
+ hasMore: z14.boolean(),
2275
+ cursor: z14.string().optional()
2276
+ });
2277
+ var CredentialRefreshChallengeValidator = z14.object({
2278
+ challenge: z14.string().min(1),
2279
+ expiresAt: z14.string().min(1),
2280
+ domain: z14.string().optional(),
2281
+ scheme: z14.literal("LearnCardDIDAuth").optional()
2282
+ });
2283
+ var PublicCredentialRefreshEnvelopeValidator = z14.object({
2284
+ format: z14.literal("vc"),
2285
+ credential: VCValidator,
2286
+ etag: z14.string().optional()
2287
+ });
2288
+ var JweCredentialRefreshEnvelopeValidator = z14.object({
2289
+ format: z14.literal("jwe"),
2290
+ jwe: JWEValidator,
2291
+ etag: z14.string().optional(),
2292
+ /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
2293
+ version: z14.number().int().positive().optional()
2294
+ });
2295
+ var CredentialRefreshResponseEnvelopeValidator = z14.discriminatedUnion("format", [
2296
+ PublicCredentialRefreshEnvelopeValidator,
2297
+ JweCredentialRefreshEnvelopeValidator
2298
+ ]);
2299
+ var CredentialRefreshFailureCodeValidator = z14.enum([
2300
+ "UNAVAILABLE",
2301
+ "TIMEOUT",
2302
+ "UNSUPPORTED_SERVICE",
2303
+ "UNAUTHORIZED",
2304
+ "MALFORMED_RESPONSE",
2305
+ "INVALID_PROOF",
2306
+ "ISSUER_MISMATCH",
2307
+ "ID_MISMATCH",
2308
+ "ROLLBACK",
2309
+ "REVOKED",
2310
+ "UNSAFE_ENDPOINT"
2311
+ ]);
2312
+ var CredentialRefreshUpdatedResultValidator = z14.object({
2313
+ status: z14.literal("updated"),
2314
+ credential: VCValidator,
2315
+ etag: z14.string().optional(),
2316
+ managedVersion: z14.number().int().positive().optional()
2317
+ });
2318
+ var CredentialRefreshUnchangedResultValidator = z14.object({
2319
+ status: z14.literal("unchanged"),
2320
+ checkedAt: z14.string().min(1),
2321
+ etag: z14.string().optional()
2322
+ });
2323
+ var CredentialRefreshUnsupportedResultValidator = z14.object({
2324
+ status: z14.literal("unsupported")
2325
+ });
2326
+ var CredentialRefreshFailedResultValidator = z14.object({
2327
+ status: z14.literal("failed"),
2328
+ code: CredentialRefreshFailureCodeValidator,
2329
+ retryable: z14.boolean()
2330
+ });
2331
+ var CredentialRefreshResultValidator = z14.discriminatedUnion("status", [
2332
+ CredentialRefreshUpdatedResultValidator,
2333
+ CredentialRefreshUnchangedResultValidator,
2334
+ CredentialRefreshUnsupportedResultValidator,
2335
+ CredentialRefreshFailedResultValidator
2336
+ ]);
2136
2337
  export {
2137
2338
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
2138
2339
  AchievementCredentialValidator,
@@ -2145,6 +2346,8 @@ export {
2145
2346
  AgeRatingValidator,
2146
2347
  AlignmentTargetTypeValidator,
2147
2348
  AlignmentValidator,
2349
+ AllocateCredentialRefreshInputValidator,
2350
+ AllocateCredentialRefreshResultValidator,
2148
2351
  AllocateCredentialStatusInputValidator,
2149
2352
  AllocatedBitstringStatusListEntryValidator,
2150
2353
  AllowConnectionRequestsEnum,
@@ -2226,6 +2429,16 @@ export {
2226
2429
  CredentialInfoValidator,
2227
2430
  CredentialNameRefValidator,
2228
2431
  CredentialRecordValidator,
2432
+ CredentialRefreshChallengeValidator,
2433
+ CredentialRefreshFailedResultValidator,
2434
+ CredentialRefreshFailureCodeValidator,
2435
+ CredentialRefreshResponseEnvelopeValidator,
2436
+ CredentialRefreshResultValidator,
2437
+ CredentialRefreshSigningModeValidator,
2438
+ CredentialRefreshUnchangedResultValidator,
2439
+ CredentialRefreshUnsupportedResultValidator,
2440
+ CredentialRefreshUpdatedResultValidator,
2441
+ CredentialRefreshVersionMetadataValidator,
2229
2442
  CredentialSchemaValidator,
2230
2443
  CredentialStatusValidator,
2231
2444
  CredentialSubjectValidator,
@@ -2246,6 +2459,8 @@ export {
2246
2459
  GeoCoordinatesValidator,
2247
2460
  GetCounterEventValidator,
2248
2461
  GetCountersEventValidator,
2462
+ GetCredentialRefreshHistoryInputValidator,
2463
+ GetCredentialRefreshHistoryResultValidator,
2249
2464
  GetFullSkillTreeInputValidator,
2250
2465
  GetFullSkillTreeResultValidator,
2251
2466
  GetSkillPathInputValidator,
@@ -2270,6 +2485,7 @@ export {
2270
2485
  JWEValidator,
2271
2486
  JWKValidator,
2272
2487
  JWKWithPrivateKeyValidator,
2488
+ JweCredentialRefreshEnvelopeValidator,
2273
2489
  KnownAchievementTypeValidator,
2274
2490
  LCNAuthedProfileValidator,
2275
2491
  LCNBoostClaimLinkOptionsValidator,
@@ -2307,7 +2523,9 @@ export {
2307
2523
  LCNSigningAuthorityValidator,
2308
2524
  LCNVisibleProfileValidator,
2309
2525
  LaunchTypeValidator,
2526
+ LearnCardRefreshAuthorizationValidator,
2310
2527
  LinkProviderFrameworkInputValidator,
2528
+ ManagedCredentialRefreshServiceValidator,
2311
2529
  PaginatedAppStoreListingsValidator,
2312
2530
  PaginatedBoostRecipientsValidator,
2313
2531
  PaginatedBoostRecipientsWithChildrenValidator,
@@ -2337,6 +2555,12 @@ export {
2337
2555
  ProfileVisibilityEnum,
2338
2556
  PromotionLevelValidator,
2339
2557
  ProofValidator,
2558
+ PublicCredentialRefreshEnvelopeValidator,
2559
+ PublishCredentialRefreshInputValidator,
2560
+ PublishCredentialRefreshNotificationValidator,
2561
+ PublishCredentialRefreshResultValidator,
2562
+ PublishIssuerSignedRefreshValidator,
2563
+ PublishSigningAuthorityRefreshValidator,
2340
2564
  RefreshServiceValidator,
2341
2565
  RegExpValidator,
2342
2566
  RelatedValidator,
@@ -2377,11 +2601,13 @@ export {
2377
2601
  SkillTreeNodeInputValidator,
2378
2602
  SkillTreeNodeValidator,
2379
2603
  SkillValidator,
2604
+ StandardCredentialRefreshServiceValidator,
2380
2605
  StatusCheckEntryValidator,
2381
2606
  StoredCredentialEnvelopeValidator,
2382
2607
  StringQuery,
2383
2608
  SummaryCredentialDataValidator,
2384
2609
  SummaryCredentialKeywordValidator,
2610
+ SupportedCredentialRefreshServiceValidator,
2385
2611
  SyncFrameworkInputValidator,
2386
2612
  TagValidator,
2387
2613
  TemplateRenderMethodValidator,