@learncard/sss-key-manager 0.1.23 → 0.1.24

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.
@@ -55,6 +55,7 @@ var require_types_cjs_development = __commonJS({
55
55
  var __toCommonJS2 = /* @__PURE__ */ __name((mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod), "__toCommonJS");
56
56
  var index_exports2 = {};
57
57
  __export2(index_exports2, {
58
+ ACT_AS_HEADER: /* @__PURE__ */ __name(() => ACT_AS_HEADER, "ACT_AS_HEADER"),
58
59
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: /* @__PURE__ */ __name(() => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX, "AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX"),
59
60
  AchievementCredentialValidator: /* @__PURE__ */ __name(() => AchievementCredentialValidator, "AchievementCredentialValidator"),
60
61
  AchievementCriteriaValidator: /* @__PURE__ */ __name(() => AchievementCriteriaValidator, "AchievementCriteriaValidator"),
@@ -194,10 +195,18 @@ var require_types_cjs_development = __commonJS({
194
195
  IdentifierTypeValidator: /* @__PURE__ */ __name(() => IdentifierTypeValidator, "IdentifierTypeValidator"),
195
196
  IdentityObjectValidator: /* @__PURE__ */ __name(() => IdentityObjectValidator, "IdentityObjectValidator"),
196
197
  ImageValidator: /* @__PURE__ */ __name(() => ImageValidator, "ImageValidator"),
198
+ InboxBatchErrorReasonValidator: /* @__PURE__ */ __name(() => InboxBatchErrorReasonValidator, "InboxBatchErrorReasonValidator"),
199
+ InboxBatchReceiptValidator: /* @__PURE__ */ __name(() => InboxBatchReceiptValidator, "InboxBatchReceiptValidator"),
200
+ InboxBatchStatusValidator: /* @__PURE__ */ __name(() => InboxBatchStatusValidator, "InboxBatchStatusValidator"),
197
201
  InboxCredentialQueryValidator: /* @__PURE__ */ __name(() => InboxCredentialQueryValidator, "InboxCredentialQueryValidator"),
202
+ InboxCredentialRefreshReceiptValidator: /* @__PURE__ */ __name(() => InboxCredentialRefreshReceiptValidator, "InboxCredentialRefreshReceiptValidator"),
198
203
  InboxCredentialValidator: /* @__PURE__ */ __name(() => InboxCredentialValidator, "InboxCredentialValidator"),
199
204
  IncrementCounterEventValidator: /* @__PURE__ */ __name(() => IncrementCounterEventValidator, "IncrementCounterEventValidator"),
200
205
  InstalledAppValidator: /* @__PURE__ */ __name(() => InstalledAppValidator, "InstalledAppValidator"),
206
+ IssueInboxCredentialBatchItemResultValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchItemResultValidator, "IssueInboxCredentialBatchItemResultValidator"),
207
+ IssueInboxCredentialBatchItemValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchItemValidator, "IssueInboxCredentialBatchItemValidator"),
208
+ IssueInboxCredentialBatchResponseValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchResponseValidator, "IssueInboxCredentialBatchResponseValidator"),
209
+ IssueInboxCredentialBatchValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchValidator, "IssueInboxCredentialBatchValidator"),
201
210
  IssueInboxCredentialResponseValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialResponseValidator, "IssueInboxCredentialResponseValidator"),
202
211
  IssueInboxCredentialValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialValidator, "IssueInboxCredentialValidator"),
203
212
  IssueInboxSigningAuthorityValidator: /* @__PURE__ */ __name(() => IssueInboxSigningAuthorityValidator, "IssueInboxSigningAuthorityValidator"),
@@ -246,6 +255,7 @@ var require_types_cjs_development = __commonJS({
246
255
  LaunchTypeValidator: /* @__PURE__ */ __name(() => LaunchTypeValidator, "LaunchTypeValidator"),
247
256
  LearnCardRefreshAuthorizationValidator: /* @__PURE__ */ __name(() => LearnCardRefreshAuthorizationValidator, "LearnCardRefreshAuthorizationValidator"),
248
257
  LinkProviderFrameworkInputValidator: /* @__PURE__ */ __name(() => LinkProviderFrameworkInputValidator, "LinkProviderFrameworkInputValidator"),
258
+ ManagedCredentialRefreshReceiptValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshReceiptValidator, "ManagedCredentialRefreshReceiptValidator"),
249
259
  ManagedCredentialRefreshServiceValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshServiceValidator, "ManagedCredentialRefreshServiceValidator"),
250
260
  PaginatedAppStoreListingsValidator: /* @__PURE__ */ __name(() => PaginatedAppStoreListingsValidator, "PaginatedAppStoreListingsValidator"),
251
261
  PaginatedBoostRecipientsValidator: /* @__PURE__ */ __name(() => PaginatedBoostRecipientsValidator, "PaginatedBoostRecipientsValidator"),
@@ -272,6 +282,8 @@ var require_types_cjs_development = __commonJS({
272
282
  PaginatedVisibleLCNProfilesValidator: /* @__PURE__ */ __name(() => PaginatedVisibleLCNProfilesValidator, "PaginatedVisibleLCNProfilesValidator"),
273
283
  PaginationOptionsValidator: /* @__PURE__ */ __name(() => PaginationOptionsValidator, "PaginationOptionsValidator"),
274
284
  PaginationResponseValidator: /* @__PURE__ */ __name(() => PaginationResponseValidator, "PaginationResponseValidator"),
285
+ PrepareRefreshableSendInputValidator: /* @__PURE__ */ __name(() => PrepareRefreshableSendInputValidator, "PrepareRefreshableSendInputValidator"),
286
+ PrepareRefreshableSendResultValidator: /* @__PURE__ */ __name(() => PrepareRefreshableSendResultValidator, "PrepareRefreshableSendResultValidator"),
275
287
  ProfileValidator: /* @__PURE__ */ __name(() => ProfileValidator, "ProfileValidator"),
276
288
  ProfileVisibilityEnum: /* @__PURE__ */ __name(() => ProfileVisibilityEnum, "ProfileVisibilityEnum"),
277
289
  PromotionLevelValidator: /* @__PURE__ */ __name(() => PromotionLevelValidator, "PromotionLevelValidator"),
@@ -297,6 +309,7 @@ var require_types_cjs_development = __commonJS({
297
309
  SendAiSessionCredentialEventValidator: /* @__PURE__ */ __name(() => SendAiSessionCredentialEventValidator, "SendAiSessionCredentialEventValidator"),
298
310
  SendBoostInputValidator: /* @__PURE__ */ __name(() => SendBoostInputValidator, "SendBoostInputValidator"),
299
311
  SendBoostResponseValidator: /* @__PURE__ */ __name(() => SendBoostResponseValidator, "SendBoostResponseValidator"),
312
+ SendBoostTemplateValidator: /* @__PURE__ */ __name(() => SendBoostTemplateValidator, "SendBoostTemplateValidator"),
300
313
  SendBrandingOptionsValidator: /* @__PURE__ */ __name(() => SendBrandingOptionsValidator, "SendBrandingOptionsValidator"),
301
314
  SendCredentialEventValidator: /* @__PURE__ */ __name(() => SendCredentialEventValidator, "SendCredentialEventValidator"),
302
315
  SendInboxResponseValidator: /* @__PURE__ */ __name(() => SendInboxResponseValidator, "SendInboxResponseValidator"),
@@ -16221,6 +16234,204 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16221
16234
  $or: BaseStringQuery.array()
16222
16235
  })
16223
16236
  ]);
16237
+ var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
16238
+ var ManagedCredentialRefreshServiceValidator = external_exports.object({
16239
+ id: external_exports.string().min(1),
16240
+ type: external_exports.literal("LearnCardCredentialRefresh2026"),
16241
+ authorization: LearnCardRefreshAuthorizationValidator.optional()
16242
+ }).catchall(external_exports.any());
16243
+ var StandardCredentialRefreshServiceValidator = external_exports.object({
16244
+ id: external_exports.string().min(1),
16245
+ type: external_exports.literal("1EdTechCredentialRefresh")
16246
+ }).catchall(external_exports.any());
16247
+ var SupportedCredentialRefreshServiceValidator = external_exports.union([
16248
+ ManagedCredentialRefreshServiceValidator,
16249
+ StandardCredentialRefreshServiceValidator
16250
+ ]);
16251
+ var AllocateCredentialRefreshInputValidator = external_exports.object({
16252
+ holder: external_exports.object({
16253
+ profileId: external_exports.string().optional(),
16254
+ did: external_exports.string().min(1)
16255
+ }),
16256
+ credentialId: external_exports.string().min(1)
16257
+ });
16258
+ var AllocateCredentialRefreshResultValidator = external_exports.object({
16259
+ refreshId: external_exports.string().min(1),
16260
+ refreshService: ManagedCredentialRefreshServiceValidator.extend({
16261
+ authorization: LearnCardRefreshAuthorizationValidator
16262
+ })
16263
+ });
16264
+ var ManagedCredentialRefreshReceiptValidator = external_exports.object({
16265
+ refreshId: external_exports.string().min(1),
16266
+ refreshService: ManagedCredentialRefreshServiceValidator,
16267
+ credentialId: external_exports.string().min(1),
16268
+ issuerDid: external_exports.string().min(1),
16269
+ holderDid: external_exports.string().min(1),
16270
+ credentialStatus: CredentialStatusValidator.or(
16271
+ CredentialStatusValidator.array()
16272
+ ).optional()
16273
+ }).strip();
16274
+ var InboxCredentialRefreshReceiptValidator = ManagedCredentialRefreshReceiptValidator.omit(
16275
+ { holderDid: true }
16276
+ ).extend({ holderDid: external_exports.string().min(1).optional() });
16277
+ var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
16278
+ var PublishCredentialRefreshBaseFields = {
16279
+ refreshId: external_exports.string().min(1),
16280
+ notifyHolder: external_exports.boolean().optional(),
16281
+ updateSummary: external_exports.string().optional(),
16282
+ idempotencyKey: external_exports.string().optional()
16283
+ };
16284
+ var PublishIssuerSignedRefreshValidator = external_exports.object({
16285
+ ...PublishCredentialRefreshBaseFields,
16286
+ mode: external_exports.literal("issuer-signed"),
16287
+ signedCredential: VCValidator
16288
+ });
16289
+ var PublishSigningAuthorityRefreshValidator = external_exports.object({
16290
+ ...PublishCredentialRefreshBaseFields,
16291
+ mode: external_exports.literal("signing-authority"),
16292
+ credential: UnsignedVCValidator,
16293
+ signingAuthority: external_exports.object({
16294
+ type: external_exports.string().min(1)
16295
+ }).catchall(external_exports.any())
16296
+ });
16297
+ var PublishCredentialRefreshInputValidator = external_exports.object({
16298
+ ...PublishCredentialRefreshBaseFields,
16299
+ mode: CredentialRefreshSigningModeValidator,
16300
+ signedCredential: VCValidator.optional(),
16301
+ credential: UnsignedVCValidator.optional(),
16302
+ signingAuthority: external_exports.object({
16303
+ type: external_exports.string().min(1)
16304
+ }).catchall(external_exports.any()).optional()
16305
+ }).superRefine((input, ctx) => {
16306
+ if (input.mode === "issuer-signed" && !input.signedCredential) {
16307
+ ctx.addIssue({
16308
+ code: "custom",
16309
+ path: ["signedCredential"],
16310
+ message: "signedCredential is required for issuer-signed publication"
16311
+ });
16312
+ }
16313
+ if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
16314
+ ctx.addIssue({
16315
+ code: "custom",
16316
+ path: ["mode"],
16317
+ message: "issuer-signed publication cannot include signing-authority fields"
16318
+ });
16319
+ }
16320
+ if (input.mode === "signing-authority") {
16321
+ if (input.signedCredential !== void 0) {
16322
+ ctx.addIssue({
16323
+ code: "custom",
16324
+ path: ["signedCredential"],
16325
+ message: "signing-authority publication cannot include signedCredential"
16326
+ });
16327
+ }
16328
+ if (!input.credential) {
16329
+ ctx.addIssue({
16330
+ code: "custom",
16331
+ path: ["credential"],
16332
+ message: "credential is required for signing-authority publication"
16333
+ });
16334
+ }
16335
+ if (!input.signingAuthority) {
16336
+ ctx.addIssue({
16337
+ code: "custom",
16338
+ path: ["signingAuthority"],
16339
+ message: "signingAuthority is required for signing-authority publication"
16340
+ });
16341
+ }
16342
+ }
16343
+ });
16344
+ var PublishCredentialRefreshNotificationValidator = external_exports.enum([
16345
+ "queued",
16346
+ "suppressed",
16347
+ "not-applicable",
16348
+ /** Publication succeeded, but the post-commit notification enqueue must be retried. */
16349
+ "delivery-failed"
16350
+ ]);
16351
+ var PublishCredentialRefreshResultValidator = external_exports.object({
16352
+ refreshId: external_exports.string().min(1),
16353
+ version: external_exports.number().int().positive(),
16354
+ publishedAt: external_exports.string().min(1),
16355
+ notification: PublishCredentialRefreshNotificationValidator
16356
+ });
16357
+ var CredentialRefreshVersionMetadataValidator = external_exports.object({
16358
+ version: external_exports.number().int().positive(),
16359
+ publishedAt: external_exports.string().min(1),
16360
+ effectiveAt: external_exports.string().optional(),
16361
+ etag: external_exports.string().optional(),
16362
+ signingMode: CredentialRefreshSigningModeValidator.optional(),
16363
+ updateSummary: external_exports.string().optional()
16364
+ });
16365
+ var GetCredentialRefreshHistoryInputValidator = external_exports.object({
16366
+ refreshId: external_exports.string().min(1),
16367
+ cursor: external_exports.string().optional(),
16368
+ limit: external_exports.number().int().positive().optional()
16369
+ });
16370
+ var GetCredentialRefreshHistoryResultValidator = external_exports.object({
16371
+ records: CredentialRefreshVersionMetadataValidator.array(),
16372
+ hasMore: external_exports.boolean(),
16373
+ cursor: external_exports.string().optional()
16374
+ });
16375
+ var CredentialRefreshChallengeValidator = external_exports.object({
16376
+ challenge: external_exports.string().min(1),
16377
+ expiresAt: external_exports.string().min(1),
16378
+ domain: external_exports.string().optional(),
16379
+ scheme: external_exports.literal("LearnCardDIDAuth").optional()
16380
+ });
16381
+ var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
16382
+ format: external_exports.literal("vc"),
16383
+ credential: VCValidator,
16384
+ etag: external_exports.string().optional()
16385
+ });
16386
+ var JweCredentialRefreshEnvelopeValidator = external_exports.object({
16387
+ format: external_exports.literal("jwe"),
16388
+ jwe: JWEValidator,
16389
+ etag: external_exports.string().optional(),
16390
+ /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
16391
+ version: external_exports.number().int().positive().optional()
16392
+ });
16393
+ var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
16394
+ PublicCredentialRefreshEnvelopeValidator,
16395
+ JweCredentialRefreshEnvelopeValidator
16396
+ ]);
16397
+ var CredentialRefreshFailureCodeValidator = external_exports.enum([
16398
+ "UNAVAILABLE",
16399
+ "TIMEOUT",
16400
+ "UNSUPPORTED_SERVICE",
16401
+ "UNAUTHORIZED",
16402
+ "MALFORMED_RESPONSE",
16403
+ "INVALID_PROOF",
16404
+ "ISSUER_MISMATCH",
16405
+ "ID_MISMATCH",
16406
+ "ROLLBACK",
16407
+ "REVOKED",
16408
+ "UNSAFE_ENDPOINT"
16409
+ ]);
16410
+ var CredentialRefreshUpdatedResultValidator = external_exports.object({
16411
+ status: external_exports.literal("updated"),
16412
+ credential: VCValidator,
16413
+ etag: external_exports.string().optional(),
16414
+ managedVersion: external_exports.number().int().positive().optional()
16415
+ });
16416
+ var CredentialRefreshUnchangedResultValidator = external_exports.object({
16417
+ status: external_exports.literal("unchanged"),
16418
+ checkedAt: external_exports.string().min(1),
16419
+ etag: external_exports.string().optional()
16420
+ });
16421
+ var CredentialRefreshUnsupportedResultValidator = external_exports.object({
16422
+ status: external_exports.literal("unsupported")
16423
+ });
16424
+ var CredentialRefreshFailedResultValidator = external_exports.object({
16425
+ status: external_exports.literal("failed"),
16426
+ code: CredentialRefreshFailureCodeValidator,
16427
+ retryable: external_exports.boolean()
16428
+ });
16429
+ var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
16430
+ CredentialRefreshUpdatedResultValidator,
16431
+ CredentialRefreshUnchangedResultValidator,
16432
+ CredentialRefreshUnsupportedResultValidator,
16433
+ CredentialRefreshFailedResultValidator
16434
+ ]);
16224
16435
  var LCNProfileDisplayValidator = external_exports.object({
16225
16436
  backgroundColor: external_exports.string().optional(),
16226
16437
  backgroundImage: external_exports.string().optional(),
@@ -16556,7 +16767,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16556
16767
  "Options for email/phone recipients (Universal Inbox)"
16557
16768
  ),
16558
16769
  templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16559
- integrationId: external_exports.string().optional().describe("Integration ID for activity tracking")
16770
+ integrationId: external_exports.string().optional().describe("Integration ID for activity tracking"),
16771
+ refresh: external_exports.boolean().optional().describe(
16772
+ "Request managed credential refresh for this send. Profile/DID recipients use immediate issuance; email/phone recipients use deferred Universal Inbox signing and bind the holder at claim."
16773
+ ),
16774
+ idempotencyKey: external_exports.string().min(1).max(200).optional().describe(
16775
+ "Caller-chosen key that makes a managed refresh send (refresh: true) safe to retry as a whole: retries with the same key reuse the same boost, refresh allocation and result. Reusing a key for a different request is rejected. With signedCredential, requires prior tRPC prepareRefreshableSend; direct REST callers omit the key and retry the exact signed credential and templateUri."
16776
+ )
16560
16777
  }).refine((data) => data.templateUri || data.template || data.signedCredential, {
16561
16778
  message: "Either templateUri, template, or signedCredential must be provided.",
16562
16779
  path: ["templateUri"]
@@ -16571,8 +16788,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16571
16788
  message: "guardianEmail must differ from recipient (self-approval not allowed)",
16572
16789
  path: ["options", "guardianEmail"]
16573
16790
  }
16574
- );
16791
+ ).refine((data) => !data.idempotencyKey || data.refresh === true, {
16792
+ message: "idempotencyKey is only supported with refresh: true.",
16793
+ path: ["idempotencyKey"]
16794
+ });
16575
16795
  var SendInboxResponseValidator = external_exports.object({
16796
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16576
16797
  issuanceId: external_exports.string(),
16577
16798
  status: external_exports.enum(["PENDING", "ISSUED", "EXPIRED", "DELIVERED", "CLAIMED"]),
16578
16799
  claimUrl: external_exports.string().url().optional().describe("Present when suppressDelivery=true"),
@@ -16587,8 +16808,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16587
16808
  activityId: external_exports.string().describe("Links to the activity lifecycle for this issuance"),
16588
16809
  inbox: SendInboxResponseValidator.optional().describe(
16589
16810
  "Present when sent via email/phone (Universal Inbox)"
16811
+ ),
16812
+ refresh: ManagedCredentialRefreshReceiptValidator.optional().describe(
16813
+ "Present when managed refresh was requested: issuance metadata the issuer keeps to publish future updates"
16590
16814
  )
16591
16815
  });
16816
+ var PrepareRefreshableSendInputValidator = external_exports.object({
16817
+ recipient: external_exports.string(),
16818
+ templateUri: external_exports.string().optional(),
16819
+ template: SendBoostTemplateValidator.optional(),
16820
+ contractUri: external_exports.string().optional(),
16821
+ templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16822
+ integrationId: external_exports.string().optional(),
16823
+ /** Credential ID to allocate for; generated server-side when omitted. */
16824
+ credentialId: external_exports.string().min(1).optional(),
16825
+ idempotencyKey: external_exports.string().min(1).max(200).optional()
16826
+ }).refine((data) => Boolean(data.templateUri) !== Boolean(data.template), {
16827
+ message: "Provide exactly one of templateUri or template."
16828
+ });
16829
+ var PrepareRefreshableSendResultValidator = external_exports.object({
16830
+ boostUri: external_exports.string(),
16831
+ credentialId: external_exports.string(),
16832
+ refreshId: external_exports.string(),
16833
+ refreshService: ManagedCredentialRefreshServiceValidator,
16834
+ /** The DID to use as credentialSubject.id (recipient DID, or the profile's did:web). */
16835
+ holderDid: external_exports.string(),
16836
+ /** Present when this idempotencyKey already completed: return it without signing. */
16837
+ completed: SendBoostResponseValidator.optional()
16838
+ });
16592
16839
  var SendInputValidator = external_exports.discriminatedUnion("type", [SendBoostInputValidator]);
16593
16840
  var SendResponseValidator = external_exports.discriminatedUnion("type", [SendBoostResponseValidator]);
16594
16841
  var ConsentFlowTermsStatusValidator = external_exports.enum(["live", "stale", "withdrawn"]);
@@ -16907,6 +17154,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16907
17154
  webhookUrl: external_exports.string().optional()
16908
17155
  });
16909
17156
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
17157
+ var ACT_AS_HEADER = "X-LearnCard-Act-As";
16910
17158
  var AuthGrantValidator = external_exports.object({
16911
17159
  id: external_exports.string(),
16912
17160
  name: external_exports.string(),
@@ -16919,6 +17167,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16919
17167
  }, "error")
16920
17168
  }),
16921
17169
  scope: external_exports.string(),
17170
+ actAs: external_exports.string().optional(),
16922
17171
  createdAt: external_exports.iso.datetime({ error: "createdAt must be a valid ISO 8601 datetime string" }),
16923
17172
  expiresAt: external_exports.iso.datetime({ error: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
16924
17173
  });
@@ -16990,6 +17239,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16990
17239
  sessionJwt: external_exports.string()
16991
17240
  });
16992
17241
  var InboxCredentialValidator = external_exports.object({
17242
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
17243
+ refreshId: external_exports.string().optional(),
16993
17244
  id: external_exports.string(),
16994
17245
  credential: external_exports.string().optional(),
16995
17246
  isSigned: external_exports.boolean(),
@@ -17044,12 +17295,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17044
17295
  templateUri: external_exports.string().optional().describe(
17045
17296
  "URI of a boost template to use for issuance. The boost credential will be resolved and used. Mutually exclusive with credential field."
17046
17297
  ),
17298
+ refresh: external_exports.boolean().optional().describe(
17299
+ "Allocate managed refresh before signing. Requires unsigned content and a registered signing authority; binds the holder on claim."
17300
+ ),
17301
+ idempotencyKey: external_exports.string().min(1).max(200).optional(),
17047
17302
  // === OPTIONAL FEATURES ===
17048
17303
  // Add major, distinct features at the top level.
17049
17304
  //consentRequest: ConsentRequestValidator.optional(),
17050
17305
  // === PROCESS CONFIGURATION (Optional) ===
17051
17306
  // HOW should this issuance be handled?
17052
17307
  configuration: external_exports.object({
17308
+ guardianEmail: external_exports.string().email().optional().describe(
17309
+ "Require approval from this guardian before the recipient can claim. Must differ from the recipient email."
17310
+ ),
17053
17311
  signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe(
17054
17312
  "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."
17055
17313
  ),
@@ -17103,17 +17361,130 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17103
17361
  }).optional().describe(
17104
17362
  "Configuration for the credential issuance. If not provided, the default configuration will be used."
17105
17363
  )
17364
+ }).refine((data) => !data.idempotencyKey || data.refresh === true, {
17365
+ message: "idempotencyKey requires refresh: true."
17106
17366
  }).refine((data) => data.credential || data.templateUri, {
17107
17367
  message: "Either credential or templateUri must be provided.",
17108
17368
  path: ["credential"]
17109
- });
17369
+ }).refine(
17370
+ (data) => !data.configuration?.guardianEmail || data.recipient.type !== "email" || data.configuration.guardianEmail.toLowerCase() !== data.recipient.value.toLowerCase(),
17371
+ {
17372
+ message: "guardianEmail must differ from recipient (self-approval not allowed)",
17373
+ path: ["configuration", "guardianEmail"]
17374
+ }
17375
+ );
17110
17376
  var IssueInboxCredentialResponseValidator = external_exports.object({
17377
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
17111
17378
  issuanceId: external_exports.string(),
17112
17379
  status: LCNInboxStatusEnumValidator,
17113
17380
  recipient: ContactMethodQueryValidator,
17114
17381
  claimUrl: external_exports.string().url().optional(),
17115
17382
  recipientDid: external_exports.string().optional()
17116
17383
  });
17384
+ var InboxBatchConfigurationValidator = IssueInboxCredentialValidator.shape.configuration.unwrap().extend({
17385
+ refresh: IssueInboxCredentialValidator.shape.refresh.describe(
17386
+ "Enable managed refresh by default. An item configuration.refresh overrides this value, including false."
17387
+ ),
17388
+ delivery: IssueInboxCredentialValidator.shape.configuration.unwrap().shape.delivery.unwrap().extend({ suppress: external_exports.boolean().optional() }).optional()
17389
+ });
17390
+ var InboxBatchItemConfigurationValidator = InboxBatchConfigurationValidator.extend({
17391
+ guardianEmail: InboxBatchConfigurationValidator.shape.guardianEmail.nullable().describe(
17392
+ "Require guardian approval, or set null to clear a batch-level guardianEmail for this item."
17393
+ )
17394
+ });
17395
+ var IssueInboxCredentialBatchItemValidator = external_exports.object({
17396
+ ...IssueInboxCredentialValidator.shape,
17397
+ configuration: InboxBatchItemConfigurationValidator.optional(),
17398
+ idempotencyKey: external_exports.string().max(256).optional()
17399
+ }).refine((data) => data.credential || data.templateUri, {
17400
+ message: "Either credential or templateUri must be provided.",
17401
+ path: ["credential"]
17402
+ }).describe(
17403
+ "One issuance: provide credential or templateUri. Invalid input is rejected at submission with its item index."
17404
+ );
17405
+ var IssueInboxCredentialBatchValidator = external_exports.object({
17406
+ requestId: external_exports.string().min(1).max(256).optional(),
17407
+ items: external_exports.array(IssueInboxCredentialBatchItemValidator).min(1).max(100),
17408
+ configuration: InboxBatchConfigurationValidator.optional()
17409
+ }).superRefine((batch, ctx) => {
17410
+ batch.items.forEach((item, index) => {
17411
+ const itemGuardian = item.configuration?.guardianEmail;
17412
+ const guardian = itemGuardian === null ? void 0 : itemGuardian ?? batch.configuration?.guardianEmail;
17413
+ if (guardian && item.recipient.type === "email" && guardian.toLowerCase() === item.recipient.value.toLowerCase()) {
17414
+ ctx.addIssue({
17415
+ code: "custom",
17416
+ path: ["items", index, "configuration", "guardianEmail"],
17417
+ message: "guardianEmail must differ from recipient (self-approval not allowed)"
17418
+ });
17419
+ }
17420
+ });
17421
+ });
17422
+ var InboxBatchErrorReasonValidator = external_exports.enum([
17423
+ "DUPLICATE_KEY",
17424
+ "IDEMPOTENCY_MISMATCH",
17425
+ "IN_PROGRESS",
17426
+ "UNCONFIRMED"
17427
+ ]);
17428
+ var IssueInboxCredentialBatchItemResultValidator = external_exports.discriminatedUnion("success", [
17429
+ IssueInboxCredentialResponseValidator.extend({
17430
+ success: external_exports.literal(true),
17431
+ index: external_exports.number().int().nonnegative(),
17432
+ deduplicated: external_exports.boolean().optional(),
17433
+ guardianStatus: GuardianStatusValidator.optional(),
17434
+ idempotencyKey: external_exports.string().optional()
17435
+ }),
17436
+ external_exports.object({
17437
+ success: external_exports.literal(false),
17438
+ index: external_exports.number().int().nonnegative(),
17439
+ idempotencyKey: external_exports.string().optional(),
17440
+ recipient: ContactMethodQueryValidator.optional(),
17441
+ error: external_exports.object({
17442
+ code: external_exports.string(),
17443
+ message: external_exports.string(),
17444
+ reason: InboxBatchErrorReasonValidator.optional()
17445
+ }),
17446
+ issuanceId: external_exports.string().optional().describe(
17447
+ "Present when issuance completed but replay storage could not be confirmed. Reconcile this issuance; do not issue again with a new key."
17448
+ ),
17449
+ claimUrl: external_exports.string().url().optional().describe(
17450
+ "Claim URL of the completed issuance, if available, when replay storage could not be confirmed."
17451
+ )
17452
+ })
17453
+ ]);
17454
+ var IssueInboxCredentialBatchResponseValidator = external_exports.object({
17455
+ results: external_exports.array(IssueInboxCredentialBatchItemResultValidator),
17456
+ summary: external_exports.object({
17457
+ total: external_exports.number(),
17458
+ succeeded: external_exports.number(),
17459
+ failed: external_exports.number(),
17460
+ deduplicated: external_exports.number()
17461
+ })
17462
+ });
17463
+ var InboxBatchReceiptValidator = external_exports.object({
17464
+ batchId: external_exports.string(),
17465
+ status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17466
+ createdAt: external_exports.string()
17467
+ });
17468
+ var InboxBatchStatusValidator = external_exports.object({
17469
+ batchId: external_exports.string(),
17470
+ createdAt: external_exports.string(),
17471
+ done: external_exports.boolean().describe(
17472
+ "True when no queued or processing items remain, including unconfirmed outcomes."
17473
+ ),
17474
+ status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17475
+ items: external_exports.array(
17476
+ external_exports.object({
17477
+ index: external_exports.number().int().nonnegative(),
17478
+ state: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17479
+ result: IssueInboxCredentialBatchItemResultValidator.optional()
17480
+ })
17481
+ ),
17482
+ summary: IssueInboxCredentialBatchResponseValidator.shape.summary.extend({
17483
+ completed: external_exports.number(),
17484
+ pending: external_exports.number(),
17485
+ unconfirmed: external_exports.number()
17486
+ })
17487
+ });
17117
17488
  var CredentialNameRefValidator = external_exports.object({ name: external_exports.string() }).passthrough();
17118
17489
  var ClaimInboxCredentialValidator = external_exports.object({
17119
17490
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
@@ -17599,6 +17970,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17599
17970
  eventType: CredentialActivityEventTypeValidator,
17600
17971
  timestamp: external_exports.string(),
17601
17972
  actorProfileId: external_exports.string().optional(),
17973
+ onBehalfOf: external_exports.string().optional(),
17602
17974
  recipientType: CredentialActivityRecipientTypeValidator,
17603
17975
  recipientIdentifier: external_exports.string(),
17604
17976
  boostUri: external_exports.string().optional(),
@@ -17759,191 +18131,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17759
18131
  const result = inAppMessagesFlagValidator.safeParse(raw);
17760
18132
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
17761
18133
  }, "parseInAppMessagesFlag");
17762
- var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
17763
- var ManagedCredentialRefreshServiceValidator = external_exports.object({
17764
- id: external_exports.string().min(1),
17765
- type: external_exports.literal("LearnCardCredentialRefresh2026"),
17766
- authorization: LearnCardRefreshAuthorizationValidator.optional()
17767
- }).catchall(external_exports.any());
17768
- var StandardCredentialRefreshServiceValidator = external_exports.object({
17769
- id: external_exports.string().min(1),
17770
- type: external_exports.literal("1EdTechCredentialRefresh")
17771
- }).catchall(external_exports.any());
17772
- var SupportedCredentialRefreshServiceValidator = external_exports.union([
17773
- ManagedCredentialRefreshServiceValidator,
17774
- StandardCredentialRefreshServiceValidator
17775
- ]);
17776
- var AllocateCredentialRefreshInputValidator = external_exports.object({
17777
- holder: external_exports.object({
17778
- profileId: external_exports.string().optional(),
17779
- did: external_exports.string().min(1)
17780
- }),
17781
- credentialId: external_exports.string().min(1)
17782
- });
17783
- var AllocateCredentialRefreshResultValidator = external_exports.object({
17784
- refreshId: external_exports.string().min(1),
17785
- refreshService: ManagedCredentialRefreshServiceValidator.extend({
17786
- authorization: LearnCardRefreshAuthorizationValidator
17787
- })
17788
- });
17789
- var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
17790
- var PublishCredentialRefreshBaseFields = {
17791
- refreshId: external_exports.string().min(1),
17792
- notifyHolder: external_exports.boolean().optional(),
17793
- updateSummary: external_exports.string().optional(),
17794
- idempotencyKey: external_exports.string().optional()
17795
- };
17796
- var PublishIssuerSignedRefreshValidator = external_exports.object({
17797
- ...PublishCredentialRefreshBaseFields,
17798
- mode: external_exports.literal("issuer-signed"),
17799
- signedCredential: VCValidator
17800
- });
17801
- var PublishSigningAuthorityRefreshValidator = external_exports.object({
17802
- ...PublishCredentialRefreshBaseFields,
17803
- mode: external_exports.literal("signing-authority"),
17804
- credential: UnsignedVCValidator,
17805
- signingAuthority: external_exports.object({
17806
- type: external_exports.string().min(1)
17807
- }).catchall(external_exports.any())
17808
- });
17809
- var PublishCredentialRefreshInputValidator = external_exports.object({
17810
- ...PublishCredentialRefreshBaseFields,
17811
- mode: CredentialRefreshSigningModeValidator,
17812
- signedCredential: VCValidator.optional(),
17813
- credential: UnsignedVCValidator.optional(),
17814
- signingAuthority: external_exports.object({
17815
- type: external_exports.string().min(1)
17816
- }).catchall(external_exports.any()).optional()
17817
- }).superRefine((input, ctx) => {
17818
- if (input.mode === "issuer-signed" && !input.signedCredential) {
17819
- ctx.addIssue({
17820
- code: "custom",
17821
- path: ["signedCredential"],
17822
- message: "signedCredential is required for issuer-signed publication"
17823
- });
17824
- }
17825
- if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
17826
- ctx.addIssue({
17827
- code: "custom",
17828
- path: ["mode"],
17829
- message: "issuer-signed publication cannot include signing-authority fields"
17830
- });
17831
- }
17832
- if (input.mode === "signing-authority") {
17833
- if (input.signedCredential !== void 0) {
17834
- ctx.addIssue({
17835
- code: "custom",
17836
- path: ["signedCredential"],
17837
- message: "signing-authority publication cannot include signedCredential"
17838
- });
17839
- }
17840
- if (!input.credential) {
17841
- ctx.addIssue({
17842
- code: "custom",
17843
- path: ["credential"],
17844
- message: "credential is required for signing-authority publication"
17845
- });
17846
- }
17847
- if (!input.signingAuthority) {
17848
- ctx.addIssue({
17849
- code: "custom",
17850
- path: ["signingAuthority"],
17851
- message: "signingAuthority is required for signing-authority publication"
17852
- });
17853
- }
17854
- }
17855
- });
17856
- var PublishCredentialRefreshNotificationValidator = external_exports.enum([
17857
- "queued",
17858
- "suppressed",
17859
- "not-applicable",
17860
- /** Publication succeeded, but the post-commit notification enqueue must be retried. */
17861
- "delivery-failed"
17862
- ]);
17863
- var PublishCredentialRefreshResultValidator = external_exports.object({
17864
- refreshId: external_exports.string().min(1),
17865
- version: external_exports.number().int().positive(),
17866
- publishedAt: external_exports.string().min(1),
17867
- notification: PublishCredentialRefreshNotificationValidator
17868
- });
17869
- var CredentialRefreshVersionMetadataValidator = external_exports.object({
17870
- version: external_exports.number().int().positive(),
17871
- publishedAt: external_exports.string().min(1),
17872
- effectiveAt: external_exports.string().optional(),
17873
- etag: external_exports.string().optional(),
17874
- signingMode: CredentialRefreshSigningModeValidator.optional(),
17875
- updateSummary: external_exports.string().optional()
17876
- });
17877
- var GetCredentialRefreshHistoryInputValidator = external_exports.object({
17878
- refreshId: external_exports.string().min(1),
17879
- cursor: external_exports.string().optional(),
17880
- limit: external_exports.number().int().positive().optional()
17881
- });
17882
- var GetCredentialRefreshHistoryResultValidator = external_exports.object({
17883
- records: CredentialRefreshVersionMetadataValidator.array(),
17884
- hasMore: external_exports.boolean(),
17885
- cursor: external_exports.string().optional()
17886
- });
17887
- var CredentialRefreshChallengeValidator = external_exports.object({
17888
- challenge: external_exports.string().min(1),
17889
- expiresAt: external_exports.string().min(1),
17890
- domain: external_exports.string().optional(),
17891
- scheme: external_exports.literal("LearnCardDIDAuth").optional()
17892
- });
17893
- var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
17894
- format: external_exports.literal("vc"),
17895
- credential: VCValidator,
17896
- etag: external_exports.string().optional()
17897
- });
17898
- var JweCredentialRefreshEnvelopeValidator = external_exports.object({
17899
- format: external_exports.literal("jwe"),
17900
- jwe: JWEValidator,
17901
- etag: external_exports.string().optional(),
17902
- /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
17903
- version: external_exports.number().int().positive().optional()
17904
- });
17905
- var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
17906
- PublicCredentialRefreshEnvelopeValidator,
17907
- JweCredentialRefreshEnvelopeValidator
17908
- ]);
17909
- var CredentialRefreshFailureCodeValidator = external_exports.enum([
17910
- "UNAVAILABLE",
17911
- "TIMEOUT",
17912
- "UNSUPPORTED_SERVICE",
17913
- "UNAUTHORIZED",
17914
- "MALFORMED_RESPONSE",
17915
- "INVALID_PROOF",
17916
- "ISSUER_MISMATCH",
17917
- "ID_MISMATCH",
17918
- "ROLLBACK",
17919
- "REVOKED",
17920
- "UNSAFE_ENDPOINT"
17921
- ]);
17922
- var CredentialRefreshUpdatedResultValidator = external_exports.object({
17923
- status: external_exports.literal("updated"),
17924
- credential: VCValidator,
17925
- etag: external_exports.string().optional(),
17926
- managedVersion: external_exports.number().int().positive().optional()
17927
- });
17928
- var CredentialRefreshUnchangedResultValidator = external_exports.object({
17929
- status: external_exports.literal("unchanged"),
17930
- checkedAt: external_exports.string().min(1),
17931
- etag: external_exports.string().optional()
17932
- });
17933
- var CredentialRefreshUnsupportedResultValidator = external_exports.object({
17934
- status: external_exports.literal("unsupported")
17935
- });
17936
- var CredentialRefreshFailedResultValidator = external_exports.object({
17937
- status: external_exports.literal("failed"),
17938
- code: CredentialRefreshFailureCodeValidator,
17939
- retryable: external_exports.boolean()
17940
- });
17941
- var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
17942
- CredentialRefreshUpdatedResultValidator,
17943
- CredentialRefreshUnchangedResultValidator,
17944
- CredentialRefreshUnsupportedResultValidator,
17945
- CredentialRefreshFailedResultValidator
17946
- ]);
17947
18134
  }
17948
18135
  });
17949
18136