@learncard/helpers 1.4.0 → 1.5.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.
- package/dist/credential-refresh.d.ts +58 -0
- package/dist/credential-refresh.d.ts.map +1 -0
- package/dist/helpers.cjs.development.cjs +3876 -3530
- package/dist/helpers.cjs.development.cjs.map +4 -4
- package/dist/helpers.cjs.production.min.cjs +11 -11
- package/dist/helpers.cjs.production.min.cjs.map +4 -4
- package/dist/helpers.esm.js +321 -10
- package/dist/helpers.esm.js.map +4 -4
- package/dist/images/images.helpers.d.ts.map +1 -1
- package/dist/images/index.d.ts +1 -0
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/sanitize.helpers.d.ts +28 -0
- package/dist/images/sanitize.helpers.d.ts.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/credential-refresh.ts +128 -0
- package/src/images/images.helpers.ts +24 -7
- package/src/images/index.ts +1 -0
- package/src/images/sanitize.helpers.ts +59 -0
- package/src/index.ts +1 -0
package/dist/helpers.esm.js
CHANGED
|
@@ -64,6 +64,8 @@ var require_types_cjs_development = __commonJS({
|
|
|
64
64
|
AgeRatingValidator: /* @__PURE__ */ __name(() => AgeRatingValidator, "AgeRatingValidator"),
|
|
65
65
|
AlignmentTargetTypeValidator: /* @__PURE__ */ __name(() => AlignmentTargetTypeValidator, "AlignmentTargetTypeValidator"),
|
|
66
66
|
AlignmentValidator: /* @__PURE__ */ __name(() => AlignmentValidator, "AlignmentValidator"),
|
|
67
|
+
AllocateCredentialRefreshInputValidator: /* @__PURE__ */ __name(() => AllocateCredentialRefreshInputValidator, "AllocateCredentialRefreshInputValidator"),
|
|
68
|
+
AllocateCredentialRefreshResultValidator: /* @__PURE__ */ __name(() => AllocateCredentialRefreshResultValidator, "AllocateCredentialRefreshResultValidator"),
|
|
67
69
|
AllocateCredentialStatusInputValidator: /* @__PURE__ */ __name(() => AllocateCredentialStatusInputValidator, "AllocateCredentialStatusInputValidator"),
|
|
68
70
|
AllocatedBitstringStatusListEntryValidator: /* @__PURE__ */ __name(() => AllocatedBitstringStatusListEntryValidator, "AllocatedBitstringStatusListEntryValidator"),
|
|
69
71
|
AllowConnectionRequestsEnum: /* @__PURE__ */ __name(() => AllowConnectionRequestsEnum, "AllowConnectionRequestsEnum"),
|
|
@@ -145,6 +147,16 @@ var require_types_cjs_development = __commonJS({
|
|
|
145
147
|
CredentialInfoValidator: /* @__PURE__ */ __name(() => CredentialInfoValidator, "CredentialInfoValidator"),
|
|
146
148
|
CredentialNameRefValidator: /* @__PURE__ */ __name(() => CredentialNameRefValidator, "CredentialNameRefValidator"),
|
|
147
149
|
CredentialRecordValidator: /* @__PURE__ */ __name(() => CredentialRecordValidator, "CredentialRecordValidator"),
|
|
150
|
+
CredentialRefreshChallengeValidator: /* @__PURE__ */ __name(() => CredentialRefreshChallengeValidator, "CredentialRefreshChallengeValidator"),
|
|
151
|
+
CredentialRefreshFailedResultValidator: /* @__PURE__ */ __name(() => CredentialRefreshFailedResultValidator, "CredentialRefreshFailedResultValidator"),
|
|
152
|
+
CredentialRefreshFailureCodeValidator: /* @__PURE__ */ __name(() => CredentialRefreshFailureCodeValidator, "CredentialRefreshFailureCodeValidator"),
|
|
153
|
+
CredentialRefreshResponseEnvelopeValidator: /* @__PURE__ */ __name(() => CredentialRefreshResponseEnvelopeValidator, "CredentialRefreshResponseEnvelopeValidator"),
|
|
154
|
+
CredentialRefreshResultValidator: /* @__PURE__ */ __name(() => CredentialRefreshResultValidator, "CredentialRefreshResultValidator"),
|
|
155
|
+
CredentialRefreshSigningModeValidator: /* @__PURE__ */ __name(() => CredentialRefreshSigningModeValidator, "CredentialRefreshSigningModeValidator"),
|
|
156
|
+
CredentialRefreshUnchangedResultValidator: /* @__PURE__ */ __name(() => CredentialRefreshUnchangedResultValidator, "CredentialRefreshUnchangedResultValidator"),
|
|
157
|
+
CredentialRefreshUnsupportedResultValidator: /* @__PURE__ */ __name(() => CredentialRefreshUnsupportedResultValidator, "CredentialRefreshUnsupportedResultValidator"),
|
|
158
|
+
CredentialRefreshUpdatedResultValidator: /* @__PURE__ */ __name(() => CredentialRefreshUpdatedResultValidator, "CredentialRefreshUpdatedResultValidator"),
|
|
159
|
+
CredentialRefreshVersionMetadataValidator: /* @__PURE__ */ __name(() => CredentialRefreshVersionMetadataValidator, "CredentialRefreshVersionMetadataValidator"),
|
|
148
160
|
CredentialSchemaValidator: /* @__PURE__ */ __name(() => CredentialSchemaValidator, "CredentialSchemaValidator"),
|
|
149
161
|
CredentialStatusValidator: /* @__PURE__ */ __name(() => CredentialStatusValidator, "CredentialStatusValidator"),
|
|
150
162
|
CredentialSubjectValidator: /* @__PURE__ */ __name(() => CredentialSubjectValidator, "CredentialSubjectValidator"),
|
|
@@ -165,6 +177,8 @@ var require_types_cjs_development = __commonJS({
|
|
|
165
177
|
GeoCoordinatesValidator: /* @__PURE__ */ __name(() => GeoCoordinatesValidator, "GeoCoordinatesValidator"),
|
|
166
178
|
GetCounterEventValidator: /* @__PURE__ */ __name(() => GetCounterEventValidator, "GetCounterEventValidator"),
|
|
167
179
|
GetCountersEventValidator: /* @__PURE__ */ __name(() => GetCountersEventValidator, "GetCountersEventValidator"),
|
|
180
|
+
GetCredentialRefreshHistoryInputValidator: /* @__PURE__ */ __name(() => GetCredentialRefreshHistoryInputValidator, "GetCredentialRefreshHistoryInputValidator"),
|
|
181
|
+
GetCredentialRefreshHistoryResultValidator: /* @__PURE__ */ __name(() => GetCredentialRefreshHistoryResultValidator, "GetCredentialRefreshHistoryResultValidator"),
|
|
168
182
|
GetFullSkillTreeInputValidator: /* @__PURE__ */ __name(() => GetFullSkillTreeInputValidator, "GetFullSkillTreeInputValidator"),
|
|
169
183
|
GetFullSkillTreeResultValidator: /* @__PURE__ */ __name(() => GetFullSkillTreeResultValidator, "GetFullSkillTreeResultValidator"),
|
|
170
184
|
GetSkillPathInputValidator: /* @__PURE__ */ __name(() => GetSkillPathInputValidator, "GetSkillPathInputValidator"),
|
|
@@ -189,6 +203,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
189
203
|
JWEValidator: /* @__PURE__ */ __name(() => JWEValidator2, "JWEValidator"),
|
|
190
204
|
JWKValidator: /* @__PURE__ */ __name(() => JWKValidator, "JWKValidator"),
|
|
191
205
|
JWKWithPrivateKeyValidator: /* @__PURE__ */ __name(() => JWKWithPrivateKeyValidator, "JWKWithPrivateKeyValidator"),
|
|
206
|
+
JweCredentialRefreshEnvelopeValidator: /* @__PURE__ */ __name(() => JweCredentialRefreshEnvelopeValidator, "JweCredentialRefreshEnvelopeValidator"),
|
|
192
207
|
KnownAchievementTypeValidator: /* @__PURE__ */ __name(() => KnownAchievementTypeValidator, "KnownAchievementTypeValidator"),
|
|
193
208
|
LCNAuthedProfileValidator: /* @__PURE__ */ __name(() => LCNAuthedProfileValidator, "LCNAuthedProfileValidator"),
|
|
194
209
|
LCNBoostClaimLinkOptionsValidator: /* @__PURE__ */ __name(() => LCNBoostClaimLinkOptionsValidator, "LCNBoostClaimLinkOptionsValidator"),
|
|
@@ -226,7 +241,9 @@ var require_types_cjs_development = __commonJS({
|
|
|
226
241
|
LCNSigningAuthorityValidator: /* @__PURE__ */ __name(() => LCNSigningAuthorityValidator, "LCNSigningAuthorityValidator"),
|
|
227
242
|
LCNVisibleProfileValidator: /* @__PURE__ */ __name(() => LCNVisibleProfileValidator, "LCNVisibleProfileValidator"),
|
|
228
243
|
LaunchTypeValidator: /* @__PURE__ */ __name(() => LaunchTypeValidator, "LaunchTypeValidator"),
|
|
244
|
+
LearnCardRefreshAuthorizationValidator: /* @__PURE__ */ __name(() => LearnCardRefreshAuthorizationValidator, "LearnCardRefreshAuthorizationValidator"),
|
|
229
245
|
LinkProviderFrameworkInputValidator: /* @__PURE__ */ __name(() => LinkProviderFrameworkInputValidator, "LinkProviderFrameworkInputValidator"),
|
|
246
|
+
ManagedCredentialRefreshServiceValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshServiceValidator, "ManagedCredentialRefreshServiceValidator"),
|
|
230
247
|
PaginatedAppStoreListingsValidator: /* @__PURE__ */ __name(() => PaginatedAppStoreListingsValidator, "PaginatedAppStoreListingsValidator"),
|
|
231
248
|
PaginatedBoostRecipientsValidator: /* @__PURE__ */ __name(() => PaginatedBoostRecipientsValidator, "PaginatedBoostRecipientsValidator"),
|
|
232
249
|
PaginatedBoostRecipientsWithChildrenValidator: /* @__PURE__ */ __name(() => PaginatedBoostRecipientsWithChildrenValidator, "PaginatedBoostRecipientsWithChildrenValidator"),
|
|
@@ -256,6 +273,12 @@ var require_types_cjs_development = __commonJS({
|
|
|
256
273
|
ProfileVisibilityEnum: /* @__PURE__ */ __name(() => ProfileVisibilityEnum, "ProfileVisibilityEnum"),
|
|
257
274
|
PromotionLevelValidator: /* @__PURE__ */ __name(() => PromotionLevelValidator, "PromotionLevelValidator"),
|
|
258
275
|
ProofValidator: /* @__PURE__ */ __name(() => ProofValidator, "ProofValidator"),
|
|
276
|
+
PublicCredentialRefreshEnvelopeValidator: /* @__PURE__ */ __name(() => PublicCredentialRefreshEnvelopeValidator, "PublicCredentialRefreshEnvelopeValidator"),
|
|
277
|
+
PublishCredentialRefreshInputValidator: /* @__PURE__ */ __name(() => PublishCredentialRefreshInputValidator, "PublishCredentialRefreshInputValidator"),
|
|
278
|
+
PublishCredentialRefreshNotificationValidator: /* @__PURE__ */ __name(() => PublishCredentialRefreshNotificationValidator, "PublishCredentialRefreshNotificationValidator"),
|
|
279
|
+
PublishCredentialRefreshResultValidator: /* @__PURE__ */ __name(() => PublishCredentialRefreshResultValidator, "PublishCredentialRefreshResultValidator"),
|
|
280
|
+
PublishIssuerSignedRefreshValidator: /* @__PURE__ */ __name(() => PublishIssuerSignedRefreshValidator, "PublishIssuerSignedRefreshValidator"),
|
|
281
|
+
PublishSigningAuthorityRefreshValidator: /* @__PURE__ */ __name(() => PublishSigningAuthorityRefreshValidator, "PublishSigningAuthorityRefreshValidator"),
|
|
259
282
|
RefreshServiceValidator: /* @__PURE__ */ __name(() => RefreshServiceValidator, "RefreshServiceValidator"),
|
|
260
283
|
RegExpValidator: /* @__PURE__ */ __name(() => RegExpValidator, "RegExpValidator"),
|
|
261
284
|
RelatedValidator: /* @__PURE__ */ __name(() => RelatedValidator, "RelatedValidator"),
|
|
@@ -296,11 +319,13 @@ var require_types_cjs_development = __commonJS({
|
|
|
296
319
|
SkillTreeNodeInputValidator: /* @__PURE__ */ __name(() => SkillTreeNodeInputValidator, "SkillTreeNodeInputValidator"),
|
|
297
320
|
SkillTreeNodeValidator: /* @__PURE__ */ __name(() => SkillTreeNodeValidator, "SkillTreeNodeValidator"),
|
|
298
321
|
SkillValidator: /* @__PURE__ */ __name(() => SkillValidator, "SkillValidator"),
|
|
322
|
+
StandardCredentialRefreshServiceValidator: /* @__PURE__ */ __name(() => StandardCredentialRefreshServiceValidator, "StandardCredentialRefreshServiceValidator"),
|
|
299
323
|
StatusCheckEntryValidator: /* @__PURE__ */ __name(() => StatusCheckEntryValidator, "StatusCheckEntryValidator"),
|
|
300
324
|
StoredCredentialEnvelopeValidator: /* @__PURE__ */ __name(() => StoredCredentialEnvelopeValidator, "StoredCredentialEnvelopeValidator"),
|
|
301
325
|
StringQuery: /* @__PURE__ */ __name(() => StringQuery, "StringQuery"),
|
|
302
326
|
SummaryCredentialDataValidator: /* @__PURE__ */ __name(() => SummaryCredentialDataValidator, "SummaryCredentialDataValidator"),
|
|
303
327
|
SummaryCredentialKeywordValidator: /* @__PURE__ */ __name(() => SummaryCredentialKeywordValidator, "SummaryCredentialKeywordValidator"),
|
|
328
|
+
SupportedCredentialRefreshServiceValidator: /* @__PURE__ */ __name(() => SupportedCredentialRefreshServiceValidator2, "SupportedCredentialRefreshServiceValidator"),
|
|
304
329
|
SyncFrameworkInputValidator: /* @__PURE__ */ __name(() => SyncFrameworkInputValidator, "SyncFrameworkInputValidator"),
|
|
305
330
|
TagValidator: /* @__PURE__ */ __name(() => TagValidator, "TagValidator"),
|
|
306
331
|
TemplateRenderMethodValidator: /* @__PURE__ */ __name(() => TemplateRenderMethodValidator, "TemplateRenderMethodValidator"),
|
|
@@ -16504,7 +16529,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16504
16529
|
webhookUrl: external_exports.string().url().optional().describe("Webhook URL to receive claim notifications"),
|
|
16505
16530
|
suppressDelivery: external_exports.boolean().optional().describe("If true, returns claimUrl without sending email/SMS"),
|
|
16506
16531
|
branding: SendBrandingOptionsValidator.optional().describe("Branding for email/SMS delivery"),
|
|
16507
|
-
guardianEmail: external_exports.string().email().optional().describe("Guardian email that must approve before student can claim")
|
|
16532
|
+
guardianEmail: external_exports.string().email().optional().describe("Guardian email that must approve before student can claim"),
|
|
16533
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
16534
|
+
"How many days the credential stays claimable in the Universal Inbox (default 30). Does not change the credential validity period."
|
|
16535
|
+
)
|
|
16508
16536
|
});
|
|
16509
16537
|
var SendBoostInputValidator = external_exports.object({
|
|
16510
16538
|
type: external_exports.literal("boost"),
|
|
@@ -16799,7 +16827,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16799
16827
|
"APP_NOTIFICATION",
|
|
16800
16828
|
"CREDENTIAL_REVOKED",
|
|
16801
16829
|
"CREDENTIAL_SUSPENDED",
|
|
16802
|
-
"CREDENTIAL_UNSUSPENDED"
|
|
16830
|
+
"CREDENTIAL_UNSUSPENDED",
|
|
16831
|
+
"CREDENTIAL_REFRESHED"
|
|
16803
16832
|
]);
|
|
16804
16833
|
var LCNNotificationMessageValidator = external_exports.object({
|
|
16805
16834
|
title: external_exports.string().optional(),
|
|
@@ -16931,12 +16960,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16931
16960
|
});
|
|
16932
16961
|
var InboxCredentialValidator = external_exports.object({
|
|
16933
16962
|
id: external_exports.string(),
|
|
16934
|
-
credential: external_exports.string(),
|
|
16963
|
+
credential: external_exports.string().optional(),
|
|
16935
16964
|
isSigned: external_exports.boolean(),
|
|
16936
16965
|
currentStatus: LCNInboxStatusEnumValidator,
|
|
16937
16966
|
isAccepted: external_exports.boolean().optional(),
|
|
16938
16967
|
expiresAt: external_exports.string(),
|
|
16939
16968
|
createdAt: external_exports.string(),
|
|
16969
|
+
finalizedAt: external_exports.string().optional(),
|
|
16970
|
+
expiredAt: external_exports.string().optional(),
|
|
16971
|
+
credentialName: external_exports.string().optional(),
|
|
16972
|
+
achievementType: external_exports.string().optional(),
|
|
16940
16973
|
issuerDid: external_exports.string(),
|
|
16941
16974
|
webhookUrl: external_exports.string().optional(),
|
|
16942
16975
|
boostUri: external_exports.string().optional(),
|
|
@@ -16990,7 +17023,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
16990
17023
|
"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."
|
|
16991
17024
|
),
|
|
16992
17025
|
webhookUrl: external_exports.string().url().optional().describe("The webhook URL to receive credential issuance events."),
|
|
16993
|
-
expiresInDays: external_exports.number().min(1).max(
|
|
17026
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
17027
|
+
"How many days the encrypted inbox payload remains claimable. This does not change the credential validity period."
|
|
17028
|
+
),
|
|
16994
17029
|
templateData: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
|
|
16995
17030
|
"Template data to render into the boost credential template using Mustache syntax. Only used when boostUri is provided."
|
|
16996
17031
|
),
|
|
@@ -17053,6 +17088,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17053
17088
|
credential: VCValidator.or(VPValidator).or(UnsignedVCValidator).or(CredentialNameRefValidator).describe("The credential to issue, or a { name } reference to resolve a boost template."),
|
|
17054
17089
|
configuration: external_exports.object({
|
|
17055
17090
|
publishableKey: external_exports.string(),
|
|
17091
|
+
expiresInDays: external_exports.number().int().min(1).max(720).optional().describe(
|
|
17092
|
+
"Inbox claim window in days. Defaults to 720; use a shorter window for sensitive records."
|
|
17093
|
+
),
|
|
17056
17094
|
signingAuthorityName: external_exports.string().optional(),
|
|
17057
17095
|
listingId: external_exports.string().optional(),
|
|
17058
17096
|
listingSlug: external_exports.string().optional()
|
|
@@ -17690,6 +17728,191 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17690
17728
|
const result = inAppMessagesFlagValidator.safeParse(raw);
|
|
17691
17729
|
return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
|
|
17692
17730
|
}, "parseInAppMessagesFlag");
|
|
17731
|
+
var LearnCardRefreshAuthorizationValidator = external_exports.object({ type: external_exports.literal("LearnCardDIDAuth") }).catchall(external_exports.any());
|
|
17732
|
+
var ManagedCredentialRefreshServiceValidator = external_exports.object({
|
|
17733
|
+
id: external_exports.string().min(1),
|
|
17734
|
+
type: external_exports.literal("LearnCardCredentialRefresh2026"),
|
|
17735
|
+
authorization: LearnCardRefreshAuthorizationValidator.optional()
|
|
17736
|
+
}).catchall(external_exports.any());
|
|
17737
|
+
var StandardCredentialRefreshServiceValidator = external_exports.object({
|
|
17738
|
+
id: external_exports.string().min(1),
|
|
17739
|
+
type: external_exports.literal("1EdTechCredentialRefresh")
|
|
17740
|
+
}).catchall(external_exports.any());
|
|
17741
|
+
var SupportedCredentialRefreshServiceValidator2 = external_exports.union([
|
|
17742
|
+
ManagedCredentialRefreshServiceValidator,
|
|
17743
|
+
StandardCredentialRefreshServiceValidator
|
|
17744
|
+
]);
|
|
17745
|
+
var AllocateCredentialRefreshInputValidator = external_exports.object({
|
|
17746
|
+
holder: external_exports.object({
|
|
17747
|
+
profileId: external_exports.string().optional(),
|
|
17748
|
+
did: external_exports.string().min(1)
|
|
17749
|
+
}),
|
|
17750
|
+
credentialId: external_exports.string().min(1)
|
|
17751
|
+
});
|
|
17752
|
+
var AllocateCredentialRefreshResultValidator = external_exports.object({
|
|
17753
|
+
refreshId: external_exports.string().min(1),
|
|
17754
|
+
refreshService: ManagedCredentialRefreshServiceValidator.extend({
|
|
17755
|
+
authorization: LearnCardRefreshAuthorizationValidator
|
|
17756
|
+
})
|
|
17757
|
+
});
|
|
17758
|
+
var CredentialRefreshSigningModeValidator = external_exports.enum(["issuer-signed", "signing-authority"]);
|
|
17759
|
+
var PublishCredentialRefreshBaseFields = {
|
|
17760
|
+
refreshId: external_exports.string().min(1),
|
|
17761
|
+
notifyHolder: external_exports.boolean().optional(),
|
|
17762
|
+
updateSummary: external_exports.string().optional(),
|
|
17763
|
+
idempotencyKey: external_exports.string().optional()
|
|
17764
|
+
};
|
|
17765
|
+
var PublishIssuerSignedRefreshValidator = external_exports.object({
|
|
17766
|
+
...PublishCredentialRefreshBaseFields,
|
|
17767
|
+
mode: external_exports.literal("issuer-signed"),
|
|
17768
|
+
signedCredential: VCValidator
|
|
17769
|
+
});
|
|
17770
|
+
var PublishSigningAuthorityRefreshValidator = external_exports.object({
|
|
17771
|
+
...PublishCredentialRefreshBaseFields,
|
|
17772
|
+
mode: external_exports.literal("signing-authority"),
|
|
17773
|
+
credential: UnsignedVCValidator,
|
|
17774
|
+
signingAuthority: external_exports.object({
|
|
17775
|
+
type: external_exports.string().min(1)
|
|
17776
|
+
}).catchall(external_exports.any())
|
|
17777
|
+
});
|
|
17778
|
+
var PublishCredentialRefreshInputValidator = external_exports.object({
|
|
17779
|
+
...PublishCredentialRefreshBaseFields,
|
|
17780
|
+
mode: CredentialRefreshSigningModeValidator,
|
|
17781
|
+
signedCredential: VCValidator.optional(),
|
|
17782
|
+
credential: UnsignedVCValidator.optional(),
|
|
17783
|
+
signingAuthority: external_exports.object({
|
|
17784
|
+
type: external_exports.string().min(1)
|
|
17785
|
+
}).catchall(external_exports.any()).optional()
|
|
17786
|
+
}).superRefine((input, ctx) => {
|
|
17787
|
+
if (input.mode === "issuer-signed" && !input.signedCredential) {
|
|
17788
|
+
ctx.addIssue({
|
|
17789
|
+
code: "custom",
|
|
17790
|
+
path: ["signedCredential"],
|
|
17791
|
+
message: "signedCredential is required for issuer-signed publication"
|
|
17792
|
+
});
|
|
17793
|
+
}
|
|
17794
|
+
if (input.mode === "issuer-signed" && (input.credential !== void 0 || input.signingAuthority !== void 0)) {
|
|
17795
|
+
ctx.addIssue({
|
|
17796
|
+
code: "custom",
|
|
17797
|
+
path: ["mode"],
|
|
17798
|
+
message: "issuer-signed publication cannot include signing-authority fields"
|
|
17799
|
+
});
|
|
17800
|
+
}
|
|
17801
|
+
if (input.mode === "signing-authority") {
|
|
17802
|
+
if (input.signedCredential !== void 0) {
|
|
17803
|
+
ctx.addIssue({
|
|
17804
|
+
code: "custom",
|
|
17805
|
+
path: ["signedCredential"],
|
|
17806
|
+
message: "signing-authority publication cannot include signedCredential"
|
|
17807
|
+
});
|
|
17808
|
+
}
|
|
17809
|
+
if (!input.credential) {
|
|
17810
|
+
ctx.addIssue({
|
|
17811
|
+
code: "custom",
|
|
17812
|
+
path: ["credential"],
|
|
17813
|
+
message: "credential is required for signing-authority publication"
|
|
17814
|
+
});
|
|
17815
|
+
}
|
|
17816
|
+
if (!input.signingAuthority) {
|
|
17817
|
+
ctx.addIssue({
|
|
17818
|
+
code: "custom",
|
|
17819
|
+
path: ["signingAuthority"],
|
|
17820
|
+
message: "signingAuthority is required for signing-authority publication"
|
|
17821
|
+
});
|
|
17822
|
+
}
|
|
17823
|
+
}
|
|
17824
|
+
});
|
|
17825
|
+
var PublishCredentialRefreshNotificationValidator = external_exports.enum([
|
|
17826
|
+
"queued",
|
|
17827
|
+
"suppressed",
|
|
17828
|
+
"not-applicable",
|
|
17829
|
+
/** Publication succeeded, but the post-commit notification enqueue must be retried. */
|
|
17830
|
+
"delivery-failed"
|
|
17831
|
+
]);
|
|
17832
|
+
var PublishCredentialRefreshResultValidator = external_exports.object({
|
|
17833
|
+
refreshId: external_exports.string().min(1),
|
|
17834
|
+
version: external_exports.number().int().positive(),
|
|
17835
|
+
publishedAt: external_exports.string().min(1),
|
|
17836
|
+
notification: PublishCredentialRefreshNotificationValidator
|
|
17837
|
+
});
|
|
17838
|
+
var CredentialRefreshVersionMetadataValidator = external_exports.object({
|
|
17839
|
+
version: external_exports.number().int().positive(),
|
|
17840
|
+
publishedAt: external_exports.string().min(1),
|
|
17841
|
+
effectiveAt: external_exports.string().optional(),
|
|
17842
|
+
etag: external_exports.string().optional(),
|
|
17843
|
+
signingMode: CredentialRefreshSigningModeValidator.optional(),
|
|
17844
|
+
updateSummary: external_exports.string().optional()
|
|
17845
|
+
});
|
|
17846
|
+
var GetCredentialRefreshHistoryInputValidator = external_exports.object({
|
|
17847
|
+
refreshId: external_exports.string().min(1),
|
|
17848
|
+
cursor: external_exports.string().optional(),
|
|
17849
|
+
limit: external_exports.number().int().positive().optional()
|
|
17850
|
+
});
|
|
17851
|
+
var GetCredentialRefreshHistoryResultValidator = external_exports.object({
|
|
17852
|
+
records: CredentialRefreshVersionMetadataValidator.array(),
|
|
17853
|
+
hasMore: external_exports.boolean(),
|
|
17854
|
+
cursor: external_exports.string().optional()
|
|
17855
|
+
});
|
|
17856
|
+
var CredentialRefreshChallengeValidator = external_exports.object({
|
|
17857
|
+
challenge: external_exports.string().min(1),
|
|
17858
|
+
expiresAt: external_exports.string().min(1),
|
|
17859
|
+
domain: external_exports.string().optional(),
|
|
17860
|
+
scheme: external_exports.literal("LearnCardDIDAuth").optional()
|
|
17861
|
+
});
|
|
17862
|
+
var PublicCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
17863
|
+
format: external_exports.literal("vc"),
|
|
17864
|
+
credential: VCValidator,
|
|
17865
|
+
etag: external_exports.string().optional()
|
|
17866
|
+
});
|
|
17867
|
+
var JweCredentialRefreshEnvelopeValidator = external_exports.object({
|
|
17868
|
+
format: external_exports.literal("jwe"),
|
|
17869
|
+
jwe: JWEValidator2,
|
|
17870
|
+
etag: external_exports.string().optional(),
|
|
17871
|
+
/** Present on LearnCard-managed endpoints; optional for interoperable JWE services. */
|
|
17872
|
+
version: external_exports.number().int().positive().optional()
|
|
17873
|
+
});
|
|
17874
|
+
var CredentialRefreshResponseEnvelopeValidator = external_exports.discriminatedUnion("format", [
|
|
17875
|
+
PublicCredentialRefreshEnvelopeValidator,
|
|
17876
|
+
JweCredentialRefreshEnvelopeValidator
|
|
17877
|
+
]);
|
|
17878
|
+
var CredentialRefreshFailureCodeValidator = external_exports.enum([
|
|
17879
|
+
"UNAVAILABLE",
|
|
17880
|
+
"TIMEOUT",
|
|
17881
|
+
"UNSUPPORTED_SERVICE",
|
|
17882
|
+
"UNAUTHORIZED",
|
|
17883
|
+
"MALFORMED_RESPONSE",
|
|
17884
|
+
"INVALID_PROOF",
|
|
17885
|
+
"ISSUER_MISMATCH",
|
|
17886
|
+
"ID_MISMATCH",
|
|
17887
|
+
"ROLLBACK",
|
|
17888
|
+
"REVOKED",
|
|
17889
|
+
"UNSAFE_ENDPOINT"
|
|
17890
|
+
]);
|
|
17891
|
+
var CredentialRefreshUpdatedResultValidator = external_exports.object({
|
|
17892
|
+
status: external_exports.literal("updated"),
|
|
17893
|
+
credential: VCValidator,
|
|
17894
|
+
etag: external_exports.string().optional(),
|
|
17895
|
+
managedVersion: external_exports.number().int().positive().optional()
|
|
17896
|
+
});
|
|
17897
|
+
var CredentialRefreshUnchangedResultValidator = external_exports.object({
|
|
17898
|
+
status: external_exports.literal("unchanged"),
|
|
17899
|
+
checkedAt: external_exports.string().min(1),
|
|
17900
|
+
etag: external_exports.string().optional()
|
|
17901
|
+
});
|
|
17902
|
+
var CredentialRefreshUnsupportedResultValidator = external_exports.object({
|
|
17903
|
+
status: external_exports.literal("unsupported")
|
|
17904
|
+
});
|
|
17905
|
+
var CredentialRefreshFailedResultValidator = external_exports.object({
|
|
17906
|
+
status: external_exports.literal("failed"),
|
|
17907
|
+
code: CredentialRefreshFailureCodeValidator,
|
|
17908
|
+
retryable: external_exports.boolean()
|
|
17909
|
+
});
|
|
17910
|
+
var CredentialRefreshResultValidator = external_exports.discriminatedUnion("status", [
|
|
17911
|
+
CredentialRefreshUpdatedResultValidator,
|
|
17912
|
+
CredentialRefreshUnchangedResultValidator,
|
|
17913
|
+
CredentialRefreshUnsupportedResultValidator,
|
|
17914
|
+
CredentialRefreshFailedResultValidator
|
|
17915
|
+
]);
|
|
17693
17916
|
}
|
|
17694
17917
|
});
|
|
17695
17918
|
|
|
@@ -17706,7 +17929,7 @@ var require_dist = __commonJS({
|
|
|
17706
17929
|
});
|
|
17707
17930
|
|
|
17708
17931
|
// src/index.ts
|
|
17709
|
-
var
|
|
17932
|
+
var import_types3 = __toESM(require_dist());
|
|
17710
17933
|
|
|
17711
17934
|
// src/images/filestack.helpers.ts
|
|
17712
17935
|
var filestack_helpers_exports = {};
|
|
@@ -17915,11 +18138,21 @@ var generateSrcSet3 = /* @__PURE__ */ __name((url, resolutions, { fix = false }
|
|
|
17915
18138
|
|
|
17916
18139
|
// src/images/images.helpers.ts
|
|
17917
18140
|
var Providers = { filestack: filestack_helpers_exports, unsplash: unsplash_helpers_exports, discord: discord_helpers_exports };
|
|
18141
|
+
var isHostnameMatch = /* @__PURE__ */ __name((hostname, target) => {
|
|
18142
|
+
return hostname === target || hostname.endsWith(`.${target}`);
|
|
18143
|
+
}, "isHostnameMatch");
|
|
17918
18144
|
var getProvider = /* @__PURE__ */ __name((url) => {
|
|
17919
|
-
if (url
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
18145
|
+
if (!url) return null;
|
|
18146
|
+
try {
|
|
18147
|
+
const normalizedUrl = url.startsWith("//") ? `https:${url}` : url;
|
|
18148
|
+
const { hostname } = new URL(normalizedUrl);
|
|
18149
|
+
if (isHostnameMatch(hostname, "cdn.filestackcontent.com")) return "filestack";
|
|
18150
|
+
if (isHostnameMatch(hostname, "images.unsplash.com")) return "unsplash";
|
|
18151
|
+
if (isHostnameMatch(hostname, "cdn.discordapp.com")) return "discord";
|
|
18152
|
+
return null;
|
|
18153
|
+
} catch {
|
|
18154
|
+
return null;
|
|
18155
|
+
}
|
|
17923
18156
|
}, "getProvider");
|
|
17924
18157
|
var changeQuality4 = /* @__PURE__ */ __name((url, quality) => {
|
|
17925
18158
|
const provider = getProvider(url);
|
|
@@ -17950,6 +18183,30 @@ var getUrlsFromSrcSet = /* @__PURE__ */ __name((srcSet) => {
|
|
|
17950
18183
|
}, []);
|
|
17951
18184
|
}, "getUrlsFromSrcSet");
|
|
17952
18185
|
|
|
18186
|
+
// src/images/sanitize.helpers.ts
|
|
18187
|
+
var sanitizeImageUrl = /* @__PURE__ */ __name((url, options = {}) => {
|
|
18188
|
+
if (!url) return void 0;
|
|
18189
|
+
const { allowBlobUrls = false, allowDataUrls = false } = options;
|
|
18190
|
+
try {
|
|
18191
|
+
const parsed = new URL(url);
|
|
18192
|
+
if (parsed.protocol === "https:" || parsed.protocol === "http:") {
|
|
18193
|
+
return parsed.href;
|
|
18194
|
+
}
|
|
18195
|
+
if (allowBlobUrls && parsed.protocol === "blob:") {
|
|
18196
|
+
return parsed.href;
|
|
18197
|
+
}
|
|
18198
|
+
if (allowDataUrls && parsed.protocol === "data:") {
|
|
18199
|
+
if (url.startsWith("data:image/")) {
|
|
18200
|
+
return url;
|
|
18201
|
+
}
|
|
18202
|
+
return void 0;
|
|
18203
|
+
}
|
|
18204
|
+
return void 0;
|
|
18205
|
+
} catch {
|
|
18206
|
+
return void 0;
|
|
18207
|
+
}
|
|
18208
|
+
}, "sanitizeImageUrl");
|
|
18209
|
+
|
|
17953
18210
|
// src/types/index.ts
|
|
17954
18211
|
var isNotMaybe = /* @__PURE__ */ __name((value) => value !== void 0 && value !== null, "isNotMaybe");
|
|
17955
18212
|
var filterMaybes = /* @__PURE__ */ __name((array) => array?.filter(isNotMaybe) ?? [], "filterMaybes");
|
|
@@ -18518,6 +18775,53 @@ var inferW3cVersionFromContext = /* @__PURE__ */ __name((vc) => {
|
|
|
18518
18775
|
return isV2 ? "w3c-vc-2.0" : "w3c-vc-1.1";
|
|
18519
18776
|
}, "inferW3cVersionFromContext");
|
|
18520
18777
|
|
|
18778
|
+
// src/credential-refresh.ts
|
|
18779
|
+
var import_types2 = __toESM(require_dist());
|
|
18780
|
+
var getSupportedRefreshService = /* @__PURE__ */ __name((vc) => {
|
|
18781
|
+
const refreshService = vc?.refreshService;
|
|
18782
|
+
if (!refreshService) return void 0;
|
|
18783
|
+
const services = Array.isArray(refreshService) ? refreshService : [refreshService];
|
|
18784
|
+
for (const service of services) {
|
|
18785
|
+
const parsed = import_types2.SupportedCredentialRefreshServiceValidator.safeParse(service);
|
|
18786
|
+
if (parsed.success) return parsed.data;
|
|
18787
|
+
}
|
|
18788
|
+
return void 0;
|
|
18789
|
+
}, "getSupportedRefreshService");
|
|
18790
|
+
var getCredentialIssuerId = /* @__PURE__ */ __name((vc) => {
|
|
18791
|
+
const issuer = vc?.issuer;
|
|
18792
|
+
if (!issuer) return void 0;
|
|
18793
|
+
if (typeof issuer === "string") return issuer;
|
|
18794
|
+
return typeof issuer.id === "string" ? issuer.id : void 0;
|
|
18795
|
+
}, "getCredentialIssuerId");
|
|
18796
|
+
var getCredentialEffectiveTime = /* @__PURE__ */ __name((vc) => {
|
|
18797
|
+
const raw = vc?.validFrom ?? vc?.issuanceDate;
|
|
18798
|
+
if (typeof raw !== "string" || raw.length === 0) return void 0;
|
|
18799
|
+
const parsed = Date.parse(raw);
|
|
18800
|
+
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
18801
|
+
}, "getCredentialEffectiveTime");
|
|
18802
|
+
var canonicalizeCredentialContent = /* @__PURE__ */ __name((value) => {
|
|
18803
|
+
if (Array.isArray(value)) {
|
|
18804
|
+
return value.map((entry) => canonicalizeCredentialContent(entry));
|
|
18805
|
+
}
|
|
18806
|
+
if (value !== null && typeof value === "object") {
|
|
18807
|
+
const source = value;
|
|
18808
|
+
const sorted = {};
|
|
18809
|
+
for (const key of Object.keys(source).sort()) {
|
|
18810
|
+
sorted[key] = canonicalizeCredentialContent(source[key]);
|
|
18811
|
+
}
|
|
18812
|
+
return sorted;
|
|
18813
|
+
}
|
|
18814
|
+
return value;
|
|
18815
|
+
}, "canonicalizeCredentialContent");
|
|
18816
|
+
var canonicalizeCredentialJson = /* @__PURE__ */ __name((value) => JSON.stringify(canonicalizeCredentialContent(value)), "canonicalizeCredentialJson");
|
|
18817
|
+
var credentialContentsEqual = /* @__PURE__ */ __name((first, second) => {
|
|
18818
|
+
const stripProof = /* @__PURE__ */ __name((vc) => {
|
|
18819
|
+
const { proof: _proof, ...rest } = vc ?? {};
|
|
18820
|
+
return rest;
|
|
18821
|
+
}, "stripProof");
|
|
18822
|
+
return canonicalizeCredentialJson(stripProof(first)) === canonicalizeCredentialJson(stripProof(second));
|
|
18823
|
+
}, "credentialContentsEqual");
|
|
18824
|
+
|
|
18521
18825
|
// src/did.ts
|
|
18522
18826
|
var getDidWeb = /* @__PURE__ */ __name((domain, profileId) => {
|
|
18523
18827
|
let decodedDomain = domain;
|
|
@@ -18581,7 +18885,7 @@ var parseEnvironment = /* @__PURE__ */ __name((schema, raw, context) => {
|
|
|
18581
18885
|
// src/index.ts
|
|
18582
18886
|
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
18583
18887
|
var isEncrypted = /* @__PURE__ */ __name((item) => {
|
|
18584
|
-
return
|
|
18888
|
+
return import_types3.JWEValidator.safeParse(item).success;
|
|
18585
18889
|
}, "isEncrypted");
|
|
18586
18890
|
var RegExpTransformer = {
|
|
18587
18891
|
serialize(object) {
|
|
@@ -18634,9 +18938,12 @@ export {
|
|
|
18634
18938
|
ImageWithLoadingStateValdator,
|
|
18635
18939
|
RegExpTransformer,
|
|
18636
18940
|
calculateAgeFromDob,
|
|
18941
|
+
canonicalizeCredentialContent,
|
|
18942
|
+
canonicalizeCredentialJson,
|
|
18637
18943
|
capitalizeFirstLetter,
|
|
18638
18944
|
changeQuality4 as changeQuality,
|
|
18639
18945
|
checkAppInstallEligibility,
|
|
18946
|
+
credentialContentsEqual,
|
|
18640
18947
|
curriedArraySlice,
|
|
18641
18948
|
curriedInnerImmerOuterImmer,
|
|
18642
18949
|
curriedInnerImmerOuterReact,
|
|
@@ -18657,9 +18964,12 @@ export {
|
|
|
18657
18964
|
getBitstringStatusListBit,
|
|
18658
18965
|
getBitstringStatusListEntries,
|
|
18659
18966
|
getBitstringStatusListEntryForPurpose,
|
|
18967
|
+
getCredentialEffectiveTime,
|
|
18968
|
+
getCredentialIssuerId,
|
|
18660
18969
|
getCredentialStatusArray,
|
|
18661
18970
|
getDidWeb,
|
|
18662
18971
|
getProvider,
|
|
18972
|
+
getSupportedRefreshService,
|
|
18663
18973
|
getUrlsFromSrcSet,
|
|
18664
18974
|
immerArraySlice,
|
|
18665
18975
|
innerImmerOuterImmer,
|
|
@@ -18683,6 +18993,7 @@ export {
|
|
|
18683
18993
|
requiredEnvironmentString,
|
|
18684
18994
|
resizeAndChangeQuality4 as resizeAndChangeQuality,
|
|
18685
18995
|
resolveStorageReadResult,
|
|
18996
|
+
sanitizeImageUrl,
|
|
18686
18997
|
setBitstringStatusListBit,
|
|
18687
18998
|
stripSdJwtReservedClaims,
|
|
18688
18999
|
synthesizeDidJwk,
|