@learncard/react 2.12.6 → 2.12.8

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.
Files changed (102) hide show
  1. package/dist/cjs/{BoostGenericCard-eba2c7f3.js → BoostGenericCard-64c11fe1.js} +4 -4
  2. package/dist/cjs/BoostGenericCard-64c11fe1.js.map +1 -0
  3. package/dist/cjs/{CertificateDisplayCard-e66ebcfb.js → CertificateDisplayCard-b5e72ee5.js} +3 -3
  4. package/dist/cjs/{CertificateDisplayCard-e66ebcfb.js.map → CertificateDisplayCard-b5e72ee5.js.map} +1 -1
  5. package/dist/cjs/{MeritBadgeDisplayCard-10badbae.js → MeritBadgeDisplayCard-50423eeb.js} +3 -3
  6. package/dist/cjs/{MeritBadgeDisplayCard-10badbae.js.map → MeritBadgeDisplayCard-50423eeb.js.map} +1 -1
  7. package/dist/cjs/{MeritBadgeSkillsCount-8c2a6cab.js → MeritBadgeSkillsCount-f121a3db.js} +2 -2
  8. package/dist/cjs/{MeritBadgeSkillsCount-8c2a6cab.js.map → MeritBadgeSkillsCount-f121a3db.js.map} +1 -1
  9. package/dist/cjs/{SchoolIDCard-10796199.js → SchoolIDCard-2d3cbb2c.js} +3 -1184
  10. package/dist/cjs/SchoolIDCard-2d3cbb2c.js.map +1 -0
  11. package/dist/cjs/{VCCard-cc89948b.js → VCCard-72ec54b5.js} +3 -3
  12. package/dist/cjs/{VCCard-cc89948b.js.map → VCCard-72ec54b5.js.map} +1 -1
  13. package/dist/cjs/{VCDisplayBackFace-e4107c55.js → VCDisplayBackFace-c6204dda.js} +3 -3
  14. package/dist/cjs/{VCDisplayBackFace-e4107c55.js.map → VCDisplayBackFace-c6204dda.js.map} +1 -1
  15. package/dist/cjs/{VCDisplayCard-0b4e99c0.js → VCDisplayCard-e0fbeb3c.js} +3 -3
  16. package/dist/cjs/{VCDisplayCard-0b4e99c0.js.map → VCDisplayCard-e0fbeb3c.js.map} +1 -1
  17. package/dist/cjs/{VCDisplayCard2-5c7c0ff7.js → VCDisplayCard2-5d805202.js} +17 -7
  18. package/dist/cjs/VCDisplayCard2-5d805202.js.map +1 -0
  19. package/dist/cjs/{VCVerificationPill-ed387f6e.js → VCVerificationPill-90e6ab77.js} +2 -2
  20. package/dist/cjs/{VCVerificationPill-ed387f6e.js.map → VCVerificationPill-90e6ab77.js.map} +1 -1
  21. package/dist/cjs/{credential.helpers-9a9ad225.js → credential.helpers-0f0e8f00.js} +2 -2
  22. package/dist/cjs/{credential.helpers-9a9ad225.js.map → credential.helpers-0f0e8f00.js.map} +1 -1
  23. package/dist/cjs/index-47efbf5b.js +1186 -0
  24. package/dist/cjs/index-47efbf5b.js.map +1 -0
  25. package/dist/cjs/index.js +13 -12
  26. package/dist/cjs/index.js.map +1 -1
  27. package/dist/cjs/index14.js +13 -12
  28. package/dist/cjs/index14.js.map +1 -1
  29. package/dist/cjs/index22.js +4 -4
  30. package/dist/cjs/index31.js +2 -1
  31. package/dist/cjs/index31.js.map +1 -1
  32. package/dist/cjs/index39.js +10 -9
  33. package/dist/cjs/index39.js.map +1 -1
  34. package/dist/cjs/index4.js +3 -3
  35. package/dist/cjs/index40.js +4 -4
  36. package/dist/cjs/index41.js +5 -5
  37. package/dist/cjs/index42.js +6 -5
  38. package/dist/cjs/index42.js.map +1 -1
  39. package/dist/cjs/index43.js +1 -1
  40. package/dist/cjs/index46.js +2 -2
  41. package/dist/cjs/index7.js +3 -3
  42. package/dist/cjs/{types.esm-ba95174e.js → types.esm-9062360c.js} +800 -167
  43. package/dist/cjs/types.esm-9062360c.js.map +1 -0
  44. package/dist/esm/{BoostGenericCard-26502a81.js → BoostGenericCard-a2c5d561.js} +4 -4
  45. package/dist/esm/BoostGenericCard-a2c5d561.js.map +1 -0
  46. package/dist/esm/{CertificateDisplayCard-0de68029.js → CertificateDisplayCard-68d8d6ee.js} +3 -3
  47. package/dist/esm/{CertificateDisplayCard-0de68029.js.map → CertificateDisplayCard-68d8d6ee.js.map} +1 -1
  48. package/dist/esm/{MeritBadgeDisplayCard-e569e17f.js → MeritBadgeDisplayCard-7a32129d.js} +3 -3
  49. package/dist/esm/{MeritBadgeDisplayCard-e569e17f.js.map → MeritBadgeDisplayCard-7a32129d.js.map} +1 -1
  50. package/dist/esm/{MeritBadgeSkillsCount-d8d234a2.js → MeritBadgeSkillsCount-f0a53047.js} +2 -2
  51. package/dist/esm/{MeritBadgeSkillsCount-d8d234a2.js.map → MeritBadgeSkillsCount-f0a53047.js.map} +1 -1
  52. package/dist/esm/{SchoolIDCard-f82e40bc.js → SchoolIDCard-fbd1cf6c.js} +2 -1183
  53. package/dist/esm/SchoolIDCard-fbd1cf6c.js.map +1 -0
  54. package/dist/esm/{VCCard-6376f382.js → VCCard-a117cfd8.js} +3 -3
  55. package/dist/esm/{VCCard-6376f382.js.map → VCCard-a117cfd8.js.map} +1 -1
  56. package/dist/esm/{VCDisplayBackFace-2bf451a6.js → VCDisplayBackFace-2381affa.js} +3 -3
  57. package/dist/esm/{VCDisplayBackFace-2bf451a6.js.map → VCDisplayBackFace-2381affa.js.map} +1 -1
  58. package/dist/esm/{VCDisplayCard-ae88779a.js → VCDisplayCard-52e66021.js} +3 -3
  59. package/dist/esm/{VCDisplayCard-ae88779a.js.map → VCDisplayCard-52e66021.js.map} +1 -1
  60. package/dist/esm/{VCDisplayCard2-116d823d.js → VCDisplayCard2-b3b641a1.js} +17 -7
  61. package/dist/esm/VCDisplayCard2-b3b641a1.js.map +1 -0
  62. package/dist/esm/{VCVerificationPill-7cc43650.js → VCVerificationPill-680c4e23.js} +2 -2
  63. package/dist/esm/{VCVerificationPill-7cc43650.js.map → VCVerificationPill-680c4e23.js.map} +1 -1
  64. package/dist/esm/{credential.helpers-d71e692a.js → credential.helpers-43119589.js} +2 -2
  65. package/dist/esm/{credential.helpers-d71e692a.js.map → credential.helpers-43119589.js.map} +1 -1
  66. package/dist/esm/index-cbd2e9db.js +1184 -0
  67. package/dist/esm/index-cbd2e9db.js.map +1 -0
  68. package/dist/esm/index.js +13 -12
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/index14.js +13 -12
  71. package/dist/esm/index14.js.map +1 -1
  72. package/dist/esm/index22.js +4 -4
  73. package/dist/esm/index31.js +2 -1
  74. package/dist/esm/index31.js.map +1 -1
  75. package/dist/esm/index39.js +10 -9
  76. package/dist/esm/index39.js.map +1 -1
  77. package/dist/esm/index4.js +3 -3
  78. package/dist/esm/index40.js +4 -4
  79. package/dist/esm/index41.js +5 -5
  80. package/dist/esm/index42.js +6 -5
  81. package/dist/esm/index42.js.map +1 -1
  82. package/dist/esm/index43.js +1 -1
  83. package/dist/esm/index46.js +2 -2
  84. package/dist/esm/index7.js +3 -3
  85. package/dist/esm/{types.esm-35d4f5e9.js → types.esm-b9cb7331.js} +800 -167
  86. package/dist/esm/types.esm-b9cb7331.js.map +1 -0
  87. package/dist/main.css +1 -1
  88. package/dist/main.js +1 -1
  89. package/package.json +4 -4
  90. package/src/assets/styles/main.css +10 -0
  91. package/src/components/BoostGenericCard/BoostGenericCard.stories.tsx +41 -1
  92. package/src/components/BoostGenericCard/BoostGenericCard.tsx +2 -2
  93. package/src/components/BoostGenericCard/__tests__/BoostGenericCard.a11y.test.tsx +25 -0
  94. package/src/components/VCDisplayCard2/VCIDDisplayFrontFace.tsx +8 -2
  95. package/dist/cjs/BoostGenericCard-eba2c7f3.js.map +0 -1
  96. package/dist/cjs/SchoolIDCard-10796199.js.map +0 -1
  97. package/dist/cjs/VCDisplayCard2-5c7c0ff7.js.map +0 -1
  98. package/dist/cjs/types.esm-ba95174e.js.map +0 -1
  99. package/dist/esm/BoostGenericCard-26502a81.js.map +0 -1
  100. package/dist/esm/SchoolIDCard-f82e40bc.js.map +0 -1
  101. package/dist/esm/VCDisplayCard2-116d823d.js.map +0 -1
  102. package/dist/esm/types.esm-35d4f5e9.js.map +0 -1
@@ -7408,6 +7408,7 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7408
7408
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7409
7409
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7410
7410
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7411
+ var __pow = Math.pow;
7411
7412
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7412
7413
  var __spreadValues = (a, b) => {
7413
7414
  for (var prop in b || (b = {}))
@@ -8009,6 +8010,201 @@ var StringQuery = union([
8009
8010
  $or: BaseStringQuery.array()
8010
8011
  })
8011
8012
  ]);
8013
+ var LearnCardRefreshAuthorizationValidator = object({ type: literal("LearnCardDIDAuth") }).catchall(any());
8014
+ var ManagedCredentialRefreshServiceValidator = object({
8015
+ id: string().min(1),
8016
+ type: literal("LearnCardCredentialRefresh2026"),
8017
+ authorization: LearnCardRefreshAuthorizationValidator.optional()
8018
+ }).catchall(any());
8019
+ var StandardCredentialRefreshServiceValidator = object({
8020
+ id: string().min(1),
8021
+ type: literal("1EdTechCredentialRefresh")
8022
+ }).catchall(any());
8023
+ union([
8024
+ ManagedCredentialRefreshServiceValidator,
8025
+ StandardCredentialRefreshServiceValidator
8026
+ ]);
8027
+ object({
8028
+ holder: object({
8029
+ profileId: string().optional(),
8030
+ did: string().min(1)
8031
+ }),
8032
+ credentialId: string().min(1)
8033
+ });
8034
+ object({
8035
+ refreshId: string().min(1),
8036
+ refreshService: ManagedCredentialRefreshServiceValidator.extend({
8037
+ authorization: LearnCardRefreshAuthorizationValidator
8038
+ })
8039
+ });
8040
+ var ManagedCredentialRefreshReceiptValidator = object({
8041
+ refreshId: string().min(1),
8042
+ refreshService: ManagedCredentialRefreshServiceValidator,
8043
+ credentialId: string().min(1),
8044
+ issuerDid: string().min(1),
8045
+ holderDid: string().min(1),
8046
+ credentialStatus: CredentialStatusValidator.or(
8047
+ CredentialStatusValidator.array()
8048
+ ).optional()
8049
+ }).strip();
8050
+ var InboxCredentialRefreshReceiptValidator = ManagedCredentialRefreshReceiptValidator.omit(
8051
+ { holderDid: true }
8052
+ ).extend({ holderDid: string().min(1).optional() });
8053
+ var CredentialRefreshSigningModeValidator = _enum(["issuer-signed", "signing-authority"]);
8054
+ var PublishCredentialRefreshBaseFields = {
8055
+ refreshId: string().min(1),
8056
+ notifyHolder: boolean().optional(),
8057
+ updateSummary: string().optional(),
8058
+ idempotencyKey: string().optional()
8059
+ };
8060
+ object(__spreadProps(__spreadValues({}, PublishCredentialRefreshBaseFields), {
8061
+ mode: literal("issuer-signed"),
8062
+ signedCredential: VCValidator
8063
+ }));
8064
+ object(__spreadProps(__spreadValues({}, PublishCredentialRefreshBaseFields), {
8065
+ mode: literal("signing-authority"),
8066
+ credential: UnsignedVCValidator,
8067
+ signingAuthority: object({
8068
+ type: string().min(1)
8069
+ }).catchall(any())
8070
+ }));
8071
+ object(__spreadProps(__spreadValues({}, PublishCredentialRefreshBaseFields), {
8072
+ mode: CredentialRefreshSigningModeValidator,
8073
+ signedCredential: VCValidator.optional(),
8074
+ credential: UnsignedVCValidator.optional(),
8075
+ signingAuthority: object({
8076
+ type: string().min(1)
8077
+ }).catchall(any()).optional()
8078
+ })).superRefine((input, ctx) => {
8079
+ if (input.mode === "issuer-signed" && !input.signedCredential) {
8080
+ ctx.addIssue({
8081
+ code: "custom",
8082
+ path: ["signedCredential"],
8083
+ message: "signedCredential is required for issuer-signed publication"
8084
+ });
8085
+ }
8086
+ if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
8087
+ ctx.addIssue({
8088
+ code: "custom",
8089
+ path: ["mode"],
8090
+ message: "issuer-signed publication cannot include signing-authority fields"
8091
+ });
8092
+ }
8093
+ if (input.mode === "signing-authority") {
8094
+ if (input.signedCredential !== void 0) {
8095
+ ctx.addIssue({
8096
+ code: "custom",
8097
+ path: ["signedCredential"],
8098
+ message: "signing-authority publication cannot include signedCredential"
8099
+ });
8100
+ }
8101
+ if (!input.credential) {
8102
+ ctx.addIssue({
8103
+ code: "custom",
8104
+ path: ["credential"],
8105
+ message: "credential is required for signing-authority publication"
8106
+ });
8107
+ }
8108
+ if (!input.signingAuthority) {
8109
+ ctx.addIssue({
8110
+ code: "custom",
8111
+ path: ["signingAuthority"],
8112
+ message: "signingAuthority is required for signing-authority publication"
8113
+ });
8114
+ }
8115
+ }
8116
+ });
8117
+ var PublishCredentialRefreshNotificationValidator = _enum([
8118
+ "queued",
8119
+ "suppressed",
8120
+ "not-applicable",
8121
+ /** Publication succeeded, but the post-commit notification enqueue must be retried. */
8122
+ "delivery-failed"
8123
+ ]);
8124
+ object({
8125
+ refreshId: string().min(1),
8126
+ version: number().int().positive(),
8127
+ publishedAt: string().min(1),
8128
+ notification: PublishCredentialRefreshNotificationValidator
8129
+ });
8130
+ var CredentialRefreshVersionMetadataValidator = object({
8131
+ version: number().int().positive(),
8132
+ publishedAt: string().min(1),
8133
+ effectiveAt: string().optional(),
8134
+ etag: string().optional(),
8135
+ signingMode: CredentialRefreshSigningModeValidator.optional(),
8136
+ updateSummary: string().optional()
8137
+ });
8138
+ object({
8139
+ refreshId: string().min(1),
8140
+ cursor: string().optional(),
8141
+ limit: number().int().positive().optional()
8142
+ });
8143
+ object({
8144
+ records: CredentialRefreshVersionMetadataValidator.array(),
8145
+ hasMore: boolean(),
8146
+ cursor: string().optional()
8147
+ });
8148
+ object({
8149
+ challenge: string().min(1),
8150
+ expiresAt: string().min(1),
8151
+ domain: string().optional(),
8152
+ scheme: literal("LearnCardDIDAuth").optional()
8153
+ });
8154
+ var PublicCredentialRefreshEnvelopeValidator = object({
8155
+ format: literal("vc"),
8156
+ credential: VCValidator,
8157
+ etag: string().optional()
8158
+ });
8159
+ var JweCredentialRefreshEnvelopeValidator = object({
8160
+ format: literal("jwe"),
8161
+ jwe: JWEValidator,
8162
+ etag: string().optional(),
8163
+ /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
8164
+ version: number().int().positive().optional()
8165
+ });
8166
+ discriminatedUnion("format", [
8167
+ PublicCredentialRefreshEnvelopeValidator,
8168
+ JweCredentialRefreshEnvelopeValidator
8169
+ ]);
8170
+ var CredentialRefreshFailureCodeValidator = _enum([
8171
+ "UNAVAILABLE",
8172
+ "TIMEOUT",
8173
+ "UNSUPPORTED_SERVICE",
8174
+ "UNAUTHORIZED",
8175
+ "MALFORMED_RESPONSE",
8176
+ "INVALID_PROOF",
8177
+ "ISSUER_MISMATCH",
8178
+ "ID_MISMATCH",
8179
+ "ROLLBACK",
8180
+ "REVOKED",
8181
+ "UNSAFE_ENDPOINT"
8182
+ ]);
8183
+ var CredentialRefreshUpdatedResultValidator = object({
8184
+ status: literal("updated"),
8185
+ credential: VCValidator,
8186
+ etag: string().optional(),
8187
+ managedVersion: number().int().positive().optional()
8188
+ });
8189
+ var CredentialRefreshUnchangedResultValidator = object({
8190
+ status: literal("unchanged"),
8191
+ checkedAt: string().min(1),
8192
+ etag: string().optional()
8193
+ });
8194
+ var CredentialRefreshUnsupportedResultValidator = object({
8195
+ status: literal("unsupported")
8196
+ });
8197
+ var CredentialRefreshFailedResultValidator = object({
8198
+ status: literal("failed"),
8199
+ code: CredentialRefreshFailureCodeValidator,
8200
+ retryable: boolean()
8201
+ });
8202
+ discriminatedUnion("status", [
8203
+ CredentialRefreshUpdatedResultValidator,
8204
+ CredentialRefreshUnchangedResultValidator,
8205
+ CredentialRefreshUnsupportedResultValidator,
8206
+ CredentialRefreshFailedResultValidator
8207
+ ]);
8012
8208
  var LCNProfileDisplayValidator = object({
8013
8209
  backgroundColor: string().optional(),
8014
8210
  backgroundImage: string().optional(),
@@ -8344,7 +8540,13 @@ var SendBoostInputValidator = object({
8344
8540
  "Options for email/phone recipients (Universal Inbox)"
8345
8541
  ),
8346
8542
  templateData: record(string(), unknown()).optional(),
8347
- integrationId: string().optional().describe("Integration ID for activity tracking")
8543
+ integrationId: string().optional().describe("Integration ID for activity tracking"),
8544
+ refresh: boolean().optional().describe(
8545
+ "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."
8546
+ ),
8547
+ idempotencyKey: string().min(1).max(200).optional().describe(
8548
+ "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."
8549
+ )
8348
8550
  }).refine((data) => data.templateUri || data.template || data.signedCredential, {
8349
8551
  message: "Either templateUri, template, or signedCredential must be provided.",
8350
8552
  path: ["templateUri"]
@@ -8360,8 +8562,12 @@ var SendBoostInputValidator = object({
8360
8562
  message: "guardianEmail must differ from recipient (self-approval not allowed)",
8361
8563
  path: ["options", "guardianEmail"]
8362
8564
  }
8363
- );
8565
+ ).refine((data) => !data.idempotencyKey || data.refresh === true, {
8566
+ message: "idempotencyKey is only supported with refresh: true.",
8567
+ path: ["idempotencyKey"]
8568
+ });
8364
8569
  var SendInboxResponseValidator = object({
8570
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
8365
8571
  issuanceId: string(),
8366
8572
  status: _enum(["PENDING", "ISSUED", "EXPIRED", "DELIVERED", "CLAIMED"]),
8367
8573
  claimUrl: string().url().optional().describe("Present when suppressDelivery=true"),
@@ -8376,8 +8582,34 @@ var SendBoostResponseValidator = object({
8376
8582
  activityId: string().describe("Links to the activity lifecycle for this issuance"),
8377
8583
  inbox: SendInboxResponseValidator.optional().describe(
8378
8584
  "Present when sent via email/phone (Universal Inbox)"
8585
+ ),
8586
+ refresh: ManagedCredentialRefreshReceiptValidator.optional().describe(
8587
+ "Present when managed refresh was requested: issuance metadata the issuer keeps to publish future updates"
8379
8588
  )
8380
8589
  });
8590
+ object({
8591
+ recipient: string(),
8592
+ templateUri: string().optional(),
8593
+ template: SendBoostTemplateValidator.optional(),
8594
+ contractUri: string().optional(),
8595
+ templateData: record(string(), unknown()).optional(),
8596
+ integrationId: string().optional(),
8597
+ /** Credential ID to allocate for; generated server-side when omitted. */
8598
+ credentialId: string().min(1).optional(),
8599
+ idempotencyKey: string().min(1).max(200).optional()
8600
+ }).refine((data) => Boolean(data.templateUri) !== Boolean(data.template), {
8601
+ message: "Provide exactly one of templateUri or template."
8602
+ });
8603
+ object({
8604
+ boostUri: string(),
8605
+ credentialId: string(),
8606
+ refreshId: string(),
8607
+ refreshService: ManagedCredentialRefreshServiceValidator,
8608
+ /** The DID to use as credentialSubject.id (recipient DID, or the profile's did:web). */
8609
+ holderDid: string(),
8610
+ /** Present when this idempotencyKey already completed: return it without signing. */
8611
+ completed: SendBoostResponseValidator.optional()
8612
+ });
8381
8613
  discriminatedUnion("type", [SendBoostInputValidator]);
8382
8614
  discriminatedUnion("type", [SendBoostResponseValidator]);
8383
8615
  var ConsentFlowTermsStatusValidator = _enum(["live", "stale", "withdrawn"]);
@@ -8708,6 +8940,7 @@ object({
8708
8940
  }, "error")
8709
8941
  }),
8710
8942
  scope: string(),
8943
+ actAs: string().optional(),
8711
8944
  createdAt: datetime({ error: "createdAt must be a valid ISO 8601 datetime string" }),
8712
8945
  expiresAt: datetime({ error: "expiresAt must be a valid ISO 8601 datetime string" }).nullish().optional()
8713
8946
  });
@@ -8779,6 +9012,8 @@ object({
8779
9012
  sessionJwt: string()
8780
9013
  });
8781
9014
  var InboxCredentialValidator = object({
9015
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
9016
+ refreshId: string().optional(),
8782
9017
  id: string(),
8783
9018
  credential: string().optional(),
8784
9019
  isSigned: boolean(),
@@ -8822,7 +9057,7 @@ var IssueInboxSigningAuthorityValidator = object({
8822
9057
  endpoint: string().url(),
8823
9058
  name: string()
8824
9059
  });
8825
- object({
9060
+ var IssueInboxCredentialValidator = object({
8826
9061
  // === CORE DATA (Required) ===
8827
9062
  // WHAT is being sent and WHO is it for?
8828
9063
  recipient: ContactMethodQueryValidator.describe("The recipient of the credential"),
@@ -8833,12 +9068,19 @@ object({
8833
9068
  templateUri: string().optional().describe(
8834
9069
  "URI of a boost template to use for issuance. The boost credential will be resolved and used. Mutually exclusive with credential field."
8835
9070
  ),
9071
+ refresh: boolean().optional().describe(
9072
+ "Allocate managed refresh before signing. Requires unsigned content and a registered signing authority; binds the holder on claim."
9073
+ ),
9074
+ idempotencyKey: string().min(1).max(200).optional(),
8836
9075
  // === OPTIONAL FEATURES ===
8837
9076
  // Add major, distinct features at the top level.
8838
9077
  //consentRequest: ConsentRequestValidator.optional(),
8839
9078
  // === PROCESS CONFIGURATION (Optional) ===
8840
9079
  // HOW should this issuance be handled?
8841
9080
  configuration: object({
9081
+ guardianEmail: string().email().optional().describe(
9082
+ "Require approval from this guardian before the recipient can claim. Must differ from the recipient email."
9083
+ ),
8842
9084
  signingAuthority: IssueInboxSigningAuthorityValidator.optional().describe(
8843
9085
  "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."
8844
9086
  ),
@@ -8892,17 +9134,133 @@ object({
8892
9134
  }).optional().describe(
8893
9135
  "Configuration for the credential issuance. If not provided, the default configuration will be used."
8894
9136
  )
9137
+ }).refine((data) => !data.idempotencyKey || data.refresh === true, {
9138
+ message: "idempotencyKey requires refresh: true."
8895
9139
  }).refine((data) => data.credential || data.templateUri, {
8896
9140
  message: "Either credential or templateUri must be provided.",
8897
9141
  path: ["credential"]
8898
- });
8899
- object({
9142
+ }).refine(
9143
+ (data) => {
9144
+ var _a2;
9145
+ return !((_a2 = data.configuration) == null ? void 0 : _a2.guardianEmail) || data.recipient.type !== "email" || data.configuration.guardianEmail.toLowerCase() !== data.recipient.value.toLowerCase();
9146
+ },
9147
+ {
9148
+ message: "guardianEmail must differ from recipient (self-approval not allowed)",
9149
+ path: ["configuration", "guardianEmail"]
9150
+ }
9151
+ );
9152
+ var IssueInboxCredentialResponseValidator = object({
9153
+ refresh: InboxCredentialRefreshReceiptValidator.optional(),
8900
9154
  issuanceId: string(),
8901
9155
  status: LCNInboxStatusEnumValidator,
8902
9156
  recipient: ContactMethodQueryValidator,
8903
9157
  claimUrl: string().url().optional(),
8904
9158
  recipientDid: string().optional()
8905
9159
  });
9160
+ var InboxBatchConfigurationValidator = IssueInboxCredentialValidator.shape.configuration.unwrap().extend({
9161
+ refresh: IssueInboxCredentialValidator.shape.refresh.describe(
9162
+ "Enable managed refresh by default. An item configuration.refresh overrides this value, including false."
9163
+ ),
9164
+ delivery: IssueInboxCredentialValidator.shape.configuration.unwrap().shape.delivery.unwrap().extend({ suppress: boolean().optional() }).optional()
9165
+ });
9166
+ var InboxBatchItemConfigurationValidator = InboxBatchConfigurationValidator.extend({
9167
+ guardianEmail: InboxBatchConfigurationValidator.shape.guardianEmail.nullable().describe(
9168
+ "Require guardian approval, or set null to clear a batch-level guardianEmail for this item."
9169
+ )
9170
+ });
9171
+ var IssueInboxCredentialBatchItemValidator = object(__spreadProps(__spreadValues({}, IssueInboxCredentialValidator.shape), {
9172
+ configuration: InboxBatchItemConfigurationValidator.optional(),
9173
+ idempotencyKey: string().max(256).optional()
9174
+ })).refine((data) => data.credential || data.templateUri, {
9175
+ message: "Either credential or templateUri must be provided.",
9176
+ path: ["credential"]
9177
+ }).describe(
9178
+ "One issuance: provide credential or templateUri. Invalid input is rejected at submission with its item index."
9179
+ );
9180
+ object({
9181
+ requestId: string().min(1).max(256).optional(),
9182
+ items: array(IssueInboxCredentialBatchItemValidator).min(1).max(100),
9183
+ configuration: InboxBatchConfigurationValidator.optional()
9184
+ }).superRefine((batch, ctx) => {
9185
+ batch.items.forEach((item, index) => {
9186
+ var _a2, _b;
9187
+ const itemGuardian = (_a2 = item.configuration) == null ? void 0 : _a2.guardianEmail;
9188
+ const guardian = itemGuardian === null ? void 0 : itemGuardian != null ? itemGuardian : (_b = batch.configuration) == null ? void 0 : _b.guardianEmail;
9189
+ if (guardian && item.recipient.type === "email" && guardian.toLowerCase() === item.recipient.value.toLowerCase()) {
9190
+ ctx.addIssue({
9191
+ code: "custom",
9192
+ path: ["items", index, "configuration", "guardianEmail"],
9193
+ message: "guardianEmail must differ from recipient (self-approval not allowed)"
9194
+ });
9195
+ }
9196
+ });
9197
+ });
9198
+ var InboxBatchErrorReasonValidator = _enum([
9199
+ "DUPLICATE_KEY",
9200
+ "IDEMPOTENCY_MISMATCH",
9201
+ "IN_PROGRESS",
9202
+ "UNCONFIRMED"
9203
+ ]);
9204
+ var IssueInboxCredentialBatchItemResultValidator = discriminatedUnion("success", [
9205
+ IssueInboxCredentialResponseValidator.extend({
9206
+ success: literal(true),
9207
+ index: number().int().nonnegative(),
9208
+ deduplicated: boolean().optional(),
9209
+ guardianStatus: GuardianStatusValidator.optional(),
9210
+ idempotencyKey: string().optional()
9211
+ }),
9212
+ object({
9213
+ success: literal(false),
9214
+ index: number().int().nonnegative(),
9215
+ idempotencyKey: string().optional(),
9216
+ recipient: ContactMethodQueryValidator.optional(),
9217
+ error: object({
9218
+ code: string(),
9219
+ message: string(),
9220
+ reason: InboxBatchErrorReasonValidator.optional()
9221
+ }),
9222
+ issuanceId: string().optional().describe(
9223
+ "Present when issuance completed but replay storage could not be confirmed. Reconcile this issuance; do not issue again with a new key."
9224
+ ),
9225
+ claimUrl: string().url().optional().describe(
9226
+ "Claim URL of the completed issuance, if available, when replay storage could not be confirmed."
9227
+ )
9228
+ })
9229
+ ]);
9230
+ var IssueInboxCredentialBatchResponseValidator = object({
9231
+ results: array(IssueInboxCredentialBatchItemResultValidator),
9232
+ summary: object({
9233
+ total: number(),
9234
+ succeeded: number(),
9235
+ failed: number(),
9236
+ deduplicated: number()
9237
+ })
9238
+ });
9239
+ object({
9240
+ batchId: string(),
9241
+ status: _enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
9242
+ createdAt: string()
9243
+ });
9244
+ object({
9245
+ batchId: string(),
9246
+ createdAt: string(),
9247
+ done: boolean().describe(
9248
+ "True when no queued or processing items remain, including unconfirmed outcomes."
9249
+ ),
9250
+ status: _enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
9251
+ items: array(
9252
+ object({
9253
+ index: number().int().nonnegative(),
9254
+ state: _enum(["QUEUED", "PROCESSING", "COMPLETED", "NEEDS_RECONCILIATION"]),
9255
+ result: IssueInboxCredentialBatchItemResultValidator.optional()
9256
+ })
9257
+ ),
9258
+ summary: IssueInboxCredentialBatchResponseValidator.shape.summary.extend({
9259
+ completed: number(),
9260
+ pending: number(),
9261
+ unconfirmed: number()
9262
+ })
9263
+ });
8906
9264
  var CredentialNameRefValidator = object({ name: string() }).passthrough();
8907
9265
  object({
8908
9266
  credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
@@ -9388,6 +9746,7 @@ var CredentialActivityValidator = object({
9388
9746
  eventType: CredentialActivityEventTypeValidator,
9389
9747
  timestamp: string(),
9390
9748
  actorProfileId: string().optional(),
9749
+ onBehalfOf: string().optional(),
9391
9750
  recipientType: CredentialActivityRecipientTypeValidator,
9392
9751
  recipientIdentifier: string(),
9393
9752
  boostUri: string().optional(),
@@ -9428,6 +9787,12 @@ object({
9428
9787
  this.name = "AuthSessionError";
9429
9788
  }
9430
9789
  }, __name(_a, "AuthSessionError"), _a);
9790
+ object({
9791
+ state: _enum(["none", "enabled", "locked", "stale"]),
9792
+ enabled: boolean(),
9793
+ attemptsRemaining: number().int().nonnegative(),
9794
+ salt: string().optional()
9795
+ });
9431
9796
  var BITSTRING_STATUS_PURPOSES = ["revocation", "suspension"];
9432
9797
  var BitstringStatusPurposeValidator = _enum(BITSTRING_STATUS_PURPOSES);
9433
9798
  var BitstringStatusListEntryValidator = object({
@@ -9536,188 +9901,456 @@ object({
9536
9901
  version: number().default(1),
9537
9902
  messages: array(inAppMessageValidator).default([])
9538
9903
  }).passthrough();
9539
- var LearnCardRefreshAuthorizationValidator = object({ type: literal("LearnCardDIDAuth") }).catchall(any());
9540
- var ManagedCredentialRefreshServiceValidator = object({
9541
- id: string().min(1),
9542
- type: literal("LearnCardCredentialRefresh2026"),
9543
- authorization: LearnCardRefreshAuthorizationValidator.optional()
9544
- }).catchall(any());
9545
- var StandardCredentialRefreshServiceValidator = object({
9546
- id: string().min(1),
9547
- type: literal("1EdTechCredentialRefresh")
9548
- }).catchall(any());
9549
- union([
9550
- ManagedCredentialRefreshServiceValidator,
9551
- StandardCredentialRefreshServiceValidator
9552
- ]);
9553
- object({
9554
- holder: object({
9555
- profileId: string().optional(),
9556
- did: string().min(1)
9557
- }),
9558
- credentialId: string().min(1)
9559
- });
9560
- object({
9561
- refreshId: string().min(1),
9562
- refreshService: ManagedCredentialRefreshServiceValidator.extend({
9563
- authorization: LearnCardRefreshAuthorizationValidator
9564
- })
9565
- });
9566
- var CredentialRefreshSigningModeValidator = _enum(["issuer-signed", "signing-authority"]);
9567
- var PublishCredentialRefreshBaseFields = {
9568
- refreshId: string().min(1),
9569
- notifyHolder: boolean().optional(),
9570
- updateSummary: string().optional(),
9571
- idempotencyKey: string().optional()
9572
- };
9573
- object(__spreadProps(__spreadValues({}, PublishCredentialRefreshBaseFields), {
9574
- mode: literal("issuer-signed"),
9575
- signedCredential: VCValidator
9576
- }));
9577
- object(__spreadProps(__spreadValues({}, PublishCredentialRefreshBaseFields), {
9578
- mode: literal("signing-authority"),
9579
- credential: UnsignedVCValidator,
9580
- signingAuthority: object({
9581
- type: string().min(1)
9582
- }).catchall(any())
9583
- }));
9584
- object(__spreadProps(__spreadValues({}, PublishCredentialRefreshBaseFields), {
9585
- mode: CredentialRefreshSigningModeValidator,
9586
- signedCredential: VCValidator.optional(),
9587
- credential: UnsignedVCValidator.optional(),
9588
- signingAuthority: object({
9589
- type: string().min(1)
9590
- }).catchall(any()).optional()
9591
- })).superRefine((input, ctx) => {
9592
- if (input.mode === "issuer-signed" && !input.signedCredential) {
9593
- ctx.addIssue({
9594
- code: "custom",
9595
- path: ["signedCredential"],
9596
- message: "signedCredential is required for issuer-signed publication"
9597
- });
9904
+ var SHARE_LINK_ID_BYTES = 16;
9905
+ var SHARE_CONTENT_KEY_BYTES = 32;
9906
+ var SHARE_IV_BYTES = 12;
9907
+ var SHARE_TAG_BYTES = 16;
9908
+ var MAX_SHARE_CIPHERTEXT_BYTES = 512 * 1024;
9909
+ var MAX_SHARE_RECOVERY_JWE_BYTES = 64 * 1024;
9910
+ var MAX_SELECTED_CREDENTIALS = 50;
9911
+ var MAX_ENDORSEMENTS = 200;
9912
+ var MAX_VP_MEMBERS = MAX_SELECTED_CREDENTIALS + MAX_ENDORSEMENTS;
9913
+ var MAX_SHARE_SOURCE_URI_CHARS = 2048;
9914
+ var SHARE_LINK_PROTOCOL = "lc-share/v1";
9915
+ var SHARE_RECOVERY_PROTOCOL = "lc-share-recovery/v1";
9916
+ var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
9917
+ var BASE64URL_LOOKUP = (() => {
9918
+ const table = new Int16Array(128).fill(-1);
9919
+ for (let index = 0; index < BASE64URL_ALPHABET.length; index += 1) {
9920
+ table[BASE64URL_ALPHABET.charCodeAt(index)] = index;
9598
9921
  }
9599
- if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
9922
+ return table;
9923
+ })();
9924
+ var encodeBase64Url = /* @__PURE__ */ __name((bytes) => {
9925
+ let output = "";
9926
+ for (let index = 0; index < bytes.length; index += 3) {
9927
+ const first = bytes[index];
9928
+ const second = bytes[index + 1];
9929
+ const third = bytes[index + 2];
9930
+ output += BASE64URL_ALPHABET[first >> 2];
9931
+ output += BASE64URL_ALPHABET[(first & 3) << 4 | (second != null ? second : 0) >> 4];
9932
+ if (second === void 0) break;
9933
+ output += BASE64URL_ALPHABET[(second & 15) << 2 | (third != null ? third : 0) >> 6];
9934
+ if (third === void 0) break;
9935
+ output += BASE64URL_ALPHABET[third & 63];
9936
+ }
9937
+ return output;
9938
+ }, "encodeBase64Url");
9939
+ var decodeBase64Url = /* @__PURE__ */ __name((value) => {
9940
+ if (typeof value !== "string") return null;
9941
+ const output = new Uint8Array(Math.floor(value.length * 6 / 8));
9942
+ let bits = 0;
9943
+ let bitCount = 0;
9944
+ let outputIndex = 0;
9945
+ for (let index = 0; index < value.length; index += 1) {
9946
+ const code = value.charCodeAt(index);
9947
+ const digit = code < 128 ? BASE64URL_LOOKUP[code] : -1;
9948
+ if (digit < 0) return null;
9949
+ bits = bits << 6 | digit;
9950
+ bitCount += 6;
9951
+ if (bitCount >= 8) {
9952
+ bitCount -= 8;
9953
+ output[outputIndex] = bits >> bitCount & 255;
9954
+ outputIndex += 1;
9955
+ }
9956
+ }
9957
+ return output;
9958
+ }, "decodeBase64Url");
9959
+ var isCanonicalBase64Url = /* @__PURE__ */ __name((value, expectedBytes) => {
9960
+ if (typeof value !== "string") return false;
9961
+ if (expectedBytes !== void 0 && value.length !== Math.ceil(expectedBytes * 4 / 3))
9962
+ return false;
9963
+ const decoded = decodeBase64Url(value);
9964
+ if (decoded === null) return false;
9965
+ if (expectedBytes !== void 0 && decoded.length !== expectedBytes) return false;
9966
+ return encodeBase64Url(decoded) === value;
9967
+ }, "isCanonicalBase64Url");
9968
+ var utf8ByteLength = /* @__PURE__ */ __name((value) => new TextEncoder().encode(value).length, "utf8ByteLength");
9969
+ var canonicalBase64Url = /* @__PURE__ */ __name((bytes) => string().refine((value) => isCanonicalBase64Url(value, bytes), {
9970
+ message: `must be canonical base64url for exactly ${bytes} bytes`
9971
+ }), "canonicalBase64Url");
9972
+ var ShareLinkIdValidator = canonicalBase64Url(SHARE_LINK_ID_BYTES);
9973
+ var ShareContentKeyValidator = canonicalBase64Url(SHARE_CONTENT_KEY_BYTES);
9974
+ var ShareIvValidator = canonicalBase64Url(SHARE_IV_BYTES);
9975
+ var ShareCiphertextValidator = string().refine(
9976
+ (value) => {
9977
+ if (value.length > Math.ceil(MAX_SHARE_CIPHERTEXT_BYTES * 4 / 3)) return false;
9978
+ const decoded = decodeBase64Url(value);
9979
+ if (decoded === null) return false;
9980
+ if (encodeBase64Url(decoded) !== value) return false;
9981
+ return decoded.length >= SHARE_TAG_BYTES && decoded.length <= MAX_SHARE_CIPHERTEXT_BYTES;
9982
+ },
9983
+ {
9984
+ message: `must be canonical base64url decoding to ${SHARE_TAG_BYTES}..${MAX_SHARE_CIPHERTEXT_BYTES} bytes`
9985
+ }
9986
+ );
9987
+ var ShareEnvelopeValidator = object({
9988
+ v: literal(1),
9989
+ alg: literal("A256GCM"),
9990
+ iv: ShareIvValidator,
9991
+ ct: ShareCiphertextValidator
9992
+ }).strict();
9993
+ var safeVersion = number().int().min(1).max(__pow(2, 31) - 1);
9994
+ var safeCredentialIndex = number().int().min(0).max(MAX_VP_MEMBERS - 1);
9995
+ var ShareSelectionEntryValidator = object({ credentialIndex: safeCredentialIndex }).strict();
9996
+ var ShareEndorsementEntryValidator = object({ credentialIndex: safeCredentialIndex, targetCredentialIndex: safeCredentialIndex }).strict();
9997
+ var ShareSharerValidator = object({
9998
+ profileId: string().min(1).max(128),
9999
+ displayName: string().min(1).max(120),
10000
+ avatar: string().max(2048).optional()
10001
+ }).strict();
10002
+ var presentationShape = VPValidator.extend({
10003
+ verifiableCredential: VCValidator.array().min(1).max(MAX_VP_MEMBERS)
10004
+ });
10005
+ var hasBoundedPresentation = /* @__PURE__ */ __name((value) => {
10006
+ let credentialCount = 0;
10007
+ const ancestors = /* @__PURE__ */ new Set();
10008
+ const visit = /* @__PURE__ */ __name((node, depth) => {
10009
+ if (node === null || typeof node !== "object") return true;
10010
+ if (depth > 32 || ancestors.has(node)) return false;
10011
+ ancestors.add(node);
10012
+ try {
10013
+ for (const [key, child] of Object.entries(node)) {
10014
+ if (key === "verifiableCredential") {
10015
+ credentialCount += Array.isArray(child) ? child.length : 1;
10016
+ if (credentialCount > MAX_VP_MEMBERS) return false;
10017
+ }
10018
+ if (!visit(child, depth + 1)) return false;
10019
+ }
10020
+ return true;
10021
+ } finally {
10022
+ ancestors.delete(node);
10023
+ }
10024
+ }, "visit");
10025
+ return visit(value, 0);
10026
+ }, "hasBoundedPresentation");
10027
+ var ShareManifestPresentationValidator = custom(
10028
+ (value) => hasBoundedPresentation(value) && presentationShape.safeParse(value).success,
10029
+ { message: "invalid share presentation" }
10030
+ );
10031
+ var SharePayloadValidatorShape = object({
10032
+ protocol: literal(SHARE_LINK_PROTOCOL),
10033
+ shareId: ShareLinkIdValidator,
10034
+ contentVersion: safeVersion,
10035
+ createdAt: datetime(),
10036
+ sharer: ShareSharerValidator,
10037
+ presentation: ShareManifestPresentationValidator,
10038
+ selection: ShareSelectionEntryValidator.array().min(1).max(MAX_SELECTED_CREDENTIALS),
10039
+ endorsements: ShareEndorsementEntryValidator.array().max(MAX_ENDORSEMENTS).default([])
10040
+ }).strict();
10041
+ var classificationFailure = /* @__PURE__ */ __name((code, message, path = []) => ({ ok: false, code, message, path }), "classificationFailure");
10042
+ var readSignedClaimId = /* @__PURE__ */ __name((member) => {
10043
+ var _a2, _b;
10044
+ if (member === null || typeof member !== "object") return void 0;
10045
+ const record = member;
10046
+ const claim = (_a2 = record.credentialSubject) != null ? _a2 : record.endorsement;
10047
+ if (claim === null || typeof claim !== "object") return void 0;
10048
+ const claimRecord = claim;
10049
+ const nested = claimRecord.endorsement;
10050
+ const nestedId = nested !== null && typeof nested === "object" ? nested.id : void 0;
10051
+ return (_b = claimRecord.id) != null ? _b : nestedId;
10052
+ }, "readSignedClaimId");
10053
+ var classifyShareManifest = /* @__PURE__ */ __name((payload) => {
10054
+ var _a2, _b;
10055
+ const members = (_a2 = payload.presentation) == null ? void 0 : _a2.verifiableCredential;
10056
+ if (!Array.isArray(members) || members.length === 0) {
10057
+ return classificationFailure("NO_PRESENTATION_MEMBERS", "presentation has no credentials");
10058
+ }
10059
+ if (members.length > MAX_VP_MEMBERS) {
10060
+ return classificationFailure(
10061
+ "TOO_MANY_VP_MEMBERS",
10062
+ `presentation has ${members.length} members, over the ${MAX_VP_MEMBERS} bound`
10063
+ );
10064
+ }
10065
+ const selection = payload.selection;
10066
+ const endorsements = (_b = payload.endorsements) != null ? _b : [];
10067
+ if (!Array.isArray(selection) || selection.length < 1 || selection.length > MAX_SELECTED_CREDENTIALS) {
10068
+ return classificationFailure("BAD_SELECTION", "selection must contain 1..50 entries");
10069
+ }
10070
+ if (!Array.isArray(endorsements) || endorsements.length > MAX_ENDORSEMENTS) {
10071
+ return classificationFailure(
10072
+ "BAD_ENDORSEMENTS",
10073
+ "endorsements must contain at most 200 entries"
10074
+ );
10075
+ }
10076
+ const selectedIndices = [];
10077
+ const selected = /* @__PURE__ */ new Set();
10078
+ for (let index = 0; index < selection.length; index += 1) {
10079
+ const entry = selection[index];
10080
+ const credentialIndex = entry == null ? void 0 : entry.credentialIndex;
10081
+ if (!Number.isSafeInteger(credentialIndex) || credentialIndex < 0 || credentialIndex >= members.length) {
10082
+ return classificationFailure(
10083
+ "SELECTION_INDEX_OUT_OF_BOUNDS",
10084
+ `selection[${index}].credentialIndex is out of bounds`,
10085
+ ["selection", index, "credentialIndex"]
10086
+ );
10087
+ }
10088
+ if (selected.has(credentialIndex)) {
10089
+ return classificationFailure(
10090
+ "SELECTION_INDEX_DUPLICATE",
10091
+ `selection[${index}].credentialIndex is duplicated`,
10092
+ ["selection", index, "credentialIndex"]
10093
+ );
10094
+ }
10095
+ selected.add(credentialIndex);
10096
+ selectedIndices.push(credentialIndex);
10097
+ }
10098
+ const classified = new Set(selected);
10099
+ const endorsementIndices = [];
10100
+ for (let index = 0; index < endorsements.length; index += 1) {
10101
+ const entry = endorsements[index];
10102
+ const credentialIndex = entry == null ? void 0 : entry.credentialIndex;
10103
+ const targetIndex = entry == null ? void 0 : entry.targetCredentialIndex;
10104
+ if (!Number.isSafeInteger(credentialIndex) || credentialIndex < 0 || credentialIndex >= members.length) {
10105
+ return classificationFailure(
10106
+ "ENDORSEMENT_INDEX_OUT_OF_BOUNDS",
10107
+ `endorsements[${index}].credentialIndex is out of bounds`,
10108
+ ["endorsements", index, "credentialIndex"]
10109
+ );
10110
+ }
10111
+ if (classified.has(credentialIndex)) {
10112
+ return classificationFailure(
10113
+ "VP_MEMBER_CLASSIFIED_TWICE",
10114
+ `endorsements[${index}].credentialIndex was already classified`,
10115
+ ["endorsements", index, "credentialIndex"]
10116
+ );
10117
+ }
10118
+ if (!selected.has(targetIndex)) {
10119
+ return classificationFailure(
10120
+ "ENDORSEMENT_TARGET_NOT_SELECTED",
10121
+ `endorsements[${index}].targetCredentialIndex must reference a selected credential`,
10122
+ ["endorsements", index, "targetCredentialIndex"]
10123
+ );
10124
+ }
10125
+ const referenced = readSignedClaimId(members[credentialIndex]);
10126
+ const target = members[targetIndex];
10127
+ const targetId = target !== null && typeof target === "object" ? target.id : void 0;
10128
+ if (typeof referenced !== "string" || typeof targetId !== "string" || referenced !== targetId) {
10129
+ return classificationFailure(
10130
+ "ENDORSEMENT_TARGET_UNBOUND",
10131
+ `endorsements[${index}] claim does not reference the target credential id`,
10132
+ ["endorsements", index]
10133
+ );
10134
+ }
10135
+ classified.add(credentialIndex);
10136
+ endorsementIndices.push(credentialIndex);
10137
+ }
10138
+ if (classified.size !== members.length) {
10139
+ return classificationFailure(
10140
+ "UNCLASSIFIED_VP_MEMBER",
10141
+ "every presentation member must be classified exactly once",
10142
+ ["presentation", "verifiableCredential"]
10143
+ );
10144
+ }
10145
+ return {
10146
+ ok: true,
10147
+ classification: { selectedIndices, endorsementIndices, memberCount: members.length }
10148
+ };
10149
+ }, "classifyShareManifest");
10150
+ SharePayloadValidatorShape.superRefine((payload, ctx) => {
10151
+ const result = classifyShareManifest(payload);
10152
+ if (!result.ok) {
9600
10153
  ctx.addIssue({
9601
10154
  code: "custom",
9602
- path: ["mode"],
9603
- message: "issuer-signed publication cannot include signing-authority fields"
10155
+ message: result.message,
10156
+ path: result.path,
10157
+ params: { shareLinkCode: result.code }
9604
10158
  });
9605
10159
  }
9606
- if (input.mode === "signing-authority") {
9607
- if (input.signedCredential !== void 0) {
9608
- ctx.addIssue({
9609
- code: "custom",
9610
- path: ["signedCredential"],
9611
- message: "signing-authority publication cannot include signedCredential"
9612
- });
9613
- }
9614
- if (!input.credential) {
10160
+ });
10161
+ var ShareRecoverySelectionValidator = object({
10162
+ ref: string().min(1).max(MAX_SHARE_SOURCE_URI_CHARS),
10163
+ order: number().int().min(0).max(MAX_SELECTED_CREDENTIALS - 1)
10164
+ }).strict();
10165
+ var ShareRecoveryEndorsementValidator = object({ targetRef: string().min(1).max(MAX_SHARE_SOURCE_URI_CHARS) }).strict();
10166
+ object({
10167
+ protocol: literal(SHARE_RECOVERY_PROTOCOL),
10168
+ shareId: ShareLinkIdValidator,
10169
+ ownerProfileId: string().min(1).max(128),
10170
+ createdAt: datetime(),
10171
+ latest: object({ contentVersion: safeVersion, key: ShareContentKeyValidator }).strict(),
10172
+ selection: ShareRecoverySelectionValidator.array().min(1).max(MAX_SELECTED_CREDENTIALS),
10173
+ endorsements: ShareRecoveryEndorsementValidator.array().max(MAX_ENDORSEMENTS).default([])
10174
+ }).strict().superRefine((recovery, ctx) => {
10175
+ const orders = /* @__PURE__ */ new Set();
10176
+ recovery.selection.forEach((entry, index) => {
10177
+ if (entry.order >= recovery.selection.length) {
9615
10178
  ctx.addIssue({
9616
10179
  code: "custom",
9617
- path: ["credential"],
9618
- message: "credential is required for signing-authority publication"
10180
+ message: "order must be within the selection bounds",
10181
+ path: ["selection", index, "order"]
9619
10182
  });
9620
10183
  }
9621
- if (!input.signingAuthority) {
10184
+ if (orders.has(entry.order)) {
9622
10185
  ctx.addIssue({
9623
10186
  code: "custom",
9624
- path: ["signingAuthority"],
9625
- message: "signingAuthority is required for signing-authority publication"
10187
+ message: "order must be unique within the selection",
10188
+ path: ["selection", index, "order"]
9626
10189
  });
9627
10190
  }
9628
- }
9629
- });
9630
- var PublishCredentialRefreshNotificationValidator = _enum([
9631
- "queued",
9632
- "suppressed",
9633
- "not-applicable",
9634
- /** Publication succeeded, but the post-commit notification enqueue must be retried. */
9635
- "delivery-failed"
9636
- ]);
9637
- object({
9638
- refreshId: string().min(1),
9639
- version: number().int().positive(),
9640
- publishedAt: string().min(1),
9641
- notification: PublishCredentialRefreshNotificationValidator
9642
- });
9643
- var CredentialRefreshVersionMetadataValidator = object({
9644
- version: number().int().positive(),
9645
- publishedAt: string().min(1),
9646
- effectiveAt: string().optional(),
9647
- etag: string().optional(),
9648
- signingMode: CredentialRefreshSigningModeValidator.optional(),
9649
- updateSummary: string().optional()
10191
+ orders.add(entry.order);
10192
+ });
9650
10193
  });
9651
- object({
9652
- refreshId: string().min(1),
9653
- cursor: string().optional(),
9654
- limit: number().int().positive().optional()
10194
+ var ShareOwnerRecoveryValidator = JWEValidator.refine(
10195
+ (value) => utf8ByteLength(JSON.stringify(value)) <= MAX_SHARE_RECOVERY_JWE_BYTES,
10196
+ { message: `serialized recovery JWE must be at most ${MAX_SHARE_RECOVERY_JWE_BYTES} bytes` }
10197
+ );
10198
+ var ShareLinkStatusValidator = _enum(["pending", "active", "stopped"]);
10199
+ var ShareContentStateValidator = _enum(["staging", "finalized", "content_missing"]);
10200
+ var ShareLinkValidator = object({
10201
+ id: ShareLinkIdValidator,
10202
+ title: string().min(1).max(120),
10203
+ note: string().max(500).optional(),
10204
+ selectedCount: number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
10205
+ version: safeVersion,
10206
+ contentVersion: safeVersion,
10207
+ status: ShareLinkStatusValidator,
10208
+ contentState: ShareContentStateValidator,
10209
+ createdAt: datetime(),
10210
+ updatedAt: datetime(),
10211
+ expiresAt: datetime().nullable(),
10212
+ stoppedAt: datetime().nullable(),
10213
+ lastViewedAt: datetime().nullable(),
10214
+ viewCount: number().int().min(0).optional(),
10215
+ passcodeProtected: boolean(),
10216
+ notifyOnView: boolean(),
10217
+ minorPolicy: object({
10218
+ isMinor: boolean().nullable(),
10219
+ policyResolved: boolean(),
10220
+ defaultExpiryDays: union([literal(30), literal(365)]),
10221
+ viewCountingEnabled: boolean()
10222
+ }),
10223
+ /**
10224
+ * Guarded application/API URL for the content. Optional because owner APIs in
10225
+ * D1 have no public resolve/content endpoint yet; it must never be a
10226
+ * LearnCloud object URL or carry a fabricated decryption key.
10227
+ */
10228
+ contentUrl: string().optional()
9655
10229
  });
10230
+ var clientRequestId = string().uuid();
9656
10231
  object({
9657
- records: CredentialRefreshVersionMetadataValidator.array(),
9658
- hasMore: boolean(),
9659
- cursor: string().optional()
9660
- });
10232
+ id: ShareLinkIdValidator,
10233
+ clientRequestId,
10234
+ title: string().min(1).max(120),
10235
+ note: string().max(500).optional(),
10236
+ expiresAt: datetime().nullable().optional(),
10237
+ passcode: string().min(8).max(64).optional(),
10238
+ notifyOnView: boolean().default(false),
10239
+ selectedCount: number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
10240
+ contentVersion: literal(1),
10241
+ envelope: ShareEnvelopeValidator,
10242
+ ownerEncryptedRecovery: ShareOwnerRecoveryValidator
10243
+ }).strict();
9661
10244
  object({
9662
- challenge: string().min(1),
9663
- expiresAt: string().min(1),
9664
- domain: string().optional(),
9665
- scheme: literal("LearnCardDIDAuth").optional()
9666
- });
9667
- var PublicCredentialRefreshEnvelopeValidator = object({
9668
- format: literal("vc"),
9669
- credential: VCValidator,
9670
- etag: string().optional()
9671
- });
9672
- var JweCredentialRefreshEnvelopeValidator = object({
9673
- format: literal("jwe"),
9674
- jwe: JWEValidator,
9675
- etag: string().optional(),
9676
- /** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
9677
- version: number().int().positive().optional()
10245
+ id: ShareLinkIdValidator,
10246
+ expectedVersion: safeVersion,
10247
+ clientRequestId,
10248
+ title: string().min(1).max(120).optional(),
10249
+ note: string().max(500).nullable().optional(),
10250
+ expiresAt: datetime().nullable().optional(),
10251
+ /** Omitted preserves the current passcode, null removes it, and a string replaces it. */
10252
+ passcode: string().min(8).max(64).nullable().optional(),
10253
+ notifyOnView: boolean().optional(),
10254
+ contentVersion: safeVersion.optional(),
10255
+ selectedCount: number().int().min(1).max(MAX_SELECTED_CREDENTIALS).optional(),
10256
+ envelope: ShareEnvelopeValidator.optional(),
10257
+ ownerEncryptedRecovery: ShareOwnerRecoveryValidator.optional()
10258
+ }).strict().superRefine((value, ctx) => {
10259
+ const provided = [
10260
+ value.contentVersion,
10261
+ value.selectedCount,
10262
+ value.envelope,
10263
+ value.ownerEncryptedRecovery
10264
+ ].filter((field) => field !== void 0).length;
10265
+ if (provided !== 0 && provided !== 4) {
10266
+ ctx.addIssue({
10267
+ code: "custom",
10268
+ message: "content replacement requires contentVersion, selectedCount, envelope and ownerEncryptedRecovery together"
10269
+ });
10270
+ }
9678
10271
  });
9679
- discriminatedUnion("format", [
9680
- PublicCredentialRefreshEnvelopeValidator,
9681
- JweCredentialRefreshEnvelopeValidator
9682
- ]);
9683
- var CredentialRefreshFailureCodeValidator = _enum([
9684
- "UNAVAILABLE",
9685
- "TIMEOUT",
9686
- "UNSUPPORTED_SERVICE",
9687
- "UNAUTHORIZED",
9688
- "MALFORMED_RESPONSE",
9689
- "INVALID_PROOF",
9690
- "ISSUER_MISMATCH",
9691
- "ID_MISMATCH",
9692
- "ROLLBACK",
9693
- "REVOKED",
9694
- "UNSAFE_ENDPOINT"
10272
+ object({ id: ShareLinkIdValidator }).strict();
10273
+ object({ id: ShareLinkIdValidator, operationId: string().uuid() }).strict();
10274
+ discriminatedUnion("status", [
10275
+ object({ status: literal("completed"), share: ShareLinkValidator }).strict(),
10276
+ object({
10277
+ status: literal("pending"),
10278
+ id: ShareLinkIdValidator,
10279
+ operationId: string().uuid()
10280
+ }).strict()
9695
10281
  ]);
9696
- var CredentialRefreshUpdatedResultValidator = object({
9697
- status: literal("updated"),
9698
- credential: VCValidator,
9699
- etag: string().optional(),
9700
- managedVersion: number().int().positive().optional()
9701
- });
9702
- var CredentialRefreshUnchangedResultValidator = object({
9703
- status: literal("unchanged"),
9704
- checkedAt: string().min(1),
9705
- etag: string().optional()
9706
- });
9707
- var CredentialRefreshUnsupportedResultValidator = object({
9708
- status: literal("unsupported")
9709
- });
9710
- var CredentialRefreshFailedResultValidator = object({
9711
- status: literal("failed"),
9712
- code: CredentialRefreshFailureCodeValidator,
9713
- retryable: boolean()
9714
- });
9715
10282
  discriminatedUnion("status", [
9716
- CredentialRefreshUpdatedResultValidator,
9717
- CredentialRefreshUnchangedResultValidator,
9718
- CredentialRefreshUnsupportedResultValidator,
9719
- CredentialRefreshFailedResultValidator
10283
+ object({ status: literal("found"), share: ShareLinkValidator }).strict(),
10284
+ object({
10285
+ status: literal("pending"),
10286
+ id: ShareLinkIdValidator,
10287
+ operationId: string().uuid()
10288
+ }).strict(),
10289
+ object({ status: literal("not_found"), id: ShareLinkIdValidator }).strict()
9720
10290
  ]);
10291
+ object({ recovery: ShareOwnerRecoveryValidator }).strict();
10292
+ object({
10293
+ id: ShareLinkIdValidator,
10294
+ contentVersion: safeVersion,
10295
+ envelope: ShareEnvelopeValidator
10296
+ }).strict();
10297
+ object({
10298
+ id: ShareLinkIdValidator,
10299
+ /** Sent only in a POST body; it must never be placed in a share URL. */
10300
+ passcode: string().min(4).max(64).optional()
10301
+ }).strict();
10302
+ discriminatedUnion("state", [
10303
+ object({
10304
+ state: literal("passcode_required"),
10305
+ id: ShareLinkIdValidator
10306
+ }).strict(),
10307
+ object({ state: literal("try_later"), id: ShareLinkIdValidator }).strict(),
10308
+ object({
10309
+ state: literal("active"),
10310
+ id: ShareLinkIdValidator,
10311
+ title: string().max(120),
10312
+ note: string().max(500).optional(),
10313
+ selectedCount: number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
10314
+ contentVersion: safeVersion,
10315
+ contentUrl: string(),
10316
+ sharer: object({
10317
+ displayName: string().max(120),
10318
+ avatar: string().max(2048).optional()
10319
+ }),
10320
+ createdAt: datetime(),
10321
+ updatedAt: datetime(),
10322
+ expiresAt: datetime().nullable()
10323
+ }).strict(),
10324
+ object({
10325
+ state: literal("expired"),
10326
+ id: ShareLinkIdValidator,
10327
+ expiresAt: datetime()
10328
+ }).strict(),
10329
+ object({
10330
+ state: literal("stopped"),
10331
+ id: ShareLinkIdValidator,
10332
+ stoppedAt: datetime()
10333
+ }).strict(),
10334
+ object({ state: literal("not_found"), id: ShareLinkIdValidator }).strict()
10335
+ ]);
10336
+ object({
10337
+ limit: number().int().min(1).max(50).default(25),
10338
+ cursor: string().max(512).optional()
10339
+ }).strict();
10340
+ PaginationResponseValidator.extend({
10341
+ records: ShareLinkValidator.array()
10342
+ });
10343
+ object({
10344
+ receipt: string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/)
10345
+ }).strict();
10346
+ object({ ok: literal(true) }).strict();
10347
+ object({
10348
+ id: ShareLinkIdValidator,
10349
+ contentVersion: safeVersion,
10350
+ envelope: ShareEnvelopeValidator,
10351
+ contentUrl: string(),
10352
+ receipt: string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/)
10353
+ }).strict();
9721
10354
 
9722
10355
  exports.VerificationStatusEnum = VerificationStatusEnum;
9723
- //# sourceMappingURL=types.esm-ba95174e.js.map
10356
+ //# sourceMappingURL=types.esm-9062360c.js.map