@learncard/types 5.19.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,
@@ -83,6 +84,7 @@ __export(index_exports, {
83
84
  ConsentFlowContractValidator: () => ConsentFlowContractValidator,
84
85
  ConsentFlowDataForDidQueryValidator: () => ConsentFlowDataForDidQueryValidator,
85
86
  ConsentFlowDataQueryValidator: () => ConsentFlowDataQueryValidator,
87
+ ConsentFlowGuardianApprovalValidator: () => ConsentFlowGuardianApprovalValidator,
86
88
  ConsentFlowTermValidator: () => ConsentFlowTermValidator,
87
89
  ConsentFlowTermsQueryValidator: () => ConsentFlowTermsQueryValidator,
88
90
  ConsentFlowTermsStatusValidator: () => ConsentFlowTermsStatusValidator,
@@ -159,10 +161,18 @@ __export(index_exports, {
159
161
  IdentifierTypeValidator: () => IdentifierTypeValidator,
160
162
  IdentityObjectValidator: () => IdentityObjectValidator,
161
163
  ImageValidator: () => ImageValidator,
164
+ InboxBatchErrorReasonValidator: () => InboxBatchErrorReasonValidator,
165
+ InboxBatchReceiptValidator: () => InboxBatchReceiptValidator,
166
+ InboxBatchStatusValidator: () => InboxBatchStatusValidator,
162
167
  InboxCredentialQueryValidator: () => InboxCredentialQueryValidator,
168
+ InboxCredentialRefreshReceiptValidator: () => InboxCredentialRefreshReceiptValidator,
163
169
  InboxCredentialValidator: () => InboxCredentialValidator,
164
170
  IncrementCounterEventValidator: () => IncrementCounterEventValidator,
165
171
  InstalledAppValidator: () => InstalledAppValidator,
172
+ IssueInboxCredentialBatchItemResultValidator: () => IssueInboxCredentialBatchItemResultValidator,
173
+ IssueInboxCredentialBatchItemValidator: () => IssueInboxCredentialBatchItemValidator,
174
+ IssueInboxCredentialBatchResponseValidator: () => IssueInboxCredentialBatchResponseValidator,
175
+ IssueInboxCredentialBatchValidator: () => IssueInboxCredentialBatchValidator,
166
176
  IssueInboxCredentialResponseValidator: () => IssueInboxCredentialResponseValidator,
167
177
  IssueInboxCredentialValidator: () => IssueInboxCredentialValidator,
168
178
  IssueInboxSigningAuthorityValidator: () => IssueInboxSigningAuthorityValidator,
@@ -211,6 +221,7 @@ __export(index_exports, {
211
221
  LaunchTypeValidator: () => LaunchTypeValidator,
212
222
  LearnCardRefreshAuthorizationValidator: () => LearnCardRefreshAuthorizationValidator,
213
223
  LinkProviderFrameworkInputValidator: () => LinkProviderFrameworkInputValidator,
224
+ ManagedCredentialRefreshReceiptValidator: () => ManagedCredentialRefreshReceiptValidator,
214
225
  ManagedCredentialRefreshServiceValidator: () => ManagedCredentialRefreshServiceValidator,
215
226
  PaginatedAppStoreListingsValidator: () => PaginatedAppStoreListingsValidator,
216
227
  PaginatedBoostRecipientsValidator: () => PaginatedBoostRecipientsValidator,
@@ -237,6 +248,8 @@ __export(index_exports, {
237
248
  PaginatedVisibleLCNProfilesValidator: () => PaginatedVisibleLCNProfilesValidator,
238
249
  PaginationOptionsValidator: () => PaginationOptionsValidator,
239
250
  PaginationResponseValidator: () => PaginationResponseValidator,
251
+ PrepareRefreshableSendInputValidator: () => PrepareRefreshableSendInputValidator,
252
+ PrepareRefreshableSendResultValidator: () => PrepareRefreshableSendResultValidator,
240
253
  ProfileValidator: () => ProfileValidator,
241
254
  ProfileVisibilityEnum: () => ProfileVisibilityEnum,
242
255
  PromotionLevelValidator: () => PromotionLevelValidator,
@@ -262,6 +275,7 @@ __export(index_exports, {
262
275
  SendAiSessionCredentialEventValidator: () => SendAiSessionCredentialEventValidator,
263
276
  SendBoostInputValidator: () => SendBoostInputValidator,
264
277
  SendBoostResponseValidator: () => SendBoostResponseValidator,
278
+ SendBoostTemplateValidator: () => SendBoostTemplateValidator,
265
279
  SendBrandingOptionsValidator: () => SendBrandingOptionsValidator,
266
280
  SendCredentialEventValidator: () => SendCredentialEventValidator,
267
281
  SendInboxResponseValidator: () => SendInboxResponseValidator,
@@ -15439,14 +15453,22 @@ var UnsignedVCValidator = external_exports.object({
15439
15453
  }).catchall(external_exports.any());
15440
15454
  var ProofValidator = external_exports.object({
15441
15455
  type: external_exports.string(),
15442
- created: external_exports.string(),
15456
+ created: external_exports.string().optional(),
15443
15457
  challenge: external_exports.string().optional(),
15444
15458
  domain: external_exports.string().optional(),
15445
15459
  nonce: external_exports.string().optional(),
15446
15460
  proofPurpose: external_exports.string(),
15447
15461
  verificationMethod: external_exports.string(),
15448
15462
  jws: external_exports.string().optional()
15449
- }).catchall(external_exports.any());
15463
+ }).catchall(external_exports.any()).superRefine((proof, ctx) => {
15464
+ if (proof.created === void 0 && (proof.type !== "DataIntegrityProof" || proof.cryptosuite !== "ecdsa-rdfc-2019")) {
15465
+ ctx.addIssue({
15466
+ code: "custom",
15467
+ path: ["created"],
15468
+ message: "created is required for this proof suite"
15469
+ });
15470
+ }
15471
+ });
15450
15472
  var VCValidator = UnsignedVCValidator.extend({
15451
15473
  proof: ProofValidator.or(ProofValidator.array())
15452
15474
  });
@@ -15907,6 +15929,206 @@ var StringQuery = external_exports.union([
15907
15929
  })
15908
15930
  ]);
15909
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
+
15910
16132
  // src/lcn.ts
15911
16133
  var LCNProfileDisplayValidator = external_exports.object({
15912
16134
  backgroundColor: external_exports.string().optional(),
@@ -16243,7 +16465,13 @@ var SendBoostInputValidator = external_exports.object({
16243
16465
  "Options for email/phone recipients (Universal Inbox)"
16244
16466
  ),
16245
16467
  templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
16246
- 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
+ )
16247
16475
  }).refine((data) => data.templateUri || data.template || data.signedCredential, {
16248
16476
  message: "Either templateUri, template, or signedCredential must be provided.",
16249
16477
  path: ["templateUri"]
@@ -16258,8 +16486,12 @@ var SendBoostInputValidator = external_exports.object({
16258
16486
  message: "guardianEmail must differ from recipient (self-approval not allowed)",
16259
16487
  path: ["options", "guardianEmail"]
16260
16488
  }
16261
- );
16489
+ ).refine((data) => !data.idempotencyKey || data.refresh === true, {
16490
+ message: "idempotencyKey is only supported with refresh: true.",
16491
+ path: ["idempotencyKey"]
16492
+ });
16262
16493
  var SendInboxResponseValidator = external_exports.object({
16494
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16263
16495
  issuanceId: external_exports.string(),
16264
16496
  status: external_exports.enum(["PENDING", "ISSUED", "EXPIRED", "DELIVERED", "CLAIMED"]),
16265
16497
  claimUrl: external_exports.string().url().optional().describe("Present when suppressDelivery=true"),
@@ -16274,8 +16506,34 @@ var SendBoostResponseValidator = external_exports.object({
16274
16506
  activityId: external_exports.string().describe("Links to the activity lifecycle for this issuance"),
16275
16507
  inbox: SendInboxResponseValidator.optional().describe(
16276
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"
16277
16512
  )
16278
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
+ });
16279
16537
  var SendInputValidator = external_exports.discriminatedUnion("type", [SendBoostInputValidator]);
16280
16538
  var SendResponseValidator = external_exports.discriminatedUnion("type", [SendBoostResponseValidator]);
16281
16539
  var ConsentFlowTermsStatusValidator = external_exports.enum(["live", "stale", "withdrawn"]);
@@ -16351,15 +16609,6 @@ var ConsentFlowContractDataValidator = external_exports.object({
16351
16609
  var PaginatedConsentFlowDataValidator = PaginationResponseValidator.extend({
16352
16610
  records: ConsentFlowContractDataValidator.array()
16353
16611
  });
16354
- var ConsentFlowContractDataForDidValidator = external_exports.object({
16355
- credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
16356
- personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
16357
- date: external_exports.string(),
16358
- contractUri: external_exports.string()
16359
- });
16360
- var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
16361
- records: ConsentFlowContractDataForDidValidator.array()
16362
- });
16363
16612
  var ConsentFlowTermValidator = external_exports.object({
16364
16613
  sharing: external_exports.boolean().optional(),
16365
16614
  shared: external_exports.string().array().optional(),
@@ -16393,6 +16642,34 @@ var PaginatedConsentFlowTermsValidator = PaginationResponseValidator.extend({
16393
16642
  status: ConsentFlowTermsStatusValidator
16394
16643
  }).array()
16395
16644
  });
16645
+ var ConsentFlowGuardianApprovalValidator = external_exports.object({
16646
+ guardianProfileId: external_exports.string(),
16647
+ guardianDid: external_exports.string(),
16648
+ approvedAt: external_exports.string().datetime(),
16649
+ contractUpdatedAt: external_exports.string()
16650
+ });
16651
+ var ConsentFlowContractDataForDidValidator = external_exports.object({
16652
+ credentials: external_exports.object({ category: external_exports.string(), uri: external_exports.string() }).array(),
16653
+ personal: external_exports.record(external_exports.string(), external_exports.string()).default({}),
16654
+ date: external_exports.string(),
16655
+ createdAt: external_exports.string().optional(),
16656
+ contractUpdatedAt: external_exports.string(),
16657
+ contractExpiresAt: external_exports.string().optional(),
16658
+ reasonForAccessing: external_exports.string().optional(),
16659
+ guardian: external_exports.object({
16660
+ required: external_exports.boolean(),
16661
+ approved: external_exports.boolean(),
16662
+ approval: ConsentFlowGuardianApprovalValidator.optional()
16663
+ }),
16664
+ contractUri: external_exports.string(),
16665
+ termsUri: external_exports.string(),
16666
+ status: ConsentFlowTermsStatusValidator,
16667
+ expiresAt: external_exports.string().optional(),
16668
+ terms: ConsentFlowTermsValidator
16669
+ });
16670
+ var PaginatedConsentFlowDataForDidValidator = PaginationResponseValidator.extend({
16671
+ records: ConsentFlowContractDataForDidValidator.array()
16672
+ });
16396
16673
  var ConsentFlowContractQueryValidator = external_exports.object({
16397
16674
  read: external_exports.object({
16398
16675
  anonymize: external_exports.boolean().optional(),
@@ -16453,6 +16730,7 @@ var ConsentFlowTransactionValidator = external_exports.object({
16453
16730
  expiresAt: external_exports.string().optional(),
16454
16731
  oneTime: external_exports.boolean().optional(),
16455
16732
  terms: ConsentFlowTermsValidator.optional(),
16733
+ guardianApproval: ConsentFlowGuardianApprovalValidator.optional(),
16456
16734
  id: external_exports.string(),
16457
16735
  action: ConsentFlowTransactionActionValidator,
16458
16736
  date: external_exports.string(),
@@ -16574,6 +16852,7 @@ var LCNNotificationValidator = external_exports.object({
16574
16852
  webhookUrl: external_exports.string().optional()
16575
16853
  });
16576
16854
  var AUTH_GRANT_AUDIENCE_DOMAIN_PREFIX = "auth-grant:";
16855
+ var ACT_AS_HEADER = "X-LearnCard-Act-As";
16577
16856
  var AuthGrantValidator = external_exports.object({
16578
16857
  id: external_exports.string(),
16579
16858
  name: external_exports.string(),
@@ -16586,6 +16865,7 @@ var AuthGrantValidator = external_exports.object({
16586
16865
  }, "error")
16587
16866
  }),
16588
16867
  scope: external_exports.string(),
16868
+ actAs: external_exports.string().optional(),
16589
16869
  createdAt: external_exports.iso.datetime({ error: "createdAt must be a valid ISO 8601 datetime string" }),
16590
16870
  expiresAt: external_exports.iso.datetime({ error: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
16591
16871
  });
@@ -16657,6 +16937,8 @@ var CreateContactMethodSessionResponseValidator = external_exports.object({
16657
16937
  sessionJwt: external_exports.string()
16658
16938
  });
16659
16939
  var InboxCredentialValidator = external_exports.object({
16940
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16941
+ refreshId: external_exports.string().optional(),
16660
16942
  id: external_exports.string(),
16661
16943
  credential: external_exports.string().optional(),
16662
16944
  isSigned: external_exports.boolean(),
@@ -16711,12 +16993,19 @@ var IssueInboxCredentialValidator = external_exports.object({
16711
16993
  templateUri: external_exports.string().optional().describe(
16712
16994
  "URI of a boost template to use for issuance. The boost credential will be resolved and used. Mutually exclusive with credential field."
16713
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(),
16714
17000
  // === OPTIONAL FEATURES ===
16715
17001
  // Add major, distinct features at the top level.
16716
17002
  //consentRequest: ConsentRequestValidator.optional(),
16717
17003
  // === PROCESS CONFIGURATION (Optional) ===
16718
17004
  // HOW should this issuance be handled?
16719
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
+ ),
16720
17009
  signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe(
16721
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."
16722
17011
  ),
@@ -16770,17 +17059,130 @@ var IssueInboxCredentialValidator = external_exports.object({
16770
17059
  }).optional().describe(
16771
17060
  "Configuration for the credential issuance. If not provided, the default configuration will be used."
16772
17061
  )
17062
+ }).refine((data) => !data.idempotencyKey || data.refresh === true, {
17063
+ message: "idempotencyKey requires refresh: true."
16773
17064
  }).refine((data) => data.credential || data.templateUri, {
16774
17065
  message: "Either credential or templateUri must be provided.",
16775
17066
  path: ["credential"]
16776
- });
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
+ );
16777
17074
  var IssueInboxCredentialResponseValidator = external_exports.object({
17075
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
16778
17076
  issuanceId: external_exports.string(),
16779
17077
  status: LCNInboxStatusEnumValidator,
16780
17078
  recipient: ContactMethodQueryValidator,
16781
17079
  claimUrl: external_exports.string().url().optional(),
16782
17080
  recipientDid: external_exports.string().optional()
16783
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
+ });
16784
17186
  var CredentialNameRefValidator = external_exports.object({ name: external_exports.string() }).passthrough();
16785
17187
  var ClaimInboxCredentialValidator = external_exports.object({
16786
17188
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
@@ -17266,6 +17668,7 @@ var CredentialActivityValidator = external_exports.object({
17266
17668
  eventType: CredentialActivityEventTypeValidator,
17267
17669
  timestamp: external_exports.string(),
17268
17670
  actorProfileId: external_exports.string().optional(),
17671
+ onBehalfOf: external_exports.string().optional(),
17269
17672
  recipientType: CredentialActivityRecipientTypeValidator,
17270
17673
  recipientIdentifier: external_exports.string(),
17271
17674
  boostUri: external_exports.string().optional(),
@@ -17429,190 +17832,3 @@ var parseInAppMessagesFlag = /* @__PURE__ */ __name((raw) => {
17429
17832
  const result = inAppMessagesFlagValidator.safeParse(raw);
17430
17833
  return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
17431
17834
  }, "parseInAppMessagesFlag");
17432
-
17433
- // src/credential-refresh.ts
17434
- var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
17435
- var ManagedCredentialRefreshServiceValidator = external_exports.object({
17436
- id: external_exports.string().min(1),
17437
- type: external_exports.literal("LearnCardCredentialRefresh2026"),
17438
- authorization: LearnCardRefreshAuthorizationValidator.optional()
17439
- }).catchall(external_exports.any());
17440
- var StandardCredentialRefreshServiceValidator = external_exports.object({
17441
- id: external_exports.string().min(1),
17442
- type: external_exports.literal("1EdTechCredentialRefresh")
17443
- }).catchall(external_exports.any());
17444
- var SupportedCredentialRefreshServiceValidator = external_exports.union([
17445
- ManagedCredentialRefreshServiceValidator,
17446
- StandardCredentialRefreshServiceValidator
17447
- ]);
17448
- var AllocateCredentialRefreshInputValidator = external_exports.object({
17449
- holder: external_exports.object({
17450
- profileId: external_exports.string().optional(),
17451
- did: external_exports.string().min(1)
17452
- }),
17453
- credentialId: external_exports.string().min(1)
17454
- });
17455
- var AllocateCredentialRefreshResultValidator = external_exports.object({
17456
- refreshId: external_exports.string().min(1),
17457
- refreshService: ManagedCredentialRefreshServiceValidator.extend({
17458
- authorization: LearnCardRefreshAuthorizationValidator
17459
- })
17460
- });
17461
- var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
17462
- var PublishCredentialRefreshBaseFields = {
17463
- refreshId: external_exports.string().min(1),
17464
- notifyHolder: external_exports.boolean().optional(),
17465
- updateSummary: external_exports.string().optional(),
17466
- idempotencyKey: external_exports.string().optional()
17467
- };
17468
- var PublishIssuerSignedRefreshValidator = external_exports.object({
17469
- ...PublishCredentialRefreshBaseFields,
17470
- mode: external_exports.literal("issuer-signed"),
17471
- signedCredential: VCValidator
17472
- });
17473
- var PublishSigningAuthorityRefreshValidator = external_exports.object({
17474
- ...PublishCredentialRefreshBaseFields,
17475
- mode: external_exports.literal("signing-authority"),
17476
- credential: UnsignedVCValidator,
17477
- signingAuthority: external_exports.object({
17478
- type: external_exports.string().min(1)
17479
- }).catchall(external_exports.any())
17480
- });
17481
- var PublishCredentialRefreshInputValidator = external_exports.object({
17482
- ...PublishCredentialRefreshBaseFields,
17483
- mode: CredentialRefreshSigningModeValidator,
17484
- signedCredential: VCValidator.optional(),
17485
- credential: UnsignedVCValidator.optional(),
17486
- signingAuthority: external_exports.object({
17487
- type: external_exports.string().min(1)
17488
- }).catchall(external_exports.any()).optional()
17489
- }).superRefine((input, ctx) => {
17490
- if (input.mode === "issuer-signed" && !input.signedCredential) {
17491
- ctx.addIssue({
17492
- code: "custom",
17493
- path: ["signedCredential"],
17494
- message: "signedCredential is required for issuer-signed publication"
17495
- });
17496
- }
17497
- if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
17498
- ctx.addIssue({
17499
- code: "custom",
17500
- path: ["mode"],
17501
- message: "issuer-signed publication cannot include signing-authority fields"
17502
- });
17503
- }
17504
- if (input.mode === "signing-authority") {
17505
- if (input.signedCredential !== void 0) {
17506
- ctx.addIssue({
17507
- code: "custom",
17508
- path: ["signedCredential"],
17509
- message: "signing-authority publication cannot include signedCredential"
17510
- });
17511
- }
17512
- if (!input.credential) {
17513
- ctx.addIssue({
17514
- code: "custom",
17515
- path: ["credential"],
17516
- message: "credential is required for signing-authority publication"
17517
- });
17518
- }
17519
- if (!input.signingAuthority) {
17520
- ctx.addIssue({
17521
- code: "custom",
17522
- path: ["signingAuthority"],
17523
- message: "signingAuthority is required for signing-authority publication"
17524
- });
17525
- }
17526
- }
17527
- });
17528
- var PublishCredentialRefreshNotificationValidator = external_exports.enum([
17529
- "queued",
17530
- "suppressed",
17531
- "not-applicable",
17532
- /** Publication succeeded, but the post-commit notification enqueue must be retried. */
17533
- "delivery-failed"
17534
- ]);
17535
- var PublishCredentialRefreshResultValidator = external_exports.object({
17536
- refreshId: external_exports.string().min(1),
17537
- version: external_exports.number().int().positive(),
17538
- publishedAt: external_exports.string().min(1),
17539
- notification: PublishCredentialRefreshNotificationValidator
17540
- });
17541
- var CredentialRefreshVersionMetadataValidator = external_exports.object({
17542
- version: external_exports.number().int().positive(),
17543
- publishedAt: external_exports.string().min(1),
17544
- effectiveAt: external_exports.string().optional(),
17545
- etag: external_exports.string().optional(),
17546
- signingMode: CredentialRefreshSigningModeValidator.optional(),
17547
- updateSummary: external_exports.string().optional()
17548
- });
17549
- var GetCredentialRefreshHistoryInputValidator = external_exports.object({
17550
- refreshId: external_exports.string().min(1),
17551
- cursor: external_exports.string().optional(),
17552
- limit: external_exports.number().int().positive().optional()
17553
- });
17554
- var GetCredentialRefreshHistoryResultValidator = external_exports.object({
17555
- records: CredentialRefreshVersionMetadataValidator.array(),
17556
- hasMore: external_exports.boolean(),
17557
- cursor: external_exports.string().optional()
17558
- });
17559
- var CredentialRefreshChallengeValidator = external_exports.object({
17560
- challenge: external_exports.string().min(1),
17561
- expiresAt: external_exports.string().min(1),
17562
- domain: external_exports.string().optional(),
17563
- scheme: external_exports.literal("LearnCardDIDAuth").optional()
17564
- });
17565
- var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
17566
- format: external_exports.literal("vc"),
17567
- credential: VCValidator,
17568
- etag: external_exports.string().optional()
17569
- });
17570
- var JweCredentialRefreshEnvelopeValidator = external_exports.object({
17571
- format: external_exports.literal("jwe"),
17572
- jwe: JWEValidator,
17573
- etag: external_exports.string().optional(),
17574
- /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
17575
- version: external_exports.number().int().positive().optional()
17576
- });
17577
- var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
17578
- PublicCredentialRefreshEnvelopeValidator,
17579
- JweCredentialRefreshEnvelopeValidator
17580
- ]);
17581
- var CredentialRefreshFailureCodeValidator = external_exports.enum([
17582
- "UNAVAILABLE",
17583
- "TIMEOUT",
17584
- "UNSUPPORTED_SERVICE",
17585
- "UNAUTHORIZED",
17586
- "MALFORMED_RESPONSE",
17587
- "INVALID_PROOF",
17588
- "ISSUER_MISMATCH",
17589
- "ID_MISMATCH",
17590
- "ROLLBACK",
17591
- "REVOKED",
17592
- "UNSAFE_ENDPOINT"
17593
- ]);
17594
- var CredentialRefreshUpdatedResultValidator = external_exports.object({
17595
- status: external_exports.literal("updated"),
17596
- credential: VCValidator,
17597
- etag: external_exports.string().optional(),
17598
- managedVersion: external_exports.number().int().positive().optional()
17599
- });
17600
- var CredentialRefreshUnchangedResultValidator = external_exports.object({
17601
- status: external_exports.literal("unchanged"),
17602
- checkedAt: external_exports.string().min(1),
17603
- etag: external_exports.string().optional()
17604
- });
17605
- var CredentialRefreshUnsupportedResultValidator = external_exports.object({
17606
- status: external_exports.literal("unsupported")
17607
- });
17608
- var CredentialRefreshFailedResultValidator = external_exports.object({
17609
- status: external_exports.literal("failed"),
17610
- code: CredentialRefreshFailureCodeValidator,
17611
- retryable: external_exports.boolean()
17612
- });
17613
- var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
17614
- CredentialRefreshUpdatedResultValidator,
17615
- CredentialRefreshUnchangedResultValidator,
17616
- CredentialRefreshUnsupportedResultValidator,
17617
- CredentialRefreshFailedResultValidator
17618
- ]);