@learncard/types 5.20.0 → 5.21.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.
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  // src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
+ ACT_AS_HEADER: () => ACT_AS_HEADER,
24
25
  AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX: () => AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX,
25
26
  AchievementCredentialValidator: () => AchievementCredentialValidator,
26
27
  AchievementCriteriaValidator: () => AchievementCriteriaValidator,
@@ -160,10 +161,18 @@ __export(index_exports, {
160
161
  IdentifierTypeValidator: () => IdentifierTypeValidator,
161
162
  IdentityObjectValidator: () => IdentityObjectValidator,
162
163
  ImageValidator: () => ImageValidator,
164
+ InboxBatchErrorReasonValidator: () => InboxBatchErrorReasonValidator,
165
+ InboxBatchReceiptValidator: () => InboxBatchReceiptValidator,
166
+ InboxBatchStatusValidator: () => InboxBatchStatusValidator,
163
167
  InboxCredentialQueryValidator: () => InboxCredentialQueryValidator,
168
+ InboxCredentialRefreshReceiptValidator: () => InboxCredentialRefreshReceiptValidator,
164
169
  InboxCredentialValidator: () => InboxCredentialValidator,
165
170
  IncrementCounterEventValidator: () => IncrementCounterEventValidator,
166
171
  InstalledAppValidator: () => InstalledAppValidator,
172
+ IssueInboxCredentialBatchItemResultValidator: () => IssueInboxCredentialBatchItemResultValidator,
173
+ IssueInboxCredentialBatchItemValidator: () => IssueInboxCredentialBatchItemValidator,
174
+ IssueInboxCredentialBatchResponseValidator: () => IssueInboxCredentialBatchResponseValidator,
175
+ IssueInboxCredentialBatchValidator: () => IssueInboxCredentialBatchValidator,
167
176
  IssueInboxCredentialResponseValidator: () => IssueInboxCredentialResponseValidator,
168
177
  IssueInboxCredentialValidator: () => IssueInboxCredentialValidator,
169
178
  IssueInboxSigningAuthorityValidator: () => IssueInboxSigningAuthorityValidator,
@@ -212,6 +221,7 @@ __export(index_exports, {
212
221
  LaunchTypeValidator: () => LaunchTypeValidator,
213
222
  LearnCardRefreshAuthorizationValidator: () => LearnCardRefreshAuthorizationValidator,
214
223
  LinkProviderFrameworkInputValidator: () => LinkProviderFrameworkInputValidator,
224
+ ManagedCredentialRefreshReceiptValidator: () => ManagedCredentialRefreshReceiptValidator,
215
225
  ManagedCredentialRefreshServiceValidator: () => ManagedCredentialRefreshServiceValidator,
216
226
  PaginatedAppStoreListingsValidator: () => PaginatedAppStoreListingsValidator,
217
227
  PaginatedBoostRecipientsValidator: () => PaginatedBoostRecipientsValidator,
@@ -238,6 +248,8 @@ __export(index_exports, {
238
248
  PaginatedVisibleLCNProfilesValidator: () => PaginatedVisibleLCNProfilesValidator,
239
249
  PaginationOptionsValidator: () => PaginationOptionsValidator,
240
250
  PaginationResponseValidator: () => PaginationResponseValidator,
251
+ PrepareRefreshableSendInputValidator: () => PrepareRefreshableSendInputValidator,
252
+ PrepareRefreshableSendResultValidator: () => PrepareRefreshableSendResultValidator,
241
253
  ProfileValidator: () => ProfileValidator,
242
254
  ProfileVisibilityEnum: () => ProfileVisibilityEnum,
243
255
  PromotionLevelValidator: () => PromotionLevelValidator,
@@ -263,6 +275,7 @@ __export(index_exports, {
263
275
  SendAiSessionCredentialEventValidator: () => SendAiSessionCredentialEventValidator,
264
276
  SendBoostInputValidator: () => SendBoostInputValidator,
265
277
  SendBoostResponseValidator: () => SendBoostResponseValidator,
278
+ SendBoostTemplateValidator: () => SendBoostTemplateValidator,
266
279
  SendBrandingOptionsValidator: () => SendBrandingOptionsValidator,
267
280
  SendCredentialEventValidator: () => SendCredentialEventValidator,
268
281
  SendInboxResponseValidator: () => SendInboxResponseValidator,
@@ -15916,6 +15929,206 @@ var StringQuery = external_exports.union([
15916
15929
  })
15917
15930
  ]);
15918
15931
 
15932
+ // src/credential-refresh.ts
15933
+ var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
15934
+ var ManagedCredentialRefreshServiceValidator = external_exports.object({
15935
+ id: external_exports.string().min(1),
15936
+ type: external_exports.literal("LearnCardCredentialRefresh2026"),
15937
+ authorization: LearnCardRefreshAuthorizationValidator.optional()
15938
+ }).catchall(external_exports.any());
15939
+ var StandardCredentialRefreshServiceValidator = external_exports.object({
15940
+ id: external_exports.string().min(1),
15941
+ type: external_exports.literal("1EdTechCredentialRefresh")
15942
+ }).catchall(external_exports.any());
15943
+ var SupportedCredentialRefreshServiceValidator = external_exports.union([
15944
+ ManagedCredentialRefreshServiceValidator,
15945
+ StandardCredentialRefreshServiceValidator
15946
+ ]);
15947
+ var AllocateCredentialRefreshInputValidator = external_exports.object({
15948
+ holder: external_exports.object({
15949
+ profileId: external_exports.string().optional(),
15950
+ did: external_exports.string().min(1)
15951
+ }),
15952
+ credentialId: external_exports.string().min(1)
15953
+ });
15954
+ var AllocateCredentialRefreshResultValidator = external_exports.object({
15955
+ refreshId: external_exports.string().min(1),
15956
+ refreshService: ManagedCredentialRefreshServiceValidator.extend({
15957
+ authorization: LearnCardRefreshAuthorizationValidator
15958
+ })
15959
+ });
15960
+ var ManagedCredentialRefreshReceiptValidator = external_exports.object({
15961
+ refreshId: external_exports.string().min(1),
15962
+ refreshService: ManagedCredentialRefreshServiceValidator,
15963
+ credentialId: external_exports.string().min(1),
15964
+ issuerDid: external_exports.string().min(1),
15965
+ holderDid: external_exports.string().min(1),
15966
+ credentialStatus: CredentialStatusValidator.or(
15967
+ CredentialStatusValidator.array()
15968
+ ).optional()
15969
+ }).strip();
15970
+ var InboxCredentialRefreshReceiptValidator = ManagedCredentialRefreshReceiptValidator.omit(
15971
+ { holderDid: true }
15972
+ ).extend({ holderDid: external_exports.string().min(1).optional() });
15973
+ var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
15974
+ var PublishCredentialRefreshBaseFields = {
15975
+ refreshId: external_exports.string().min(1),
15976
+ notifyHolder: external_exports.boolean().optional(),
15977
+ updateSummary: external_exports.string().optional(),
15978
+ idempotencyKey: external_exports.string().optional()
15979
+ };
15980
+ var PublishIssuerSignedRefreshValidator = external_exports.object({
15981
+ ...PublishCredentialRefreshBaseFields,
15982
+ mode: external_exports.literal("issuer-signed"),
15983
+ signedCredential: VCValidator
15984
+ });
15985
+ var PublishSigningAuthorityRefreshValidator = external_exports.object({
15986
+ ...PublishCredentialRefreshBaseFields,
15987
+ mode: external_exports.literal("signing-authority"),
15988
+ credential: UnsignedVCValidator,
15989
+ signingAuthority: external_exports.object({
15990
+ type: external_exports.string().min(1)
15991
+ }).catchall(external_exports.any())
15992
+ });
15993
+ var PublishCredentialRefreshInputValidator = external_exports.object({
15994
+ ...PublishCredentialRefreshBaseFields,
15995
+ mode: CredentialRefreshSigningModeValidator,
15996
+ signedCredential: VCValidator.optional(),
15997
+ credential: UnsignedVCValidator.optional(),
15998
+ signingAuthority: external_exports.object({
15999
+ type: external_exports.string().min(1)
16000
+ }).catchall(external_exports.any()).optional()
16001
+ }).superRefine((input, ctx) => {
16002
+ if (input.mode === "issuer-signed" && !input.signedCredential) {
16003
+ ctx.addIssue({
16004
+ code: "custom",
16005
+ path: ["signedCredential"],
16006
+ message: "signedCredential is required for issuer-signed publication"
16007
+ });
16008
+ }
16009
+ if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
16010
+ ctx.addIssue({
16011
+ code: "custom",
16012
+ path: ["mode"],
16013
+ message: "issuer-signed publication cannot include signing-authority fields"
16014
+ });
16015
+ }
16016
+ if (input.mode === "signing-authority") {
16017
+ if (input.signedCredential !== void 0) {
16018
+ ctx.addIssue({
16019
+ code: "custom",
16020
+ path: ["signedCredential"],
16021
+ message: "signing-authority publication cannot include signedCredential"
16022
+ });
16023
+ }
16024
+ if (!input.credential) {
16025
+ ctx.addIssue({
16026
+ code: "custom",
16027
+ path: ["credential"],
16028
+ message: "credential is required for signing-authority publication"
16029
+ });
16030
+ }
16031
+ if (!input.signingAuthority) {
16032
+ ctx.addIssue({
16033
+ code: "custom",
16034
+ path: ["signingAuthority"],
16035
+ message: "signingAuthority is required for signing-authority publication"
16036
+ });
16037
+ }
16038
+ }
16039
+ });
16040
+ var PublishCredentialRefreshNotificationValidator = external_exports.enum([
16041
+ "queued",
16042
+ "suppressed",
16043
+ "not-applicable",
16044
+ /** Publication succeeded, but the post-commit notification enqueue must be retried. */
16045
+ "delivery-failed"
16046
+ ]);
16047
+ var PublishCredentialRefreshResultValidator = external_exports.object({
16048
+ refreshId: external_exports.string().min(1),
16049
+ version: external_exports.number().int().positive(),
16050
+ publishedAt: external_exports.string().min(1),
16051
+ notification: PublishCredentialRefreshNotificationValidator
16052
+ });
16053
+ var CredentialRefreshVersionMetadataValidator = external_exports.object({
16054
+ version: external_exports.number().int().positive(),
16055
+ publishedAt: external_exports.string().min(1),
16056
+ effectiveAt: external_exports.string().optional(),
16057
+ etag: external_exports.string().optional(),
16058
+ signingMode: CredentialRefreshSigningModeValidator.optional(),
16059
+ updateSummary: external_exports.string().optional()
16060
+ });
16061
+ var GetCredentialRefreshHistoryInputValidator = external_exports.object({
16062
+ refreshId: external_exports.string().min(1),
16063
+ cursor: external_exports.string().optional(),
16064
+ limit: external_exports.number().int().positive().optional()
16065
+ });
16066
+ var GetCredentialRefreshHistoryResultValidator = external_exports.object({
16067
+ records: CredentialRefreshVersionMetadataValidator.array(),
16068
+ hasMore: external_exports.boolean(),
16069
+ cursor: external_exports.string().optional()
16070
+ });
16071
+ var CredentialRefreshChallengeValidator = external_exports.object({
16072
+ challenge: external_exports.string().min(1),
16073
+ expiresAt: external_exports.string().min(1),
16074
+ domain: external_exports.string().optional(),
16075
+ scheme: external_exports.literal("LearnCardDIDAuth").optional()
16076
+ });
16077
+ var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
16078
+ format: external_exports.literal("vc"),
16079
+ credential: VCValidator,
16080
+ etag: external_exports.string().optional()
16081
+ });
16082
+ var JweCredentialRefreshEnvelopeValidator = external_exports.object({
16083
+ format: external_exports.literal("jwe"),
16084
+ jwe: JWEValidator,
16085
+ etag: external_exports.string().optional(),
16086
+ /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
16087
+ version: external_exports.number().int().positive().optional()
16088
+ });
16089
+ var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
16090
+ PublicCredentialRefreshEnvelopeValidator,
16091
+ JweCredentialRefreshEnvelopeValidator
16092
+ ]);
16093
+ var CredentialRefreshFailureCodeValidator = external_exports.enum([
16094
+ "UNAVAILABLE",
16095
+ "TIMEOUT",
16096
+ "UNSUPPORTED_SERVICE",
16097
+ "UNAUTHORIZED",
16098
+ "MALFORMED_RESPONSE",
16099
+ "INVALID_PROOF",
16100
+ "ISSUER_MISMATCH",
16101
+ "ID_MISMATCH",
16102
+ "ROLLBACK",
16103
+ "REVOKED",
16104
+ "UNSAFE_ENDPOINT"
16105
+ ]);
16106
+ var CredentialRefreshUpdatedResultValidator = external_exports.object({
16107
+ status: external_exports.literal("updated"),
16108
+ credential: VCValidator,
16109
+ etag: external_exports.string().optional(),
16110
+ managedVersion: external_exports.number().int().positive().optional()
16111
+ });
16112
+ var CredentialRefreshUnchangedResultValidator = external_exports.object({
16113
+ status: external_exports.literal("unchanged"),
16114
+ checkedAt: external_exports.string().min(1),
16115
+ etag: external_exports.string().optional()
16116
+ });
16117
+ var CredentialRefreshUnsupportedResultValidator = external_exports.object({
16118
+ status: external_exports.literal("unsupported")
16119
+ });
16120
+ var CredentialRefreshFailedResultValidator = external_exports.object({
16121
+ status: external_exports.literal("failed"),
16122
+ code: CredentialRefreshFailureCodeValidator,
16123
+ retryable: external_exports.boolean()
16124
+ });
16125
+ var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
16126
+ CredentialRefreshUpdatedResultValidator,
16127
+ CredentialRefreshUnchangedResultValidator,
16128
+ CredentialRefreshUnsupportedResultValidator,
16129
+ CredentialRefreshFailedResultValidator
16130
+ ]);
16131
+
15919
16132
  // src/lcn.ts
15920
16133
  var LCNProfileDisplayValidator = external_exports.object({
15921
16134
  backgroundColor: external_exports.string().optional(),
@@ -16252,7 +16465,13 @@ var SendBoostInputValidator = external_exports.object({
16252
16465
  "Options for email/phone recipients (Universal Inbox)"
16253
16466
  ),
16254
16467
  templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16255
- integrationId: external_exports.string().optional().describe("Integration ID for activity tracking")
16468
+ integrationId: external_exports.string().optional().describe("Integration ID for activity tracking"),
16469
+ refresh: external_exports.boolean().optional().describe(
16470
+ "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."
16471
+ ),
16472
+ idempotencyKey: external_exports.string().min(1).max(200).optional().describe(
16473
+ "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."
16474
+ )
16256
16475
  }).refine((data) => data.templateUri || data.template || data.signedCredential, {
16257
16476
  message: "Either templateUri, template, or signedCredential must be provided.",
16258
16477
  path: ["templateUri"]
@@ -16267,8 +16486,12 @@ var SendBoostInputValidator = external_exports.object({
16267
16486
  message: "guardianEmail must differ from recipient (self-approval not allowed)",
16268
16487
  path: ["options", "guardianEmail"]
16269
16488
  }
16270
- );
16489
+ ).refine((data) => !data.idempotencyKey || data.refresh === true, {
16490
+ message: "idempotencyKey is only supported with refresh: true.",
16491
+ path: ["idempotencyKey"]
16492
+ });
16271
16493
  var SendInboxResponseValidator = external_exports.object({
16494
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16272
16495
  issuanceId: external_exports.string(),
16273
16496
  status: external_exports.enum(["PENDING", "ISSUED", "EXPIRED", "DELIVERED", "CLAIMED"]),
16274
16497
  claimUrl: external_exports.string().url().optional().describe("Present when suppressDelivery=true"),
@@ -16283,8 +16506,34 @@ var SendBoostResponseValidator = external_exports.object({
16283
16506
  activityId: external_exports.string().describe("Links to the activity lifecycle for this issuance"),
16284
16507
  inbox: SendInboxResponseValidator.optional().describe(
16285
16508
  "Present when sent via email/phone (Universal Inbox)"
16509
+ ),
16510
+ refresh: ManagedCredentialRefreshReceiptValidator.optional().describe(
16511
+ "Present when managed refresh was requested: issuance metadata the issuer keeps to publish future updates"
16286
16512
  )
16287
16513
  });
16514
+ var PrepareRefreshableSendInputValidator = external_exports.object({
16515
+ recipient: external_exports.string(),
16516
+ templateUri: external_exports.string().optional(),
16517
+ template: SendBoostTemplateValidator.optional(),
16518
+ contractUri: external_exports.string().optional(),
16519
+ templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16520
+ integrationId: external_exports.string().optional(),
16521
+ /** Credential ID to allocate for; generated server-side when omitted. */
16522
+ credentialId: external_exports.string().min(1).optional(),
16523
+ idempotencyKey: external_exports.string().min(1).max(200).optional()
16524
+ }).refine((data) => Boolean(data.templateUri) !== Boolean(data.template), {
16525
+ message: "Provide exactly one of templateUri or template."
16526
+ });
16527
+ var PrepareRefreshableSendResultValidator = external_exports.object({
16528
+ boostUri: external_exports.string(),
16529
+ credentialId: external_exports.string(),
16530
+ refreshId: external_exports.string(),
16531
+ refreshService: ManagedCredentialRefreshServiceValidator,
16532
+ /** The DID to use as credentialSubject.id (recipient DID, or the profile's did:web). */
16533
+ holderDid: external_exports.string(),
16534
+ /** Present when this idempotencyKey already completed: return it without signing. */
16535
+ completed: SendBoostResponseValidator.optional()
16536
+ });
16288
16537
  var SendInputValidator = external_exports.discriminatedUnion("type", [SendBoostInputValidator]);
16289
16538
  var SendResponseValidator = external_exports.discriminatedUnion("type", [SendBoostResponseValidator]);
16290
16539
  var ConsentFlowTermsStatusValidator = external_exports.enum(["live", "stale", "withdrawn"]);
@@ -16603,6 +16852,7 @@ var LCNNotificationValidator = external_exports.object({
16603
16852
  webhookUrl: external_exports.string().optional()
16604
16853
  });
16605
16854
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
16855
+ var ACT_AS_HEADER = "X-LearnCard-Act-As";
16606
16856
  var AuthGrantValidator = external_exports.object({
16607
16857
  id: external_exports.string(),
16608
16858
  name: external_exports.string(),
@@ -16615,6 +16865,7 @@ var AuthGrantValidator = external_exports.object({
16615
16865
  }, "error")
16616
16866
  }),
16617
16867
  scope: external_exports.string(),
16868
+ actAs: external_exports.string().optional(),
16618
16869
  createdAt: external_exports.iso.datetime({ error: "createdAt must be a valid ISO 8601 datetime string" }),
16619
16870
  expiresAt: external_exports.iso.datetime({ error: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
16620
16871
  });
@@ -16686,6 +16937,8 @@ var CreateContactMethodSessionResponseValidator = external_exports.object({
16686
16937
  sessionJwt: external_exports.string()
16687
16938
  });
16688
16939
  var InboxCredentialValidator = external_exports.object({
16940
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16941
+ refreshId: external_exports.string().optional(),
16689
16942
  id: external_exports.string(),
16690
16943
  credential: external_exports.string().optional(),
16691
16944
  isSigned: external_exports.boolean(),
@@ -16740,12 +16993,19 @@ var IssueInboxCredentialValidator = external_exports.object({
16740
16993
  templateUri: external_exports.string().optional().describe(
16741
16994
  "URI of a boost template to use for issuance. The boost credential will be resolved and used. Mutually exclusive with credential field."
16742
16995
  ),
16996
+ refresh: external_exports.boolean().optional().describe(
16997
+ "Allocate managed refresh before signing. Requires unsigned content and a registered signing authority; binds the holder on claim."
16998
+ ),
16999
+ idempotencyKey: external_exports.string().min(1).max(200).optional(),
16743
17000
  // === OPTIONAL FEATURES ===
16744
17001
  // Add major, distinct features at the top level.
16745
17002
  //consentRequest: ConsentRequestValidator.optional(),
16746
17003
  // === PROCESS CONFIGURATION (Optional) ===
16747
17004
  // HOW should this issuance be handled?
16748
17005
  configuration: external_exports.object({
17006
+ guardianEmail: external_exports.string().email().optional().describe(
17007
+ "Require approval from this guardian before the recipient can claim. Must differ from the recipient email."
17008
+ ),
16749
17009
  signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe(
16750
17010
  "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."
16751
17011
  ),
@@ -16799,17 +17059,130 @@ var IssueInboxCredentialValidator = external_exports.object({
16799
17059
  }).optional().describe(
16800
17060
  "Configuration for the credential issuance. If not provided, the default configuration will be used."
16801
17061
  )
17062
+ }).refine((data) => !data.idempotencyKey || data.refresh === true, {
17063
+ message: "idempotencyKey requires refresh: true."
16802
17064
  }).refine((data) => data.credential || data.templateUri, {
16803
17065
  message: "Either credential or templateUri must be provided.",
16804
17066
  path: ["credential"]
16805
- });
17067
+ }).refine(
17068
+ (data) => !data.configuration?.guardianEmail || data.recipient.type !== "email" || data.configuration.guardianEmail.toLowerCase() !== data.recipient.value.toLowerCase(),
17069
+ {
17070
+ message: "guardianEmail must differ from recipient (self-approval not allowed)",
17071
+ path: ["configuration", "guardianEmail"]
17072
+ }
17073
+ );
16806
17074
  var IssueInboxCredentialResponseValidator = external_exports.object({
17075
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16807
17076
  issuanceId: external_exports.string(),
16808
17077
  status: LCNInboxStatusEnumValidator,
16809
17078
  recipient: ContactMethodQueryValidator,
16810
17079
  claimUrl: external_exports.string().url().optional(),
16811
17080
  recipientDid: external_exports.string().optional()
16812
17081
  });
17082
+ var InboxBatchConfigurationValidator = IssueInboxCredentialValidator.shape.configuration.unwrap().extend({
17083
+ refresh: IssueInboxCredentialValidator.shape.refresh.describe(
17084
+ "Enable managed refresh by default. An item configuration.refresh overrides this value, including false."
17085
+ ),
17086
+ delivery: IssueInboxCredentialValidator.shape.configuration.unwrap().shape.delivery.unwrap().extend({ suppress: external_exports.boolean().optional() }).optional()
17087
+ });
17088
+ var InboxBatchItemConfigurationValidator = InboxBatchConfigurationValidator.extend({
17089
+ guardianEmail: InboxBatchConfigurationValidator.shape.guardianEmail.nullable().describe(
17090
+ "Require guardian approval, or set null to clear a batch-level guardianEmail for this item."
17091
+ )
17092
+ });
17093
+ var IssueInboxCredentialBatchItemValidator = external_exports.object({
17094
+ ...IssueInboxCredentialValidator.shape,
17095
+ configuration: InboxBatchItemConfigurationValidator.optional(),
17096
+ idempotencyKey: external_exports.string().max(256).optional()
17097
+ }).refine((data) => data.credential || data.templateUri, {
17098
+ message: "Either credential or templateUri must be provided.",
17099
+ path: ["credential"]
17100
+ }).describe(
17101
+ "One issuance: provide credential or templateUri. Invalid input is rejected at submission with its item index."
17102
+ );
17103
+ var IssueInboxCredentialBatchValidator = external_exports.object({
17104
+ requestId: external_exports.string().min(1).max(256).optional(),
17105
+ items: external_exports.array(IssueInboxCredentialBatchItemValidator).min(1).max(100),
17106
+ configuration: InboxBatchConfigurationValidator.optional()
17107
+ }).superRefine((batch, ctx) => {
17108
+ batch.items.forEach((item, index) => {
17109
+ const itemGuardian = item.configuration?.guardianEmail;
17110
+ const guardian = itemGuardian === null ? void 0 : itemGuardian ?? batch.configuration?.guardianEmail;
17111
+ if (guardian && item.recipient.type === "email" && guardian.toLowerCase() === item.recipient.value.toLowerCase()) {
17112
+ ctx.addIssue({
17113
+ code: "custom",
17114
+ path: ["items", index, "configuration", "guardianEmail"],
17115
+ message: "guardianEmail must differ from recipient (self-approval not allowed)"
17116
+ });
17117
+ }
17118
+ });
17119
+ });
17120
+ var InboxBatchErrorReasonValidator = external_exports.enum([
17121
+ "DUPLICATE_KEY",
17122
+ "IDEMPOTENCY_MISMATCH",
17123
+ "IN_PROGRESS",
17124
+ "UNCONFIRMED"
17125
+ ]);
17126
+ var IssueInboxCredentialBatchItemResultValidator = external_exports.discriminatedUnion("success", [
17127
+ IssueInboxCredentialResponseValidator.extend({
17128
+ success: external_exports.literal(true),
17129
+ index: external_exports.number().int().nonnegative(),
17130
+ deduplicated: external_exports.boolean().optional(),
17131
+ guardianStatus: GuardianStatusValidator.optional(),
17132
+ idempotencyKey: external_exports.string().optional()
17133
+ }),
17134
+ external_exports.object({
17135
+ success: external_exports.literal(false),
17136
+ index: external_exports.number().int().nonnegative(),
17137
+ idempotencyKey: external_exports.string().optional(),
17138
+ recipient: ContactMethodQueryValidator.optional(),
17139
+ error: external_exports.object({
17140
+ code: external_exports.string(),
17141
+ message: external_exports.string(),
17142
+ reason: InboxBatchErrorReasonValidator.optional()
17143
+ }),
17144
+ issuanceId: external_exports.string().optional().describe(
17145
+ "Present when issuance completed but replay storage could not be confirmed. Reconcile this issuance; do not issue again with a new key."
17146
+ ),
17147
+ claimUrl: external_exports.string().url().optional().describe(
17148
+ "Claim URL of the completed issuance, if available, when replay storage could not be confirmed."
17149
+ )
17150
+ })
17151
+ ]);
17152
+ var IssueInboxCredentialBatchResponseValidator = external_exports.object({
17153
+ results: external_exports.array(IssueInboxCredentialBatchItemResultValidator),
17154
+ summary: external_exports.object({
17155
+ total: external_exports.number(),
17156
+ succeeded: external_exports.number(),
17157
+ failed: external_exports.number(),
17158
+ deduplicated: external_exports.number()
17159
+ })
17160
+ });
17161
+ var InboxBatchReceiptValidator = external_exports.object({
17162
+ batchId: external_exports.string(),
17163
+ status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17164
+ createdAt: external_exports.string()
17165
+ });
17166
+ var InboxBatchStatusValidator = external_exports.object({
17167
+ batchId: external_exports.string(),
17168
+ createdAt: external_exports.string(),
17169
+ done: external_exports.boolean().describe(
17170
+ "True when no queued or processing items remain, including unconfirmed outcomes."
17171
+ ),
17172
+ status: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17173
+ items: external_exports.array(
17174
+ external_exports.object({
17175
+ index: external_exports.number().int().nonnegative(),
17176
+ state: external_exports.enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
17177
+ result: IssueInboxCredentialBatchItemResultValidator.optional()
17178
+ })
17179
+ ),
17180
+ summary: IssueInboxCredentialBatchResponseValidator.shape.summary.extend({
17181
+ completed: external_exports.number(),
17182
+ pending: external_exports.number(),
17183
+ unconfirmed: external_exports.number()
17184
+ })
17185
+ });
16813
17186
  var CredentialNameRefValidator = external_exports.object({ name: external_exports.string() }).passthrough();
16814
17187
  var ClaimInboxCredentialValidator = external_exports.object({
16815
17188
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
@@ -17295,6 +17668,7 @@ var CredentialActivityValidator = external_exports.object({
17295
17668
  eventType: CredentialActivityEventTypeValidator,
17296
17669
  timestamp: external_exports.string(),
17297
17670
  actorProfileId: external_exports.string().optional(),
17671
+ onBehalfOf: external_exports.string().optional(),
17298
17672
  recipientType: CredentialActivityRecipientTypeValidator,
17299
17673
  recipientIdentifier: external_exports.string(),
17300
17674
  boostUri: external_exports.string().optional(),
@@ -17458,190 +17832,3 @@ var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
17458
17832
  const result = inAppMessagesFlagValidator.safeParse(raw);
17459
17833
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
17460
17834
  }, "parseInAppMessagesFlag");
17461
-
17462
- // src/credential-refresh.ts
17463
- var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
17464
- var ManagedCredentialRefreshServiceValidator = external_exports.object({
17465
- id: external_exports.string().min(1),
17466
- type: external_exports.literal("LearnCardCredentialRefresh2026"),
17467
- authorization: LearnCardRefreshAuthorizationValidator.optional()
17468
- }).catchall(external_exports.any());
17469
- var StandardCredentialRefreshServiceValidator = external_exports.object({
17470
- id: external_exports.string().min(1),
17471
- type: external_exports.literal("1EdTechCredentialRefresh")
17472
- }).catchall(external_exports.any());
17473
- var SupportedCredentialRefreshServiceValidator = external_exports.union([
17474
- ManagedCredentialRefreshServiceValidator,
17475
- StandardCredentialRefreshServiceValidator
17476
- ]);
17477
- var AllocateCredentialRefreshInputValidator = external_exports.object({
17478
- holder: external_exports.object({
17479
- profileId: external_exports.string().optional(),
17480
- did: external_exports.string().min(1)
17481
- }),
17482
- credentialId: external_exports.string().min(1)
17483
- });
17484
- var AllocateCredentialRefreshResultValidator = external_exports.object({
17485
- refreshId: external_exports.string().min(1),
17486
- refreshService: ManagedCredentialRefreshServiceValidator.extend({
17487
- authorization: LearnCardRefreshAuthorizationValidator
17488
- })
17489
- });
17490
- var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
17491
- var PublishCredentialRefreshBaseFields = {
17492
- refreshId: external_exports.string().min(1),
17493
- notifyHolder: external_exports.boolean().optional(),
17494
- updateSummary: external_exports.string().optional(),
17495
- idempotencyKey: external_exports.string().optional()
17496
- };
17497
- var PublishIssuerSignedRefreshValidator = external_exports.object({
17498
- ...PublishCredentialRefreshBaseFields,
17499
- mode: external_exports.literal("issuer-signed"),
17500
- signedCredential: VCValidator
17501
- });
17502
- var PublishSigningAuthorityRefreshValidator = external_exports.object({
17503
- ...PublishCredentialRefreshBaseFields,
17504
- mode: external_exports.literal("signing-authority"),
17505
- credential: UnsignedVCValidator,
17506
- signingAuthority: external_exports.object({
17507
- type: external_exports.string().min(1)
17508
- }).catchall(external_exports.any())
17509
- });
17510
- var PublishCredentialRefreshInputValidator = external_exports.object({
17511
- ...PublishCredentialRefreshBaseFields,
17512
- mode: CredentialRefreshSigningModeValidator,
17513
- signedCredential: VCValidator.optional(),
17514
- credential: UnsignedVCValidator.optional(),
17515
- signingAuthority: external_exports.object({
17516
- type: external_exports.string().min(1)
17517
- }).catchall(external_exports.any()).optional()
17518
- }).superRefine((input, ctx) => {
17519
- if (input.mode === "issuer-signed" && !input.signedCredential) {
17520
- ctx.addIssue({
17521
- code: "custom",
17522
- path: ["signedCredential"],
17523
- message: "signedCredential is required for issuer-signed publication"
17524
- });
17525
- }
17526
- if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
17527
- ctx.addIssue({
17528
- code: "custom",
17529
- path: ["mode"],
17530
- message: "issuer-signed publication cannot include signing-authority fields"
17531
- });
17532
- }
17533
- if (input.mode === "signing-authority") {
17534
- if (input.signedCredential !== void 0) {
17535
- ctx.addIssue({
17536
- code: "custom",
17537
- path: ["signedCredential"],
17538
- message: "signing-authority publication cannot include signedCredential"
17539
- });
17540
- }
17541
- if (!input.credential) {
17542
- ctx.addIssue({
17543
- code: "custom",
17544
- path: ["credential"],
17545
- message: "credential is required for signing-authority publication"
17546
- });
17547
- }
17548
- if (!input.signingAuthority) {
17549
- ctx.addIssue({
17550
- code: "custom",
17551
- path: ["signingAuthority"],
17552
- message: "signingAuthority is required for signing-authority publication"
17553
- });
17554
- }
17555
- }
17556
- });
17557
- var PublishCredentialRefreshNotificationValidator = external_exports.enum([
17558
- "queued",
17559
- "suppressed",
17560
- "not-applicable",
17561
- /** Publication succeeded, but the post-commit notification enqueue must be retried. */
17562
- "delivery-failed"
17563
- ]);
17564
- var PublishCredentialRefreshResultValidator = external_exports.object({
17565
- refreshId: external_exports.string().min(1),
17566
- version: external_exports.number().int().positive(),
17567
- publishedAt: external_exports.string().min(1),
17568
- notification: PublishCredentialRefreshNotificationValidator
17569
- });
17570
- var CredentialRefreshVersionMetadataValidator = external_exports.object({
17571
- version: external_exports.number().int().positive(),
17572
- publishedAt: external_exports.string().min(1),
17573
- effectiveAt: external_exports.string().optional(),
17574
- etag: external_exports.string().optional(),
17575
- signingMode: CredentialRefreshSigningModeValidator.optional(),
17576
- updateSummary: external_exports.string().optional()
17577
- });
17578
- var GetCredentialRefreshHistoryInputValidator = external_exports.object({
17579
- refreshId: external_exports.string().min(1),
17580
- cursor: external_exports.string().optional(),
17581
- limit: external_exports.number().int().positive().optional()
17582
- });
17583
- var GetCredentialRefreshHistoryResultValidator = external_exports.object({
17584
- records: CredentialRefreshVersionMetadataValidator.array(),
17585
- hasMore: external_exports.boolean(),
17586
- cursor: external_exports.string().optional()
17587
- });
17588
- var CredentialRefreshChallengeValidator = external_exports.object({
17589
- challenge: external_exports.string().min(1),
17590
- expiresAt: external_exports.string().min(1),
17591
- domain: external_exports.string().optional(),
17592
- scheme: external_exports.literal("LearnCardDIDAuth").optional()
17593
- });
17594
- var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
17595
- format: external_exports.literal("vc"),
17596
- credential: VCValidator,
17597
- etag: external_exports.string().optional()
17598
- });
17599
- var JweCredentialRefreshEnvelopeValidator = external_exports.object({
17600
- format: external_exports.literal("jwe"),
17601
- jwe: JWEValidator,
17602
- etag: external_exports.string().optional(),
17603
- /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
17604
- version: external_exports.number().int().positive().optional()
17605
- });
17606
- var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
17607
- PublicCredentialRefreshEnvelopeValidator,
17608
- JweCredentialRefreshEnvelopeValidator
17609
- ]);
17610
- var CredentialRefreshFailureCodeValidator = external_exports.enum([
17611
- "UNAVAILABLE",
17612
- "TIMEOUT",
17613
- "UNSUPPORTED_SERVICE",
17614
- "UNAUTHORIZED",
17615
- "MALFORMED_RESPONSE",
17616
- "INVALID_PROOF",
17617
- "ISSUER_MISMATCH",
17618
- "ID_MISMATCH",
17619
- "ROLLBACK",
17620
- "REVOKED",
17621
- "UNSAFE_ENDPOINT"
17622
- ]);
17623
- var CredentialRefreshUpdatedResultValidator = external_exports.object({
17624
- status: external_exports.literal("updated"),
17625
- credential: VCValidator,
17626
- etag: external_exports.string().optional(),
17627
- managedVersion: external_exports.number().int().positive().optional()
17628
- });
17629
- var CredentialRefreshUnchangedResultValidator = external_exports.object({
17630
- status: external_exports.literal("unchanged"),
17631
- checkedAt: external_exports.string().min(1),
17632
- etag: external_exports.string().optional()
17633
- });
17634
- var CredentialRefreshUnsupportedResultValidator = external_exports.object({
17635
- status: external_exports.literal("unsupported")
17636
- });
17637
- var CredentialRefreshFailedResultValidator = external_exports.object({
17638
- status: external_exports.literal("failed"),
17639
- code: CredentialRefreshFailureCodeValidator,
17640
- retryable: external_exports.boolean()
17641
- });
17642
- var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
17643
- CredentialRefreshUpdatedResultValidator,
17644
- CredentialRefreshUnchangedResultValidator,
17645
- CredentialRefreshUnsupportedResultValidator,
17646
- CredentialRefreshFailedResultValidator
17647
- ]);