@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.
@@ -49,6 +49,7 @@ var require_types_cjs_development = __commonJS({
49
49
  var __toCommonJS = /* @__PURE__ */ __name((mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod), "__toCommonJS");
50
50
  var index_exports = {};
51
51
  __export(index_exports, {
52
+ ACT_AS_HEADER: /* @__PURE__ */ __name(() => ACT_AS_HEADER, "ACT_AS_HEADER"),
52
53
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: /* @__PURE__ */ __name(() => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX, "AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX"),
53
54
  AchievementCredentialValidator: /* @__PURE__ */ __name(() => AchievementCredentialValidator, "AchievementCredentialValidator"),
54
55
  AchievementCriteriaValidator: /* @__PURE__ */ __name(() => AchievementCriteriaValidator, "AchievementCriteriaValidator"),
@@ -188,10 +189,18 @@ var require_types_cjs_development = __commonJS({
188
189
  IdentifierTypeValidator: /* @__PURE__ */ __name(() => IdentifierTypeValidator, "IdentifierTypeValidator"),
189
190
  IdentityObjectValidator: /* @__PURE__ */ __name(() => IdentityObjectValidator, "IdentityObjectValidator"),
190
191
  ImageValidator: /* @__PURE__ */ __name(() => ImageValidator, "ImageValidator"),
192
+ InboxBatchErrorReasonValidator: /* @__PURE__ */ __name(() => InboxBatchErrorReasonValidator, "InboxBatchErrorReasonValidator"),
193
+ InboxBatchReceiptValidator: /* @__PURE__ */ __name(() => InboxBatchReceiptValidator, "InboxBatchReceiptValidator"),
194
+ InboxBatchStatusValidator: /* @__PURE__ */ __name(() => InboxBatchStatusValidator, "InboxBatchStatusValidator"),
191
195
  InboxCredentialQueryValidator: /* @__PURE__ */ __name(() => InboxCredentialQueryValidator, "InboxCredentialQueryValidator"),
196
+ InboxCredentialRefreshReceiptValidator: /* @__PURE__ */ __name(() => InboxCredentialRefreshReceiptValidator, "InboxCredentialRefreshReceiptValidator"),
192
197
  InboxCredentialValidator: /* @__PURE__ */ __name(() => InboxCredentialValidator, "InboxCredentialValidator"),
193
198
  IncrementCounterEventValidator: /* @__PURE__ */ __name(() => IncrementCounterEventValidator, "IncrementCounterEventValidator"),
194
199
  InstalledAppValidator: /* @__PURE__ */ __name(() => InstalledAppValidator, "InstalledAppValidator"),
200
+ IssueInboxCredentialBatchItemResultValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchItemResultValidator, "IssueInboxCredentialBatchItemResultValidator"),
201
+ IssueInboxCredentialBatchItemValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchItemValidator, "IssueInboxCredentialBatchItemValidator"),
202
+ IssueInboxCredentialBatchResponseValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchResponseValidator, "IssueInboxCredentialBatchResponseValidator"),
203
+ IssueInboxCredentialBatchValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialBatchValidator, "IssueInboxCredentialBatchValidator"),
195
204
  IssueInboxCredentialResponseValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialResponseValidator, "IssueInboxCredentialResponseValidator"),
196
205
  IssueInboxCredentialValidator: /* @__PURE__ */ __name(() => IssueInboxCredentialValidator, "IssueInboxCredentialValidator"),
197
206
  IssueInboxSigningAuthorityValidator: /* @__PURE__ */ __name(() => IssueInboxSigningAuthorityValidator, "IssueInboxSigningAuthorityValidator"),
@@ -240,6 +249,7 @@ var require_types_cjs_development = __commonJS({
240
249
  LaunchTypeValidator: /* @__PURE__ */ __name(() => LaunchTypeValidator, "LaunchTypeValidator"),
241
250
  LearnCardRefreshAuthorizationValidator: /* @__PURE__ */ __name(() => LearnCardRefreshAuthorizationValidator, "LearnCardRefreshAuthorizationValidator"),
242
251
  LinkProviderFrameworkInputValidator: /* @__PURE__ */ __name(() => LinkProviderFrameworkInputValidator, "LinkProviderFrameworkInputValidator"),
252
+ ManagedCredentialRefreshReceiptValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshReceiptValidator, "ManagedCredentialRefreshReceiptValidator"),
243
253
  ManagedCredentialRefreshServiceValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshServiceValidator, "ManagedCredentialRefreshServiceValidator"),
244
254
  PaginatedAppStoreListingsValidator: /* @__PURE__ */ __name(() => PaginatedAppStoreListingsValidator, "PaginatedAppStoreListingsValidator"),
245
255
  PaginatedBoostRecipientsValidator: /* @__PURE__ */ __name(() => PaginatedBoostRecipientsValidator, "PaginatedBoostRecipientsValidator"),
@@ -266,6 +276,8 @@ var require_types_cjs_development = __commonJS({
266
276
  PaginatedVisibleLCNProfilesValidator: /* @__PURE__ */ __name(() => PaginatedVisibleLCNProfilesValidator, "PaginatedVisibleLCNProfilesValidator"),
267
277
  PaginationOptionsValidator: /* @__PURE__ */ __name(() => PaginationOptionsValidator, "PaginationOptionsValidator"),
268
278
  PaginationResponseValidator: /* @__PURE__ */ __name(() => PaginationResponseValidator, "PaginationResponseValidator"),
279
+ PrepareRefreshableSendInputValidator: /* @__PURE__ */ __name(() => PrepareRefreshableSendInputValidator, "PrepareRefreshableSendInputValidator"),
280
+ PrepareRefreshableSendResultValidator: /* @__PURE__ */ __name(() => PrepareRefreshableSendResultValidator, "PrepareRefreshableSendResultValidator"),
269
281
  ProfileValidator: /* @__PURE__ */ __name(() => ProfileValidator, "ProfileValidator"),
270
282
  ProfileVisibilityEnum: /* @__PURE__ */ __name(() => ProfileVisibilityEnum, "ProfileVisibilityEnum"),
271
283
  PromotionLevelValidator: /* @__PURE__ */ __name(() => PromotionLevelValidator, "PromotionLevelValidator"),
@@ -291,6 +303,7 @@ var require_types_cjs_development = __commonJS({
291
303
  SendAiSessionCredentialEventValidator: /* @__PURE__ */ __name(() => SendAiSessionCredentialEventValidator, "SendAiSessionCredentialEventValidator"),
292
304
  SendBoostInputValidator: /* @__PURE__ */ __name(() => SendBoostInputValidator, "SendBoostInputValidator"),
293
305
  SendBoostResponseValidator: /* @__PURE__ */ __name(() => SendBoostResponseValidator, "SendBoostResponseValidator"),
306
+ SendBoostTemplateValidator: /* @__PURE__ */ __name(() => SendBoostTemplateValidator, "SendBoostTemplateValidator"),
294
307
  SendBrandingOptionsValidator: /* @__PURE__ */ __name(() => SendBrandingOptionsValidator, "SendBrandingOptionsValidator"),
295
308
  SendCredentialEventValidator: /* @__PURE__ */ __name(() => SendCredentialEventValidator, "SendCredentialEventValidator"),
296
309
  SendInboxResponseValidator: /* @__PURE__ */ __name(() => SendInboxResponseValidator, "SendInboxResponseValidator"),
@@ -16215,6 +16228,204 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16215
16228
  $or: BaseStringQuery.array()
16216
16229
  })
16217
16230
  ]);
16231
+ var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
16232
+ var ManagedCredentialRefreshServiceValidator = external_exports.object({
16233
+ id: external_exports.string().min(1),
16234
+ type: external_exports.literal("LearnCardCredentialRefresh2026"),
16235
+ authorization: LearnCardRefreshAuthorizationValidator.optional()
16236
+ }).catchall(external_exports.any());
16237
+ var StandardCredentialRefreshServiceValidator = external_exports.object({
16238
+ id: external_exports.string().min(1),
16239
+ type: external_exports.literal("1EdTechCredentialRefresh")
16240
+ }).catchall(external_exports.any());
16241
+ var SupportedCredentialRefreshServiceValidator = external_exports.union([
16242
+ ManagedCredentialRefreshServiceValidator,
16243
+ StandardCredentialRefreshServiceValidator
16244
+ ]);
16245
+ var AllocateCredentialRefreshInputValidator = external_exports.object({
16246
+ holder: external_exports.object({
16247
+ profileId: external_exports.string().optional(),
16248
+ did: external_exports.string().min(1)
16249
+ }),
16250
+ credentialId: external_exports.string().min(1)
16251
+ });
16252
+ var AllocateCredentialRefreshResultValidator = external_exports.object({
16253
+ refreshId: external_exports.string().min(1),
16254
+ refreshService: ManagedCredentialRefreshServiceValidator.extend({
16255
+ authorization: LearnCardRefreshAuthorizationValidator
16256
+ })
16257
+ });
16258
+ var ManagedCredentialRefreshReceiptValidator = external_exports.object({
16259
+ refreshId: external_exports.string().min(1),
16260
+ refreshService: ManagedCredentialRefreshServiceValidator,
16261
+ credentialId: external_exports.string().min(1),
16262
+ issuerDid: external_exports.string().min(1),
16263
+ holderDid: external_exports.string().min(1),
16264
+ credentialStatus: CredentialStatusValidator.or(
16265
+ CredentialStatusValidator.array()
16266
+ ).optional()
16267
+ }).strip();
16268
+ var InboxCredentialRefreshReceiptValidator = ManagedCredentialRefreshReceiptValidator.omit(
16269
+ { holderDid: true }
16270
+ ).extend({ holderDid: external_exports.string().min(1).optional() });
16271
+ var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
16272
+ var PublishCredentialRefreshBaseFields = {
16273
+ refreshId: external_exports.string().min(1),
16274
+ notifyHolder: external_exports.boolean().optional(),
16275
+ updateSummary: external_exports.string().optional(),
16276
+ idempotencyKey: external_exports.string().optional()
16277
+ };
16278
+ var PublishIssuerSignedRefreshValidator = external_exports.object({
16279
+ ...PublishCredentialRefreshBaseFields,
16280
+ mode: external_exports.literal("issuer-signed"),
16281
+ signedCredential: VCValidator
16282
+ });
16283
+ var PublishSigningAuthorityRefreshValidator = external_exports.object({
16284
+ ...PublishCredentialRefreshBaseFields,
16285
+ mode: external_exports.literal("signing-authority"),
16286
+ credential: UnsignedVCValidator,
16287
+ signingAuthority: external_exports.object({
16288
+ type: external_exports.string().min(1)
16289
+ }).catchall(external_exports.any())
16290
+ });
16291
+ var PublishCredentialRefreshInputValidator = external_exports.object({
16292
+ ...PublishCredentialRefreshBaseFields,
16293
+ mode: CredentialRefreshSigningModeValidator,
16294
+ signedCredential: VCValidator.optional(),
16295
+ credential: UnsignedVCValidator.optional(),
16296
+ signingAuthority: external_exports.object({
16297
+ type: external_exports.string().min(1)
16298
+ }).catchall(external_exports.any()).optional()
16299
+ }).superRefine((input, ctx) => {
16300
+ if (input.mode === "issuer-signed" && !input.signedCredential) {
16301
+ ctx.addIssue({
16302
+ code: "custom",
16303
+ path: ["signedCredential"],
16304
+ message: "signedCredential is required for issuer-signed publication"
16305
+ });
16306
+ }
16307
+ if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
16308
+ ctx.addIssue({
16309
+ code: "custom",
16310
+ path: ["mode"],
16311
+ message: "issuer-signed publication cannot include signing-authority fields"
16312
+ });
16313
+ }
16314
+ if (input.mode === "signing-authority") {
16315
+ if (input.signedCredential !== void 0) {
16316
+ ctx.addIssue({
16317
+ code: "custom",
16318
+ path: ["signedCredential"],
16319
+ message: "signing-authority publication cannot include signedCredential"
16320
+ });
16321
+ }
16322
+ if (!input.credential) {
16323
+ ctx.addIssue({
16324
+ code: "custom",
16325
+ path: ["credential"],
16326
+ message: "credential is required for signing-authority publication"
16327
+ });
16328
+ }
16329
+ if (!input.signingAuthority) {
16330
+ ctx.addIssue({
16331
+ code: "custom",
16332
+ path: ["signingAuthority"],
16333
+ message: "signingAuthority is required for signing-authority publication"
16334
+ });
16335
+ }
16336
+ }
16337
+ });
16338
+ var PublishCredentialRefreshNotificationValidator = external_exports.enum([
16339
+ "queued",
16340
+ "suppressed",
16341
+ "not-applicable",
16342
+ /** Publication succeeded, but the post-commit notification enqueue must be retried. */
16343
+ "delivery-failed"
16344
+ ]);
16345
+ var PublishCredentialRefreshResultValidator = external_exports.object({
16346
+ refreshId: external_exports.string().min(1),
16347
+ version: external_exports.number().int().positive(),
16348
+ publishedAt: external_exports.string().min(1),
16349
+ notification: PublishCredentialRefreshNotificationValidator
16350
+ });
16351
+ var CredentialRefreshVersionMetadataValidator = external_exports.object({
16352
+ version: external_exports.number().int().positive(),
16353
+ publishedAt: external_exports.string().min(1),
16354
+ effectiveAt: external_exports.string().optional(),
16355
+ etag: external_exports.string().optional(),
16356
+ signingMode: CredentialRefreshSigningModeValidator.optional(),
16357
+ updateSummary: external_exports.string().optional()
16358
+ });
16359
+ var GetCredentialRefreshHistoryInputValidator = external_exports.object({
16360
+ refreshId: external_exports.string().min(1),
16361
+ cursor: external_exports.string().optional(),
16362
+ limit: external_exports.number().int().positive().optional()
16363
+ });
16364
+ var GetCredentialRefreshHistoryResultValidator = external_exports.object({
16365
+ records: CredentialRefreshVersionMetadataValidator.array(),
16366
+ hasMore: external_exports.boolean(),
16367
+ cursor: external_exports.string().optional()
16368
+ });
16369
+ var CredentialRefreshChallengeValidator = external_exports.object({
16370
+ challenge: external_exports.string().min(1),
16371
+ expiresAt: external_exports.string().min(1),
16372
+ domain: external_exports.string().optional(),
16373
+ scheme: external_exports.literal("LearnCardDIDAuth").optional()
16374
+ });
16375
+ var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
16376
+ format: external_exports.literal("vc"),
16377
+ credential: VCValidator,
16378
+ etag: external_exports.string().optional()
16379
+ });
16380
+ var JweCredentialRefreshEnvelopeValidator = external_exports.object({
16381
+ format: external_exports.literal("jwe"),
16382
+ jwe: JWEValidator,
16383
+ etag: external_exports.string().optional(),
16384
+ /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
16385
+ version: external_exports.number().int().positive().optional()
16386
+ });
16387
+ var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
16388
+ PublicCredentialRefreshEnvelopeValidator,
16389
+ JweCredentialRefreshEnvelopeValidator
16390
+ ]);
16391
+ var CredentialRefreshFailureCodeValidator = external_exports.enum([
16392
+ "UNAVAILABLE",
16393
+ "TIMEOUT",
16394
+ "UNSUPPORTED_SERVICE",
16395
+ "UNAUTHORIZED",
16396
+ "MALFORMED_RESPONSE",
16397
+ "INVALID_PROOF",
16398
+ "ISSUER_MISMATCH",
16399
+ "ID_MISMATCH",
16400
+ "ROLLBACK",
16401
+ "REVOKED",
16402
+ "UNSAFE_ENDPOINT"
16403
+ ]);
16404
+ var CredentialRefreshUpdatedResultValidator = external_exports.object({
16405
+ status: external_exports.literal("updated"),
16406
+ credential: VCValidator,
16407
+ etag: external_exports.string().optional(),
16408
+ managedVersion: external_exports.number().int().positive().optional()
16409
+ });
16410
+ var CredentialRefreshUnchangedResultValidator = external_exports.object({
16411
+ status: external_exports.literal("unchanged"),
16412
+ checkedAt: external_exports.string().min(1),
16413
+ etag: external_exports.string().optional()
16414
+ });
16415
+ var CredentialRefreshUnsupportedResultValidator = external_exports.object({
16416
+ status: external_exports.literal("unsupported")
16417
+ });
16418
+ var CredentialRefreshFailedResultValidator = external_exports.object({
16419
+ status: external_exports.literal("failed"),
16420
+ code: CredentialRefreshFailureCodeValidator,
16421
+ retryable: external_exports.boolean()
16422
+ });
16423
+ var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
16424
+ CredentialRefreshUpdatedResultValidator,
16425
+ CredentialRefreshUnchangedResultValidator,
16426
+ CredentialRefreshUnsupportedResultValidator,
16427
+ CredentialRefreshFailedResultValidator
16428
+ ]);
16218
16429
  var LCNProfileDisplayValidator = external_exports.object({
16219
16430
  backgroundColor: external_exports.string().optional(),
16220
16431
  backgroundImage: external_exports.string().optional(),
@@ -16550,7 +16761,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16550
16761
  "Options for email/phone recipients (Universal Inbox)"
16551
16762
  ),
16552
16763
  templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16553
- integrationId: external_exports.string().optional().describe("Integration ID for activity tracking")
16764
+ integrationId: external_exports.string().optional().describe("Integration ID for activity tracking"),
16765
+ refresh: external_exports.boolean().optional().describe(
16766
+ "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."
16767
+ ),
16768
+ idempotencyKey: external_exports.string().min(1).max(200).optional().describe(
16769
+ "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."
16770
+ )
16554
16771
  }).refine((data) => data.templateUri || data.template || data.signedCredential, {
16555
16772
  message: "Either templateUri, template, or signedCredential must be provided.",
16556
16773
  path: ["templateUri"]
@@ -16565,8 +16782,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16565
16782
  message: "guardianEmail must differ from recipient (self-approval not allowed)",
16566
16783
  path: ["options", "guardianEmail"]
16567
16784
  }
16568
- );
16785
+ ).refine((data) => !data.idempotencyKey || data.refresh === true, {
16786
+ message: "idempotencyKey is only supported with refresh: true.",
16787
+ path: ["idempotencyKey"]
16788
+ });
16569
16789
  var SendInboxResponseValidator = external_exports.object({
16790
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16570
16791
  issuanceId: external_exports.string(),
16571
16792
  status: external_exports.enum(["PENDING", "ISSUED", "EXPIRED", "DELIVERED", "CLAIMED"]),
16572
16793
  claimUrl: external_exports.string().url().optional().describe("Present when suppressDelivery=true"),
@@ -16581,8 +16802,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16581
16802
  activityId: external_exports.string().describe("Links to the activity lifecycle for this issuance"),
16582
16803
  inbox: SendInboxResponseValidator.optional().describe(
16583
16804
  "Present when sent via email/phone (Universal Inbox)"
16805
+ ),
16806
+ refresh: ManagedCredentialRefreshReceiptValidator.optional().describe(
16807
+ "Present when managed refresh was requested: issuance metadata the issuer keeps to publish future updates"
16584
16808
  )
16585
16809
  });
16810
+ var PrepareRefreshableSendInputValidator = external_exports.object({
16811
+ recipient: external_exports.string(),
16812
+ templateUri: external_exports.string().optional(),
16813
+ template: SendBoostTemplateValidator.optional(),
16814
+ contractUri: external_exports.string().optional(),
16815
+ templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16816
+ integrationId: external_exports.string().optional(),
16817
+ /** Credential ID to allocate for; generated server-side when omitted. */
16818
+ credentialId: external_exports.string().min(1).optional(),
16819
+ idempotencyKey: external_exports.string().min(1).max(200).optional()
16820
+ }).refine((data) => Boolean(data.templateUri) !== Boolean(data.template), {
16821
+ message: "Provide exactly one of templateUri or template."
16822
+ });
16823
+ var PrepareRefreshableSendResultValidator = external_exports.object({
16824
+ boostUri: external_exports.string(),
16825
+ credentialId: external_exports.string(),
16826
+ refreshId: external_exports.string(),
16827
+ refreshService: ManagedCredentialRefreshServiceValidator,
16828
+ /** The DID to use as credentialSubject.id (recipient DID, or the profile's did:web). */
16829
+ holderDid: external_exports.string(),
16830
+ /** Present when this idempotencyKey already completed: return it without signing. */
16831
+ completed: SendBoostResponseValidator.optional()
16832
+ });
16586
16833
  var SendInputValidator = external_exports.discriminatedUnion("type", [SendBoostInputValidator]);
16587
16834
  var SendResponseValidator = external_exports.discriminatedUnion("type", [SendBoostResponseValidator]);
16588
16835
  var ConsentFlowTermsStatusValidator = external_exports.enum(["live", "stale", "withdrawn"]);
@@ -16901,6 +17148,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16901
17148
  webhookUrl: external_exports.string().optional()
16902
17149
  });
16903
17150
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
17151
+ var ACT_AS_HEADER = "X-LearnCard-Act-As";
16904
17152
  var AuthGrantValidator = external_exports.object({
16905
17153
  id: external_exports.string(),
16906
17154
  name: external_exports.string(),
@@ -16913,6 +17161,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16913
17161
  }, "error")
16914
17162
  }),
16915
17163
  scope: external_exports.string(),
17164
+ actAs: external_exports.string().optional(),
16916
17165
  createdAt: external_exports.iso.datetime({ error: "createdAt must be a valid ISO 8601 datetime string" }),
16917
17166
  expiresAt: external_exports.iso.datetime({ error: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
16918
17167
  });
@@ -16984,6 +17233,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16984
17233
  sessionJwt: external_exports.string()
16985
17234
  });
16986
17235
  var InboxCredentialValidator = external_exports.object({
17236
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
17237
+ refreshId: external_exports.string().optional(),
16987
17238
  id: external_exports.string(),
16988
17239
  credential: external_exports.string().optional(),
16989
17240
  isSigned: external_exports.boolean(),
@@ -17038,12 +17289,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17038
17289
  templateUri: external_exports.string().optional().describe(
17039
17290
  "URI of a boost template to use for issuance. The boost credential will be resolved and used. Mutually exclusive with credential field."
17040
17291
  ),
17292
+ refresh: external_exports.boolean().optional().describe(
17293
+ "Allocate managed refresh before signing. Requires unsigned content and a registered signing authority; binds the holder on claim."
17294
+ ),
17295
+ idempotencyKey: external_exports.string().min(1).max(200).optional(),
17041
17296
  // === OPTIONAL FEATURES ===
17042
17297
  // Add major, distinct features at the top level.
17043
17298
  //consentRequest: ConsentRequestValidator.optional(),
17044
17299
  // === PROCESS CONFIGURATION (Optional) ===
17045
17300
  // HOW should this issuance be handled?
17046
17301
  configuration: external_exports.object({
17302
+ guardianEmail: external_exports.string().email().optional().describe(
17303
+ "Require approval from this guardian before the recipient can claim. Must differ from the recipient email."
17304
+ ),
17047
17305
  signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe(
17048
17306
  "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."
17049
17307
  ),
@@ -17097,17 +17355,130 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17097
17355
  }).optional().describe(
17098
17356
  "Configuration for the credential issuance. If not provided, the default configuration will be used."
17099
17357
  )
17358
+ }).refine((data) => !data.idempotencyKey || data.refresh === true, {
17359
+ message: "idempotencyKey requires refresh: true."
17100
17360
  }).refine((data) => data.credential || data.templateUri, {
17101
17361
  message: "Either credential or templateUri must be provided.",
17102
17362
  path: ["credential"]
17103
- });
17363
+ }).refine(
17364
+ (data) => !data.configuration?.guardianEmail || data.recipient.type !== "email" || data.configuration.guardianEmail.toLowerCase() !== data.recipient.value.toLowerCase(),
17365
+ {
17366
+ message: "guardianEmail must differ from recipient (self-approval not allowed)",
17367
+ path: ["configuration", "guardianEmail"]
17368
+ }
17369
+ );
17104
17370
  var IssueInboxCredentialResponseValidator = external_exports.object({
17371
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
17105
17372
  issuanceId: external_exports.string(),
17106
17373
  status: LCNInboxStatusEnumValidator,
17107
17374
  recipient: ContactMethodQueryValidator,
17108
17375
  claimUrl: external_exports.string().url().optional(),
17109
17376
  recipientDid: external_exports.string().optional()
17110
17377
  });
17378
+ var InboxBatchConfigurationValidator = IssueInboxCredentialValidator.shape.configuration.unwrap().extend({
17379
+ refresh: IssueInboxCredentialValidator.shape.refresh.describe(
17380
+ "Enable managed refresh by default. An item configuration.refresh overrides this value, including false."
17381
+ ),
17382
+ delivery: IssueInboxCredentialValidator.shape.configuration.unwrap().shape.delivery.unwrap().extend({ suppress: external_exports.boolean().optional() }).optional()
17383
+ });
17384
+ var InboxBatchItemConfigurationValidator = InboxBatchConfigurationValidator.extend({
17385
+ guardianEmail: InboxBatchConfigurationValidator.shape.guardianEmail.nullable().describe(
17386
+ "Require guardian approval, or set null to clear a batch-level guardianEmail for this item."
17387
+ )
17388
+ });
17389
+ var IssueInboxCredentialBatchItemValidator = external_exports.object({
17390
+ ...IssueInboxCredentialValidator.shape,
17391
+ configuration: InboxBatchItemConfigurationValidator.optional(),
17392
+ idempotencyKey: external_exports.string().max(256).optional()
17393
+ }).refine((data) => data.credential || data.templateUri, {
17394
+ message: "Either credential or templateUri must be provided.",
17395
+ path: ["credential"]
17396
+ }).describe(
17397
+ "One issuance: provide credential or templateUri. Invalid input is rejected at submission with its item index."
17398
+ );
17399
+ var IssueInboxCredentialBatchValidator = external_exports.object({
17400
+ requestId: external_exports.string().min(1).max(256).optional(),
17401
+ items: external_exports.array(IssueInboxCredentialBatchItemValidator).min(1).max(100),
17402
+ configuration: InboxBatchConfigurationValidator.optional()
17403
+ }).superRefine((batch, ctx) => {
17404
+ batch.items.forEach((item, index) => {
17405
+ const itemGuardian = item.configuration?.guardianEmail;
17406
+ const guardian = itemGuardian === null ? void 0 : itemGuardian ?? batch.configuration?.guardianEmail;
17407
+ if (guardian && item.recipient.type === "email" && guardian.toLowerCase() === item.recipient.value.toLowerCase()) {
17408
+ ctx.addIssue({
17409
+ code: "custom",
17410
+ path: ["items", index, "configuration", "guardianEmail"],
17411
+ message: "guardianEmail must differ from recipient (self-approval not allowed)"
17412
+ });
17413
+ }
17414
+ });
17415
+ });
17416
+ var InboxBatchErrorReasonValidator = external_exports.enum([
17417
+ "DUPLICATE_KEY",
17418
+ "IDEMPOTENCY_MISMATCH",
17419
+ "IN_PROGRESS",
17420
+ "UNCONFIRMED"
17421
+ ]);
17422
+ var IssueInboxCredentialBatchItemResultValidator = external_exports.discriminatedUnion("success", [
17423
+ IssueInboxCredentialResponseValidator.extend({
17424
+ success: external_exports.literal(true),
17425
+ index: external_exports.number().int().nonnegative(),
17426
+ deduplicated: external_exports.boolean().optional(),
17427
+ guardianStatus: GuardianStatusValidator.optional(),
17428
+ idempotencyKey: external_exports.string().optional()
17429
+ }),
17430
+ external_exports.object({
17431
+ success: external_exports.literal(false),
17432
+ index: external_exports.number().int().nonnegative(),
17433
+ idempotencyKey: external_exports.string().optional(),
17434
+ recipient: ContactMethodQueryValidator.optional(),
17435
+ error: external_exports.object({
17436
+ code: external_exports.string(),
17437
+ message: external_exports.string(),
17438
+ reason: InboxBatchErrorReasonValidator.optional()
17439
+ }),
17440
+ issuanceId: external_exports.string().optional().describe(
17441
+ "Present when issuance completed but replay storage could not be confirmed. Reconcile this issuance; do not issue again with a new key."
17442
+ ),
17443
+ claimUrl: external_exports.string().url().optional().describe(
17444
+ "Claim URL of the completed issuance, if available, when replay storage could not be confirmed."
17445
+ )
17446
+ })
17447
+ ]);
17448
+ var IssueInboxCredentialBatchResponseValidator = external_exports.object({
17449
+ results: external_exports.array(IssueInboxCredentialBatchItemResultValidator),
17450
+ summary: external_exports.object({
17451
+ total: external_exports.number(),
17452
+ succeeded: external_exports.number(),
17453
+ failed: external_exports.number(),
17454
+ deduplicated: external_exports.number()
17455
+ })
17456
+ });
17457
+ var InboxBatchReceiptValidator = external_exports.object({
17458
+ batchId: external_exports.string(),
17459
+ status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17460
+ createdAt: external_exports.string()
17461
+ });
17462
+ var InboxBatchStatusValidator = external_exports.object({
17463
+ batchId: external_exports.string(),
17464
+ createdAt: external_exports.string(),
17465
+ done: external_exports.boolean().describe(
17466
+ "True when no queued or processing items remain, including unconfirmed outcomes."
17467
+ ),
17468
+ status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17469
+ items: external_exports.array(
17470
+ external_exports.object({
17471
+ index: external_exports.number().int().nonnegative(),
17472
+ state: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17473
+ result: IssueInboxCredentialBatchItemResultValidator.optional()
17474
+ })
17475
+ ),
17476
+ summary: IssueInboxCredentialBatchResponseValidator.shape.summary.extend({
17477
+ completed: external_exports.number(),
17478
+ pending: external_exports.number(),
17479
+ unconfirmed: external_exports.number()
17480
+ })
17481
+ });
17111
17482
  var CredentialNameRefValidator = external_exports.object({ name: external_exports.string() }).passthrough();
17112
17483
  var ClaimInboxCredentialValidator = external_exports.object({
17113
17484
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
@@ -17593,6 +17964,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17593
17964
  eventType: CredentialActivityEventTypeValidator,
17594
17965
  timestamp: external_exports.string(),
17595
17966
  actorProfileId: external_exports.string().optional(),
17967
+ onBehalfOf: external_exports.string().optional(),
17596
17968
  recipientType: CredentialActivityRecipientTypeValidator,
17597
17969
  recipientIdentifier: external_exports.string(),
17598
17970
  boostUri: external_exports.string().optional(),
@@ -17753,191 +18125,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17753
18125
  const result = inAppMessagesFlagValidator.safeParse(raw);
17754
18126
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
17755
18127
  }, "parseInAppMessagesFlag");
17756
- var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
17757
- var ManagedCredentialRefreshServiceValidator = external_exports.object({
17758
- id: external_exports.string().min(1),
17759
- type: external_exports.literal("LearnCardCredentialRefresh2026"),
17760
- authorization: LearnCardRefreshAuthorizationValidator.optional()
17761
- }).catchall(external_exports.any());
17762
- var StandardCredentialRefreshServiceValidator = external_exports.object({
17763
- id: external_exports.string().min(1),
17764
- type: external_exports.literal("1EdTechCredentialRefresh")
17765
- }).catchall(external_exports.any());
17766
- var SupportedCredentialRefreshServiceValidator = external_exports.union([
17767
- ManagedCredentialRefreshServiceValidator,
17768
- StandardCredentialRefreshServiceValidator
17769
- ]);
17770
- var AllocateCredentialRefreshInputValidator = external_exports.object({
17771
- holder: external_exports.object({
17772
- profileId: external_exports.string().optional(),
17773
- did: external_exports.string().min(1)
17774
- }),
17775
- credentialId: external_exports.string().min(1)
17776
- });
17777
- var AllocateCredentialRefreshResultValidator = external_exports.object({
17778
- refreshId: external_exports.string().min(1),
17779
- refreshService: ManagedCredentialRefreshServiceValidator.extend({
17780
- authorization: LearnCardRefreshAuthorizationValidator
17781
- })
17782
- });
17783
- var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
17784
- var PublishCredentialRefreshBaseFields = {
17785
- refreshId: external_exports.string().min(1),
17786
- notifyHolder: external_exports.boolean().optional(),
17787
- updateSummary: external_exports.string().optional(),
17788
- idempotencyKey: external_exports.string().optional()
17789
- };
17790
- var PublishIssuerSignedRefreshValidator = external_exports.object({
17791
- ...PublishCredentialRefreshBaseFields,
17792
- mode: external_exports.literal("issuer-signed"),
17793
- signedCredential: VCValidator
17794
- });
17795
- var PublishSigningAuthorityRefreshValidator = external_exports.object({
17796
- ...PublishCredentialRefreshBaseFields,
17797
- mode: external_exports.literal("signing-authority"),
17798
- credential: UnsignedVCValidator,
17799
- signingAuthority: external_exports.object({
17800
- type: external_exports.string().min(1)
17801
- }).catchall(external_exports.any())
17802
- });
17803
- var PublishCredentialRefreshInputValidator = external_exports.object({
17804
- ...PublishCredentialRefreshBaseFields,
17805
- mode: CredentialRefreshSigningModeValidator,
17806
- signedCredential: VCValidator.optional(),
17807
- credential: UnsignedVCValidator.optional(),
17808
- signingAuthority: external_exports.object({
17809
- type: external_exports.string().min(1)
17810
- }).catchall(external_exports.any()).optional()
17811
- }).superRefine((input, ctx) => {
17812
- if (input.mode === "issuer-signed" && !input.signedCredential) {
17813
- ctx.addIssue({
17814
- code: "custom",
17815
- path: ["signedCredential"],
17816
- message: "signedCredential is required for issuer-signed publication"
17817
- });
17818
- }
17819
- if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
17820
- ctx.addIssue({
17821
- code: "custom",
17822
- path: ["mode"],
17823
- message: "issuer-signed publication cannot include signing-authority fields"
17824
- });
17825
- }
17826
- if (input.mode === "signing-authority") {
17827
- if (input.signedCredential !== void 0) {
17828
- ctx.addIssue({
17829
- code: "custom",
17830
- path: ["signedCredential"],
17831
- message: "signing-authority publication cannot include signedCredential"
17832
- });
17833
- }
17834
- if (!input.credential) {
17835
- ctx.addIssue({
17836
- code: "custom",
17837
- path: ["credential"],
17838
- message: "credential is required for signing-authority publication"
17839
- });
17840
- }
17841
- if (!input.signingAuthority) {
17842
- ctx.addIssue({
17843
- code: "custom",
17844
- path: ["signingAuthority"],
17845
- message: "signingAuthority is required for signing-authority publication"
17846
- });
17847
- }
17848
- }
17849
- });
17850
- var PublishCredentialRefreshNotificationValidator = external_exports.enum([
17851
- "queued",
17852
- "suppressed",
17853
- "not-applicable",
17854
- /** Publication succeeded, but the post-commit notification enqueue must be retried. */
17855
- "delivery-failed"
17856
- ]);
17857
- var PublishCredentialRefreshResultValidator = external_exports.object({
17858
- refreshId: external_exports.string().min(1),
17859
- version: external_exports.number().int().positive(),
17860
- publishedAt: external_exports.string().min(1),
17861
- notification: PublishCredentialRefreshNotificationValidator
17862
- });
17863
- var CredentialRefreshVersionMetadataValidator = external_exports.object({
17864
- version: external_exports.number().int().positive(),
17865
- publishedAt: external_exports.string().min(1),
17866
- effectiveAt: external_exports.string().optional(),
17867
- etag: external_exports.string().optional(),
17868
- signingMode: CredentialRefreshSigningModeValidator.optional(),
17869
- updateSummary: external_exports.string().optional()
17870
- });
17871
- var GetCredentialRefreshHistoryInputValidator = external_exports.object({
17872
- refreshId: external_exports.string().min(1),
17873
- cursor: external_exports.string().optional(),
17874
- limit: external_exports.number().int().positive().optional()
17875
- });
17876
- var GetCredentialRefreshHistoryResultValidator = external_exports.object({
17877
- records: CredentialRefreshVersionMetadataValidator.array(),
17878
- hasMore: external_exports.boolean(),
17879
- cursor: external_exports.string().optional()
17880
- });
17881
- var CredentialRefreshChallengeValidator = external_exports.object({
17882
- challenge: external_exports.string().min(1),
17883
- expiresAt: external_exports.string().min(1),
17884
- domain: external_exports.string().optional(),
17885
- scheme: external_exports.literal("LearnCardDIDAuth").optional()
17886
- });
17887
- var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
17888
- format: external_exports.literal("vc"),
17889
- credential: VCValidator,
17890
- etag: external_exports.string().optional()
17891
- });
17892
- var JweCredentialRefreshEnvelopeValidator = external_exports.object({
17893
- format: external_exports.literal("jwe"),
17894
- jwe: JWEValidator,
17895
- etag: external_exports.string().optional(),
17896
- /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
17897
- version: external_exports.number().int().positive().optional()
17898
- });
17899
- var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
17900
- PublicCredentialRefreshEnvelopeValidator,
17901
- JweCredentialRefreshEnvelopeValidator
17902
- ]);
17903
- var CredentialRefreshFailureCodeValidator = external_exports.enum([
17904
- "UNAVAILABLE",
17905
- "TIMEOUT",
17906
- "UNSUPPORTED_SERVICE",
17907
- "UNAUTHORIZED",
17908
- "MALFORMED_RESPONSE",
17909
- "INVALID_PROOF",
17910
- "ISSUER_MISMATCH",
17911
- "ID_MISMATCH",
17912
- "ROLLBACK",
17913
- "REVOKED",
17914
- "UNSAFE_ENDPOINT"
17915
- ]);
17916
- var CredentialRefreshUpdatedResultValidator = external_exports.object({
17917
- status: external_exports.literal("updated"),
17918
- credential: VCValidator,
17919
- etag: external_exports.string().optional(),
17920
- managedVersion: external_exports.number().int().positive().optional()
17921
- });
17922
- var CredentialRefreshUnchangedResultValidator = external_exports.object({
17923
- status: external_exports.literal("unchanged"),
17924
- checkedAt: external_exports.string().min(1),
17925
- etag: external_exports.string().optional()
17926
- });
17927
- var CredentialRefreshUnsupportedResultValidator = external_exports.object({
17928
- status: external_exports.literal("unsupported")
17929
- });
17930
- var CredentialRefreshFailedResultValidator = external_exports.object({
17931
- status: external_exports.literal("failed"),
17932
- code: CredentialRefreshFailureCodeValidator,
17933
- retryable: external_exports.boolean()
17934
- });
17935
- var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
17936
- CredentialRefreshUpdatedResultValidator,
17937
- CredentialRefreshUnchangedResultValidator,
17938
- CredentialRefreshUnsupportedResultValidator,
17939
- CredentialRefreshFailedResultValidator
17940
- ]);
17941
18128
  }
17942
18129
  });
17943
18130