@learncard/types 5.18.2 → 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
@@ -708,7 +708,8 @@ var LCNAuthedProfileValidator = LCNPublicProfileValidator.extend({
708
708
  did: LCNProfileValidator.shape.did
709
709
  });
710
710
  var LCNConnectionProfileValidator = LCNAuthedProfileValidator.extend({
711
- email: LCNProfileValidator.shape.email
711
+ email: LCNProfileValidator.shape.email,
712
+ connectedAt: z11.iso.datetime().optional().describe("When the viewer and this profile became connected.")
712
713
  });
713
714
  var LCNVisibleProfileValidator = z11.union([
714
715
  LCNConnectionProfileValidator.strict(),
@@ -941,7 +942,10 @@ var SendOptionsValidator = z11.object({
941
942
  webhookUrl: z11.string().url().optional().describe("Webhook URL to receive claim notifications"),
942
943
  suppressDelivery: z11.boolean().optional().describe("If true, returns claimUrl without sending email/SMS"),
943
944
  branding: SendBrandingOptionsValidator.optional().describe("Branding for email/SMS delivery"),
944
- 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
+ )
945
949
  });
946
950
  var SendBoostInputValidator = z11.object({
947
951
  type: z11.literal("boost"),
@@ -1236,7 +1240,8 @@ var LCNNotificationTypeEnumValidator = z11.enum([
1236
1240
  "APP_NOTIFICATION",
1237
1241
  "CREDENTIAL_REVOKED",
1238
1242
  "CREDENTIAL_SUSPENDED",
1239
- "CREDENTIAL_UNSUSPENDED"
1243
+ "CREDENTIAL_UNSUSPENDED",
1244
+ "CREDENTIAL_REFRESHED"
1240
1245
  ]);
1241
1246
  var LCNNotificationMessageValidator = z11.object({
1242
1247
  title: z11.string().optional(),
@@ -1368,12 +1373,16 @@ var CreateContactMethodSessionResponseValidator = z11.object({
1368
1373
  });
1369
1374
  var InboxCredentialValidator = z11.object({
1370
1375
  id: z11.string(),
1371
- credential: z11.string(),
1376
+ credential: z11.string().optional(),
1372
1377
  isSigned: z11.boolean(),
1373
1378
  currentStatus: LCNInboxStatusEnumValidator,
1374
1379
  isAccepted: z11.boolean().optional(),
1375
1380
  expiresAt: z11.string(),
1376
1381
  createdAt: z11.string(),
1382
+ finalizedAt: z11.string().optional(),
1383
+ expiredAt: z11.string().optional(),
1384
+ credentialName: z11.string().optional(),
1385
+ achievementType: z11.string().optional(),
1377
1386
  issuerDid: z11.string(),
1378
1387
  webhookUrl: z11.string().optional(),
1379
1388
  boostUri: z11.string().optional(),
@@ -1427,7 +1436,9 @@ var IssueInboxCredentialValidator = z11.object({
1427
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."
1428
1437
  ),
1429
1438
  webhookUrl: z11.string().url().optional().describe("The webhook URL to receive credential issuance events."),
1430
- 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
+ ),
1431
1442
  templateData: z11.record(z11.string(), z11.unknown()).optional().describe(
1432
1443
  "Template data to render into the boost credential template using Mustache syntax. Only used when boostUri is provided."
1433
1444
  ),
@@ -1490,6 +1501,9 @@ var ClaimInboxCredentialValidator = z11.object({
1490
1501
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
1491
1502
  configuration: z11.object({
1492
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
+ ),
1493
1507
  signingAuthorityName: z11.string().optional(),
1494
1508
  listingId: z11.string().optional(),
1495
1509
  listingSlug: z11.string().optional()
@@ -2132,6 +2146,194 @@ var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
2132
2146
  const result = inAppMessagesFlagValidator.safeParse(raw);
2133
2147
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
2134
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
+ ]);
2135
2337
  export {
2136
2338
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
2137
2339
  AchievementCredentialValidator,
@@ -2144,6 +2346,8 @@ export {
2144
2346
  AgeRatingValidator,
2145
2347
  AlignmentTargetTypeValidator,
2146
2348
  AlignmentValidator,
2349
+ AllocateCredentialRefreshInputValidator,
2350
+ AllocateCredentialRefreshResultValidator,
2147
2351
  AllocateCredentialStatusInputValidator,
2148
2352
  AllocatedBitstringStatusListEntryValidator,
2149
2353
  AllowConnectionRequestsEnum,
@@ -2225,6 +2429,16 @@ export {
2225
2429
  CredentialInfoValidator,
2226
2430
  CredentialNameRefValidator,
2227
2431
  CredentialRecordValidator,
2432
+ CredentialRefreshChallengeValidator,
2433
+ CredentialRefreshFailedResultValidator,
2434
+ CredentialRefreshFailureCodeValidator,
2435
+ CredentialRefreshResponseEnvelopeValidator,
2436
+ CredentialRefreshResultValidator,
2437
+ CredentialRefreshSigningModeValidator,
2438
+ CredentialRefreshUnchangedResultValidator,
2439
+ CredentialRefreshUnsupportedResultValidator,
2440
+ CredentialRefreshUpdatedResultValidator,
2441
+ CredentialRefreshVersionMetadataValidator,
2228
2442
  CredentialSchemaValidator,
2229
2443
  CredentialStatusValidator,
2230
2444
  CredentialSubjectValidator,
@@ -2245,6 +2459,8 @@ export {
2245
2459
  GeoCoordinatesValidator,
2246
2460
  GetCounterEventValidator,
2247
2461
  GetCountersEventValidator,
2462
+ GetCredentialRefreshHistoryInputValidator,
2463
+ GetCredentialRefreshHistoryResultValidator,
2248
2464
  GetFullSkillTreeInputValidator,
2249
2465
  GetFullSkillTreeResultValidator,
2250
2466
  GetSkillPathInputValidator,
@@ -2269,6 +2485,7 @@ export {
2269
2485
  JWEValidator,
2270
2486
  JWKValidator,
2271
2487
  JWKWithPrivateKeyValidator,
2488
+ JweCredentialRefreshEnvelopeValidator,
2272
2489
  KnownAchievementTypeValidator,
2273
2490
  LCNAuthedProfileValidator,
2274
2491
  LCNBoostClaimLinkOptionsValidator,
@@ -2306,7 +2523,9 @@ export {
2306
2523
  LCNSigningAuthorityValidator,
2307
2524
  LCNVisibleProfileValidator,
2308
2525
  LaunchTypeValidator,
2526
+ LearnCardRefreshAuthorizationValidator,
2309
2527
  LinkProviderFrameworkInputValidator,
2528
+ ManagedCredentialRefreshServiceValidator,
2310
2529
  PaginatedAppStoreListingsValidator,
2311
2530
  PaginatedBoostRecipientsValidator,
2312
2531
  PaginatedBoostRecipientsWithChildrenValidator,
@@ -2336,6 +2555,12 @@ export {
2336
2555
  ProfileVisibilityEnum,
2337
2556
  PromotionLevelValidator,
2338
2557
  ProofValidator,
2558
+ PublicCredentialRefreshEnvelopeValidator,
2559
+ PublishCredentialRefreshInputValidator,
2560
+ PublishCredentialRefreshNotificationValidator,
2561
+ PublishCredentialRefreshResultValidator,
2562
+ PublishIssuerSignedRefreshValidator,
2563
+ PublishSigningAuthorityRefreshValidator,
2339
2564
  RefreshServiceValidator,
2340
2565
  RegExpValidator,
2341
2566
  RelatedValidator,
@@ -2376,11 +2601,13 @@ export {
2376
2601
  SkillTreeNodeInputValidator,
2377
2602
  SkillTreeNodeValidator,
2378
2603
  SkillValidator,
2604
+ StandardCredentialRefreshServiceValidator,
2379
2605
  StatusCheckEntryValidator,
2380
2606
  StoredCredentialEnvelopeValidator,
2381
2607
  StringQuery,
2382
2608
  SummaryCredentialDataValidator,
2383
2609
  SummaryCredentialKeywordValidator,
2610
+ SupportedCredentialRefreshServiceValidator,
2384
2611
  SyncFrameworkInputValidator,
2385
2612
  TagValidator,
2386
2613
  TemplateRenderMethodValidator,