@learncard/helpers 1.6.0 → 1.6.1
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/helpers.cjs.development.cjs +5165 -4388
- package/dist/helpers.cjs.development.cjs.map +3 -3
- package/dist/helpers.cjs.production.min.cjs +43 -43
- package/dist/helpers.cjs.production.min.cjs.map +4 -4
- package/dist/helpers.esm.js +620 -0
- package/dist/helpers.esm.js.map +3 -3
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/share-content-canonical.d.ts +13 -0
- package/dist/share-content-canonical.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/share-content-canonical.ts +128 -0
package/dist/helpers.esm.js
CHANGED
|
@@ -60,6 +60,8 @@ var require_types_cjs_development = __commonJS({
|
|
|
60
60
|
AchievementSubjectValidator: /* @__PURE__ */ __name(() => AchievementSubjectValidator, "AchievementSubjectValidator"),
|
|
61
61
|
AchievementTypeValidator: /* @__PURE__ */ __name(() => AchievementTypeValidator, "AchievementTypeValidator"),
|
|
62
62
|
AchievementValidator: /* @__PURE__ */ __name(() => AchievementValidator, "AchievementValidator"),
|
|
63
|
+
AcknowledgeViewInputValidator: /* @__PURE__ */ __name(() => AcknowledgeViewInputValidator, "AcknowledgeViewInputValidator"),
|
|
64
|
+
AcknowledgeViewOutputValidator: /* @__PURE__ */ __name(() => AcknowledgeViewOutputValidator, "AcknowledgeViewOutputValidator"),
|
|
63
65
|
AddTagInputValidator: /* @__PURE__ */ __name(() => AddTagInputValidator, "AddTagInputValidator"),
|
|
64
66
|
AddressValidator: /* @__PURE__ */ __name(() => AddressValidator, "AddressValidator"),
|
|
65
67
|
AgeRatingValidator: /* @__PURE__ */ __name(() => AgeRatingValidator, "AgeRatingValidator"),
|
|
@@ -137,6 +139,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
137
139
|
CreateContactMethodSessionValidator: /* @__PURE__ */ __name(() => CreateContactMethodSessionValidator, "CreateContactMethodSessionValidator"),
|
|
138
140
|
CreateManagedFrameworkBatchInputValidator: /* @__PURE__ */ __name(() => CreateManagedFrameworkBatchInputValidator, "CreateManagedFrameworkBatchInputValidator"),
|
|
139
141
|
CreateManagedFrameworkInputValidator: /* @__PURE__ */ __name(() => CreateManagedFrameworkInputValidator, "CreateManagedFrameworkInputValidator"),
|
|
142
|
+
CreateShareLinkInputValidator: /* @__PURE__ */ __name(() => CreateShareLinkInputValidator, "CreateShareLinkInputValidator"),
|
|
140
143
|
CreateSkillInputValidator: /* @__PURE__ */ __name(() => CreateSkillInputValidator, "CreateSkillInputValidator"),
|
|
141
144
|
CreateSkillsBatchInputValidator: /* @__PURE__ */ __name(() => CreateSkillsBatchInputValidator, "CreateSkillsBatchInputValidator"),
|
|
142
145
|
CredentialActivityEventTypeValidator: /* @__PURE__ */ __name(() => CredentialActivityEventTypeValidator, "CredentialActivityEventTypeValidator"),
|
|
@@ -168,10 +171,14 @@ var require_types_cjs_development = __commonJS({
|
|
|
168
171
|
DeleteSkillInputValidator: /* @__PURE__ */ __name(() => DeleteSkillInputValidator, "DeleteSkillInputValidator"),
|
|
169
172
|
DidDocumentValidator: /* @__PURE__ */ __name(() => DidDocumentValidator, "DidDocumentValidator"),
|
|
170
173
|
EMPTY_IN_APP_MESSAGES_FLAG: /* @__PURE__ */ __name(() => EMPTY_IN_APP_MESSAGES_FLAG, "EMPTY_IN_APP_MESSAGES_FLAG"),
|
|
174
|
+
ESCROW_PIN_LOCKED_MESSAGE: /* @__PURE__ */ __name(() => ESCROW_PIN_LOCKED_MESSAGE, "ESCROW_PIN_LOCKED_MESSAGE"),
|
|
175
|
+
ESCROW_PIN_MISMATCH_PATTERN: /* @__PURE__ */ __name(() => ESCROW_PIN_MISMATCH_PATTERN, "ESCROW_PIN_MISMATCH_PATTERN"),
|
|
176
|
+
ESCROW_PIN_UNAVAILABLE_MESSAGE: /* @__PURE__ */ __name(() => ESCROW_PIN_UNAVAILABLE_MESSAGE, "ESCROW_PIN_UNAVAILABLE_MESSAGE"),
|
|
171
177
|
EncryptedCredentialRecordValidator: /* @__PURE__ */ __name(() => EncryptedCredentialRecordValidator, "EncryptedCredentialRecordValidator"),
|
|
172
178
|
EncryptedRecordValidator: /* @__PURE__ */ __name(() => EncryptedRecordValidator, "EncryptedRecordValidator"),
|
|
173
179
|
EndorsementCredentialValidator: /* @__PURE__ */ __name(() => EndorsementCredentialValidator, "EndorsementCredentialValidator"),
|
|
174
180
|
EndorsementSubjectValidator: /* @__PURE__ */ __name(() => EndorsementSubjectValidator, "EndorsementSubjectValidator"),
|
|
181
|
+
EscrowPinStatusValidator: /* @__PURE__ */ __name(() => EscrowPinStatusValidator, "EscrowPinStatusValidator"),
|
|
175
182
|
EvidenceValidator: /* @__PURE__ */ __name(() => EvidenceValidator, "EvidenceValidator"),
|
|
176
183
|
FlatAuthGrantValidator: /* @__PURE__ */ __name(() => FlatAuthGrantValidator, "FlatAuthGrantValidator"),
|
|
177
184
|
FrameworkWithSkillsValidator: /* @__PURE__ */ __name(() => FrameworkWithSkillsValidator, "FrameworkWithSkillsValidator"),
|
|
@@ -253,6 +260,14 @@ var require_types_cjs_development = __commonJS({
|
|
|
253
260
|
LaunchTypeValidator: /* @__PURE__ */ __name(() => LaunchTypeValidator, "LaunchTypeValidator"),
|
|
254
261
|
LearnCardRefreshAuthorizationValidator: /* @__PURE__ */ __name(() => LearnCardRefreshAuthorizationValidator, "LearnCardRefreshAuthorizationValidator"),
|
|
255
262
|
LinkProviderFrameworkInputValidator: /* @__PURE__ */ __name(() => LinkProviderFrameworkInputValidator, "LinkProviderFrameworkInputValidator"),
|
|
263
|
+
ListShareLinksInputValidator: /* @__PURE__ */ __name(() => ListShareLinksInputValidator, "ListShareLinksInputValidator"),
|
|
264
|
+
MAX_ENDORSEMENTS: /* @__PURE__ */ __name(() => MAX_ENDORSEMENTS, "MAX_ENDORSEMENTS"),
|
|
265
|
+
MAX_SELECTED_CREDENTIALS: /* @__PURE__ */ __name(() => MAX_SELECTED_CREDENTIALS, "MAX_SELECTED_CREDENTIALS"),
|
|
266
|
+
MAX_SHARE_CIPHERTEXT_BYTES: /* @__PURE__ */ __name(() => MAX_SHARE_CIPHERTEXT_BYTES, "MAX_SHARE_CIPHERTEXT_BYTES"),
|
|
267
|
+
MAX_SHARE_LINK_REQUEST_BYTES: /* @__PURE__ */ __name(() => MAX_SHARE_LINK_REQUEST_BYTES, "MAX_SHARE_LINK_REQUEST_BYTES"),
|
|
268
|
+
MAX_SHARE_RECOVERY_JWE_BYTES: /* @__PURE__ */ __name(() => MAX_SHARE_RECOVERY_JWE_BYTES, "MAX_SHARE_RECOVERY_JWE_BYTES"),
|
|
269
|
+
MAX_SHARE_SOURCE_URI_CHARS: /* @__PURE__ */ __name(() => MAX_SHARE_SOURCE_URI_CHARS, "MAX_SHARE_SOURCE_URI_CHARS"),
|
|
270
|
+
MAX_VP_MEMBERS: /* @__PURE__ */ __name(() => MAX_VP_MEMBERS, "MAX_VP_MEMBERS"),
|
|
256
271
|
ManagedCredentialRefreshReceiptValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshReceiptValidator, "ManagedCredentialRefreshReceiptValidator"),
|
|
257
272
|
ManagedCredentialRefreshServiceValidator: /* @__PURE__ */ __name(() => ManagedCredentialRefreshServiceValidator2, "ManagedCredentialRefreshServiceValidator"),
|
|
258
273
|
PaginatedAppStoreListingsValidator: /* @__PURE__ */ __name(() => PaginatedAppStoreListingsValidator, "PaginatedAppStoreListingsValidator"),
|
|
@@ -275,6 +290,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
275
290
|
PaginatedLCNProfileManagersValidator: /* @__PURE__ */ __name(() => PaginatedLCNProfileManagersValidator, "PaginatedLCNProfileManagersValidator"),
|
|
276
291
|
PaginatedLCNProfilesAndManagersValidator: /* @__PURE__ */ __name(() => PaginatedLCNProfilesAndManagersValidator, "PaginatedLCNProfilesAndManagersValidator"),
|
|
277
292
|
PaginatedLCNProfilesValidator: /* @__PURE__ */ __name(() => PaginatedLCNProfilesValidator, "PaginatedLCNProfilesValidator"),
|
|
293
|
+
PaginatedShareLinksValidator: /* @__PURE__ */ __name(() => PaginatedShareLinksValidator, "PaginatedShareLinksValidator"),
|
|
278
294
|
PaginatedSkillFrameworksValidator: /* @__PURE__ */ __name(() => PaginatedSkillFrameworksValidator, "PaginatedSkillFrameworksValidator"),
|
|
279
295
|
PaginatedSkillTreeValidator: /* @__PURE__ */ __name(() => PaginatedSkillTreeValidator, "PaginatedSkillTreeValidator"),
|
|
280
296
|
PaginatedVisibleLCNProfilesValidator: /* @__PURE__ */ __name(() => PaginatedVisibleLCNProfilesValidator, "PaginatedVisibleLCNProfilesValidator"),
|
|
@@ -299,11 +315,20 @@ var require_types_cjs_development = __commonJS({
|
|
|
299
315
|
ReplaceSkillFrameworkSkillsInputValidator: /* @__PURE__ */ __name(() => ReplaceSkillFrameworkSkillsInputValidator, "ReplaceSkillFrameworkSkillsInputValidator"),
|
|
300
316
|
ReplaceSkillFrameworkSkillsResultValidator: /* @__PURE__ */ __name(() => ReplaceSkillFrameworkSkillsResultValidator, "ReplaceSkillFrameworkSkillsResultValidator"),
|
|
301
317
|
RequestLearnerContextEventValidator: /* @__PURE__ */ __name(() => RequestLearnerContextEventValidator, "RequestLearnerContextEventValidator"),
|
|
318
|
+
ResolveShareLinkInputValidator: /* @__PURE__ */ __name(() => ResolveShareLinkInputValidator, "ResolveShareLinkInputValidator"),
|
|
302
319
|
ResultDescriptionValidator: /* @__PURE__ */ __name(() => ResultDescriptionValidator, "ResultDescriptionValidator"),
|
|
303
320
|
ResultStatusTypeValidator: /* @__PURE__ */ __name(() => ResultStatusTypeValidator, "ResultStatusTypeValidator"),
|
|
304
321
|
ResultTypeValidator: /* @__PURE__ */ __name(() => ResultTypeValidator, "ResultTypeValidator"),
|
|
305
322
|
ResultValidator: /* @__PURE__ */ __name(() => ResultValidator, "ResultValidator"),
|
|
306
323
|
RubricCriterionValidator: /* @__PURE__ */ __name(() => RubricCriterionValidator, "RubricCriterionValidator"),
|
|
324
|
+
SHARE_AAD_PREFIX: /* @__PURE__ */ __name(() => SHARE_AAD_PREFIX, "SHARE_AAD_PREFIX"),
|
|
325
|
+
SHARE_CONTENT_KEY_BYTES: /* @__PURE__ */ __name(() => SHARE_CONTENT_KEY_BYTES, "SHARE_CONTENT_KEY_BYTES"),
|
|
326
|
+
SHARE_IV_BYTES: /* @__PURE__ */ __name(() => SHARE_IV_BYTES, "SHARE_IV_BYTES"),
|
|
327
|
+
SHARE_LINK_ID_BYTES: /* @__PURE__ */ __name(() => SHARE_LINK_ID_BYTES, "SHARE_LINK_ID_BYTES"),
|
|
328
|
+
SHARE_LINK_PROTOCOL: /* @__PURE__ */ __name(() => SHARE_LINK_PROTOCOL, "SHARE_LINK_PROTOCOL"),
|
|
329
|
+
SHARE_RECOVERY_PROTOCOL: /* @__PURE__ */ __name(() => SHARE_RECOVERY_PROTOCOL, "SHARE_RECOVERY_PROTOCOL"),
|
|
330
|
+
SHARE_TAG_BYTES: /* @__PURE__ */ __name(() => SHARE_TAG_BYTES, "SHARE_TAG_BYTES"),
|
|
331
|
+
SHARE_VIEW_RECEIPT_TTL_SECONDS: /* @__PURE__ */ __name(() => SHARE_VIEW_RECEIPT_TTL_SECONDS, "SHARE_VIEW_RECEIPT_TTL_SECONDS"),
|
|
307
332
|
SendAiSessionCredentialEventValidator: /* @__PURE__ */ __name(() => SendAiSessionCredentialEventValidator, "SendAiSessionCredentialEventValidator"),
|
|
308
333
|
SendBoostInputValidator: /* @__PURE__ */ __name(() => SendBoostInputValidator, "SendBoostInputValidator"),
|
|
309
334
|
SendBoostResponseValidator: /* @__PURE__ */ __name(() => SendBoostResponseValidator, "SendBoostResponseValidator"),
|
|
@@ -318,6 +343,32 @@ var require_types_cjs_development = __commonJS({
|
|
|
318
343
|
SentCredentialInfoValidator: /* @__PURE__ */ __name(() => SentCredentialInfoValidator, "SentCredentialInfoValidator"),
|
|
319
344
|
ServiceValidator: /* @__PURE__ */ __name(() => ServiceValidator, "ServiceValidator"),
|
|
320
345
|
SetPrimaryContactMethodValidator: /* @__PURE__ */ __name(() => SetPrimaryContactMethodValidator, "SetPrimaryContactMethodValidator"),
|
|
346
|
+
ShareCiphertextValidator: /* @__PURE__ */ __name(() => ShareCiphertextValidator, "ShareCiphertextValidator"),
|
|
347
|
+
ShareContentKeyValidator: /* @__PURE__ */ __name(() => ShareContentKeyValidator, "ShareContentKeyValidator"),
|
|
348
|
+
ShareContentStateValidator: /* @__PURE__ */ __name(() => ShareContentStateValidator, "ShareContentStateValidator"),
|
|
349
|
+
ShareEndorsementEntryValidator: /* @__PURE__ */ __name(() => ShareEndorsementEntryValidator, "ShareEndorsementEntryValidator"),
|
|
350
|
+
ShareEnvelopeValidator: /* @__PURE__ */ __name(() => ShareEnvelopeValidator, "ShareEnvelopeValidator"),
|
|
351
|
+
ShareIvValidator: /* @__PURE__ */ __name(() => ShareIvValidator, "ShareIvValidator"),
|
|
352
|
+
ShareLinkIdInputValidator: /* @__PURE__ */ __name(() => ShareLinkIdInputValidator, "ShareLinkIdInputValidator"),
|
|
353
|
+
ShareLinkIdValidator: /* @__PURE__ */ __name(() => ShareLinkIdValidator, "ShareLinkIdValidator"),
|
|
354
|
+
ShareLinkOperationKeyInputValidator: /* @__PURE__ */ __name(() => ShareLinkOperationKeyInputValidator, "ShareLinkOperationKeyInputValidator"),
|
|
355
|
+
ShareLinkOwnerCommitOutputValidator: /* @__PURE__ */ __name(() => ShareLinkOwnerCommitOutputValidator, "ShareLinkOwnerCommitOutputValidator"),
|
|
356
|
+
ShareLinkOwnerContentOutputValidator: /* @__PURE__ */ __name(() => ShareLinkOwnerContentOutputValidator, "ShareLinkOwnerContentOutputValidator"),
|
|
357
|
+
ShareLinkOwnerRecoveryOutputValidator: /* @__PURE__ */ __name(() => ShareLinkOwnerRecoveryOutputValidator, "ShareLinkOwnerRecoveryOutputValidator"),
|
|
358
|
+
ShareLinkOwnerStatusOutputValidator: /* @__PURE__ */ __name(() => ShareLinkOwnerStatusOutputValidator, "ShareLinkOwnerStatusOutputValidator"),
|
|
359
|
+
ShareLinkPublicContentViewValidator: /* @__PURE__ */ __name(() => ShareLinkPublicContentViewValidator, "ShareLinkPublicContentViewValidator"),
|
|
360
|
+
ShareLinkPublicStateValidator: /* @__PURE__ */ __name(() => ShareLinkPublicStateValidator, "ShareLinkPublicStateValidator"),
|
|
361
|
+
ShareLinkStatusValidator: /* @__PURE__ */ __name(() => ShareLinkStatusValidator, "ShareLinkStatusValidator"),
|
|
362
|
+
ShareLinkValidator: /* @__PURE__ */ __name(() => ShareLinkValidator, "ShareLinkValidator"),
|
|
363
|
+
ShareManifestPresentationValidator: /* @__PURE__ */ __name(() => ShareManifestPresentationValidator, "ShareManifestPresentationValidator"),
|
|
364
|
+
ShareOwnerRecoveryValidator: /* @__PURE__ */ __name(() => ShareOwnerRecoveryValidator, "ShareOwnerRecoveryValidator"),
|
|
365
|
+
SharePayloadValidator: /* @__PURE__ */ __name(() => SharePayloadValidator, "SharePayloadValidator"),
|
|
366
|
+
SharePayloadValidatorShape: /* @__PURE__ */ __name(() => SharePayloadValidatorShape, "SharePayloadValidatorShape"),
|
|
367
|
+
ShareRecoveryEndorsementValidator: /* @__PURE__ */ __name(() => ShareRecoveryEndorsementValidator, "ShareRecoveryEndorsementValidator"),
|
|
368
|
+
ShareRecoveryPlaintextValidator: /* @__PURE__ */ __name(() => ShareRecoveryPlaintextValidator, "ShareRecoveryPlaintextValidator"),
|
|
369
|
+
ShareRecoverySelectionValidator: /* @__PURE__ */ __name(() => ShareRecoverySelectionValidator, "ShareRecoverySelectionValidator"),
|
|
370
|
+
ShareSelectionEntryValidator: /* @__PURE__ */ __name(() => ShareSelectionEntryValidator, "ShareSelectionEntryValidator"),
|
|
371
|
+
ShareSharerValidator: /* @__PURE__ */ __name(() => ShareSharerValidator, "ShareSharerValidator"),
|
|
321
372
|
SkillDeletionStrategyValidator: /* @__PURE__ */ __name(() => SkillDeletionStrategyValidator, "SkillDeletionStrategyValidator"),
|
|
322
373
|
SkillFrameworkAdminInputValidator: /* @__PURE__ */ __name(() => SkillFrameworkAdminInputValidator, "SkillFrameworkAdminInputValidator"),
|
|
323
374
|
SkillFrameworkAdminsValidator: /* @__PURE__ */ __name(() => SkillFrameworkAdminsValidator, "SkillFrameworkAdminsValidator"),
|
|
@@ -349,6 +400,7 @@ var require_types_cjs_development = __commonJS({
|
|
|
349
400
|
UnsignedVCValidator: /* @__PURE__ */ __name(() => UnsignedVCValidator, "UnsignedVCValidator"),
|
|
350
401
|
UnsignedVPValidator: /* @__PURE__ */ __name(() => UnsignedVPValidator, "UnsignedVPValidator"),
|
|
351
402
|
UpdateFrameworkInputValidator: /* @__PURE__ */ __name(() => UpdateFrameworkInputValidator, "UpdateFrameworkInputValidator"),
|
|
403
|
+
UpdateShareLinkInputValidator: /* @__PURE__ */ __name(() => UpdateShareLinkInputValidator, "UpdateShareLinkInputValidator"),
|
|
352
404
|
UpdateSkillInputValidator: /* @__PURE__ */ __name(() => UpdateSkillInputValidator, "UpdateSkillInputValidator"),
|
|
353
405
|
VC2EvidenceValidator: /* @__PURE__ */ __name(() => VC2EvidenceValidator, "VC2EvidenceValidator"),
|
|
354
406
|
VCValidator: /* @__PURE__ */ __name(() => VCValidator, "VCValidator"),
|
|
@@ -360,7 +412,12 @@ var require_types_cjs_development = __commonJS({
|
|
|
360
412
|
VerificationStatusValidator: /* @__PURE__ */ __name(() => VerificationStatusValidator, "VerificationStatusValidator"),
|
|
361
413
|
appStoreActionValidator: /* @__PURE__ */ __name(() => appStoreActionValidator, "appStoreActionValidator"),
|
|
362
414
|
capgoUpdateActionValidator: /* @__PURE__ */ __name(() => capgoUpdateActionValidator, "capgoUpdateActionValidator"),
|
|
415
|
+
classifyShareManifest: /* @__PURE__ */ __name(() => classifyShareManifest, "classifyShareManifest"),
|
|
416
|
+
decodeBase64Url: /* @__PURE__ */ __name(() => decodeBase64Url, "decodeBase64Url"),
|
|
417
|
+
decodedBase64UrlByteLength: /* @__PURE__ */ __name(() => decodedBase64UrlByteLength, "decodedBase64UrlByteLength"),
|
|
363
418
|
dismissActionValidator: /* @__PURE__ */ __name(() => dismissActionValidator, "dismissActionValidator"),
|
|
419
|
+
encodeBase64Url: /* @__PURE__ */ __name(() => encodeBase64Url, "encodeBase64Url"),
|
|
420
|
+
escrowPinMismatchMessage: /* @__PURE__ */ __name(() => escrowPinMismatchMessage, "escrowPinMismatchMessage"),
|
|
364
421
|
externalLinkActionValidator: /* @__PURE__ */ __name(() => externalLinkActionValidator, "externalLinkActionValidator"),
|
|
365
422
|
inAppMessageActionStyleValidator: /* @__PURE__ */ __name(() => inAppMessageActionStyleValidator, "inAppMessageActionStyleValidator"),
|
|
366
423
|
inAppMessageActionTargetValidator: /* @__PURE__ */ __name(() => inAppMessageActionTargetValidator, "inAppMessageActionTargetValidator"),
|
|
@@ -375,10 +432,12 @@ var require_types_cjs_development = __commonJS({
|
|
|
375
432
|
inAppMessageVersionSourceValidator: /* @__PURE__ */ __name(() => inAppMessageVersionSourceValidator, "inAppMessageVersionSourceValidator"),
|
|
376
433
|
inAppMessagesFlagValidator: /* @__PURE__ */ __name(() => inAppMessagesFlagValidator, "inAppMessagesFlagValidator"),
|
|
377
434
|
internalLinkActionValidator: /* @__PURE__ */ __name(() => internalLinkActionValidator, "internalLinkActionValidator"),
|
|
435
|
+
isCanonicalBase64Url: /* @__PURE__ */ __name(() => isCanonicalBase64Url, "isCanonicalBase64Url"),
|
|
378
436
|
isStoredCredentialEnvelope: /* @__PURE__ */ __name(() => isStoredCredentialEnvelope2, "isStoredCredentialEnvelope"),
|
|
379
437
|
parseInAppMessagesFlag: /* @__PURE__ */ __name(() => parseInAppMessagesFlag, "parseInAppMessagesFlag"),
|
|
380
438
|
platformPredicateValidator: /* @__PURE__ */ __name(() => platformPredicateValidator, "platformPredicateValidator"),
|
|
381
439
|
rolePredicateValidator: /* @__PURE__ */ __name(() => rolePredicateValidator, "rolePredicateValidator"),
|
|
440
|
+
utf8ByteLength: /* @__PURE__ */ __name(() => utf8ByteLength, "utf8ByteLength"),
|
|
382
441
|
versionPredicateValidator: /* @__PURE__ */ __name(() => versionPredicateValidator, "versionPredicateValidator")
|
|
383
442
|
});
|
|
384
443
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -18015,6 +18074,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18015
18074
|
__name2(this, "AuthSessionError");
|
|
18016
18075
|
}
|
|
18017
18076
|
};
|
|
18077
|
+
var ESCROW_PIN_LOCKED_MESSAGE = "Too many incorrect PIN attempts. You can still recover by waiting.";
|
|
18078
|
+
var ESCROW_PIN_UNAVAILABLE_MESSAGE = "PIN recovery is not available for this account.";
|
|
18079
|
+
var ESCROW_PIN_MISMATCH_PATTERN = /^Incorrect PIN\. (\d+) attempts left\.$/;
|
|
18080
|
+
var escrowPinMismatchMessage = /* @__PURE__ */ __name2((attemptsRemaining) => `Incorrect PIN. ${attemptsRemaining} attempts left.`, "escrowPinMismatchMessage");
|
|
18081
|
+
var EscrowPinStatusValidator = external_exports.object({
|
|
18082
|
+
state: external_exports.enum(["none", "enabled", "locked", "stale"]),
|
|
18083
|
+
enabled: external_exports.boolean(),
|
|
18084
|
+
attemptsRemaining: external_exports.number().int().nonnegative(),
|
|
18085
|
+
salt: external_exports.string().optional()
|
|
18086
|
+
});
|
|
18018
18087
|
var BITSTRING_STATUS_PURPOSES = ["revocation", "suspension"];
|
|
18019
18088
|
var DEFAULT_BITSTRING_STATUS_LIST_SIZE = 131072;
|
|
18020
18089
|
var BitstringStatusPurposeValidator = external_exports.enum(BITSTRING_STATUS_PURPOSES);
|
|
@@ -18129,6 +18198,458 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18129
18198
|
const result = inAppMessagesFlagValidator.safeParse(raw);
|
|
18130
18199
|
return result.success ? result.data : EMPTY_IN_APP_MESSAGES_FLAG;
|
|
18131
18200
|
}, "parseInAppMessagesFlag");
|
|
18201
|
+
var SHARE_LINK_ID_BYTES = 16;
|
|
18202
|
+
var SHARE_CONTENT_KEY_BYTES = 32;
|
|
18203
|
+
var SHARE_IV_BYTES = 12;
|
|
18204
|
+
var SHARE_TAG_BYTES = 16;
|
|
18205
|
+
var MAX_SHARE_CIPHERTEXT_BYTES = 512 * 1024;
|
|
18206
|
+
var MAX_SHARE_RECOVERY_JWE_BYTES = 64 * 1024;
|
|
18207
|
+
var MAX_SELECTED_CREDENTIALS = 50;
|
|
18208
|
+
var MAX_ENDORSEMENTS = 200;
|
|
18209
|
+
var MAX_VP_MEMBERS = MAX_SELECTED_CREDENTIALS + MAX_ENDORSEMENTS;
|
|
18210
|
+
var MAX_SHARE_SOURCE_URI_CHARS = 2048;
|
|
18211
|
+
var MAX_SHARE_LINK_REQUEST_BYTES = 1024 * 1024;
|
|
18212
|
+
var SHARE_LINK_PROTOCOL = "lc-share/v1";
|
|
18213
|
+
var SHARE_RECOVERY_PROTOCOL = "lc-share-recovery/v1";
|
|
18214
|
+
var SHARE_AAD_PREFIX = "lc-share:v1";
|
|
18215
|
+
var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
18216
|
+
var BASE64URL_LOOKUP = (() => {
|
|
18217
|
+
const table = new Int16Array(128).fill(-1);
|
|
18218
|
+
for (let index = 0; index < BASE64URL_ALPHABET.length; index += 1) {
|
|
18219
|
+
table[BASE64URL_ALPHABET.charCodeAt(index)] = index;
|
|
18220
|
+
}
|
|
18221
|
+
return table;
|
|
18222
|
+
})();
|
|
18223
|
+
var encodeBase64Url = /* @__PURE__ */ __name2((bytes) => {
|
|
18224
|
+
let output = "";
|
|
18225
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
18226
|
+
const first = bytes[index];
|
|
18227
|
+
const second = bytes[index + 1];
|
|
18228
|
+
const third = bytes[index + 2];
|
|
18229
|
+
output += BASE64URL_ALPHABET[first >> 2];
|
|
18230
|
+
output += BASE64URL_ALPHABET[(first & 3) << 4 | (second ?? 0) >> 4];
|
|
18231
|
+
if (second === void 0) break;
|
|
18232
|
+
output += BASE64URL_ALPHABET[(second & 15) << 2 | (third ?? 0) >> 6];
|
|
18233
|
+
if (third === void 0) break;
|
|
18234
|
+
output += BASE64URL_ALPHABET[third & 63];
|
|
18235
|
+
}
|
|
18236
|
+
return output;
|
|
18237
|
+
}, "encodeBase64Url");
|
|
18238
|
+
var decodeBase64Url = /* @__PURE__ */ __name2((value) => {
|
|
18239
|
+
if (typeof value !== "string") return null;
|
|
18240
|
+
const output = new Uint8Array(Math.floor(value.length * 6 / 8));
|
|
18241
|
+
let bits = 0;
|
|
18242
|
+
let bitCount = 0;
|
|
18243
|
+
let outputIndex = 0;
|
|
18244
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
18245
|
+
const code = value.charCodeAt(index);
|
|
18246
|
+
const digit = code < 128 ? BASE64URL_LOOKUP[code] : -1;
|
|
18247
|
+
if (digit < 0) return null;
|
|
18248
|
+
bits = bits << 6 | digit;
|
|
18249
|
+
bitCount += 6;
|
|
18250
|
+
if (bitCount >= 8) {
|
|
18251
|
+
bitCount -= 8;
|
|
18252
|
+
output[outputIndex] = bits >> bitCount & 255;
|
|
18253
|
+
outputIndex += 1;
|
|
18254
|
+
}
|
|
18255
|
+
}
|
|
18256
|
+
return output;
|
|
18257
|
+
}, "decodeBase64Url");
|
|
18258
|
+
var isCanonicalBase64Url = /* @__PURE__ */ __name2((value, expectedBytes) => {
|
|
18259
|
+
if (typeof value !== "string") return false;
|
|
18260
|
+
if (expectedBytes !== void 0 && value.length !== Math.ceil(expectedBytes * 4 / 3))
|
|
18261
|
+
return false;
|
|
18262
|
+
const decoded = decodeBase64Url(value);
|
|
18263
|
+
if (decoded === null) return false;
|
|
18264
|
+
if (expectedBytes !== void 0 && decoded.length !== expectedBytes) return false;
|
|
18265
|
+
return encodeBase64Url(decoded) === value;
|
|
18266
|
+
}, "isCanonicalBase64Url");
|
|
18267
|
+
var decodedBase64UrlByteLength = /* @__PURE__ */ __name2((value) => decodeBase64Url(value)?.length ?? null, "decodedBase64UrlByteLength");
|
|
18268
|
+
var utf8ByteLength = /* @__PURE__ */ __name2((value) => new TextEncoder().encode(value).length, "utf8ByteLength");
|
|
18269
|
+
var canonicalBase64Url = /* @__PURE__ */ __name2((bytes) => external_exports.string().refine((value) => isCanonicalBase64Url(value, bytes), {
|
|
18270
|
+
message: `must be canonical base64url for exactly ${bytes} bytes`
|
|
18271
|
+
}), "canonicalBase64Url");
|
|
18272
|
+
var ShareLinkIdValidator = canonicalBase64Url(SHARE_LINK_ID_BYTES);
|
|
18273
|
+
var ShareContentKeyValidator = canonicalBase64Url(SHARE_CONTENT_KEY_BYTES);
|
|
18274
|
+
var ShareIvValidator = canonicalBase64Url(SHARE_IV_BYTES);
|
|
18275
|
+
var ShareCiphertextValidator = external_exports.string().refine(
|
|
18276
|
+
(value) => {
|
|
18277
|
+
if (value.length > Math.ceil(MAX_SHARE_CIPHERTEXT_BYTES * 4 / 3)) return false;
|
|
18278
|
+
const decoded = decodeBase64Url(value);
|
|
18279
|
+
if (decoded === null) return false;
|
|
18280
|
+
if (encodeBase64Url(decoded) !== value) return false;
|
|
18281
|
+
return decoded.length >= SHARE_TAG_BYTES && decoded.length <= MAX_SHARE_CIPHERTEXT_BYTES;
|
|
18282
|
+
},
|
|
18283
|
+
{
|
|
18284
|
+
message: `must be canonical base64url decoding to ${SHARE_TAG_BYTES}..${MAX_SHARE_CIPHERTEXT_BYTES} bytes`
|
|
18285
|
+
}
|
|
18286
|
+
);
|
|
18287
|
+
var ShareEnvelopeValidator = external_exports.object({
|
|
18288
|
+
v: external_exports.literal(1),
|
|
18289
|
+
alg: external_exports.literal("A256GCM"),
|
|
18290
|
+
iv: ShareIvValidator,
|
|
18291
|
+
ct: ShareCiphertextValidator
|
|
18292
|
+
}).strict();
|
|
18293
|
+
var safeVersion = external_exports.number().int().min(1).max(2 ** 31 - 1);
|
|
18294
|
+
var safeCredentialIndex = external_exports.number().int().min(0).max(MAX_VP_MEMBERS - 1);
|
|
18295
|
+
var ShareSelectionEntryValidator = external_exports.object({ credentialIndex: safeCredentialIndex }).strict();
|
|
18296
|
+
var ShareEndorsementEntryValidator = external_exports.object({ credentialIndex: safeCredentialIndex, targetCredentialIndex: safeCredentialIndex }).strict();
|
|
18297
|
+
var ShareSharerValidator = external_exports.object({
|
|
18298
|
+
profileId: external_exports.string().min(1).max(128),
|
|
18299
|
+
displayName: external_exports.string().min(1).max(120),
|
|
18300
|
+
avatar: external_exports.string().max(2048).optional()
|
|
18301
|
+
}).strict();
|
|
18302
|
+
var presentationShape = VPValidator.extend({
|
|
18303
|
+
verifiableCredential: VCValidator.array().min(1).max(MAX_VP_MEMBERS)
|
|
18304
|
+
});
|
|
18305
|
+
var hasBoundedPresentation = /* @__PURE__ */ __name2((value) => {
|
|
18306
|
+
let credentialCount = 0;
|
|
18307
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
18308
|
+
const visit = /* @__PURE__ */ __name2((node, depth) => {
|
|
18309
|
+
if (node === null || typeof node !== "object") return true;
|
|
18310
|
+
if (depth > 32 || ancestors.has(node)) return false;
|
|
18311
|
+
ancestors.add(node);
|
|
18312
|
+
try {
|
|
18313
|
+
for (const [key, child] of Object.entries(node)) {
|
|
18314
|
+
if (key === "verifiableCredential") {
|
|
18315
|
+
credentialCount += Array.isArray(child) ? child.length : 1;
|
|
18316
|
+
if (credentialCount > MAX_VP_MEMBERS) return false;
|
|
18317
|
+
}
|
|
18318
|
+
if (!visit(child, depth + 1)) return false;
|
|
18319
|
+
}
|
|
18320
|
+
return true;
|
|
18321
|
+
} finally {
|
|
18322
|
+
ancestors.delete(node);
|
|
18323
|
+
}
|
|
18324
|
+
}, "visit");
|
|
18325
|
+
return visit(value, 0);
|
|
18326
|
+
}, "hasBoundedPresentation");
|
|
18327
|
+
var ShareManifestPresentationValidator = external_exports.custom(
|
|
18328
|
+
(value) => hasBoundedPresentation(value) && presentationShape.safeParse(value).success,
|
|
18329
|
+
{ message: "invalid share presentation" }
|
|
18330
|
+
);
|
|
18331
|
+
var SharePayloadValidatorShape = external_exports.object({
|
|
18332
|
+
protocol: external_exports.literal(SHARE_LINK_PROTOCOL),
|
|
18333
|
+
shareId: ShareLinkIdValidator,
|
|
18334
|
+
contentVersion: safeVersion,
|
|
18335
|
+
createdAt: external_exports.iso.datetime(),
|
|
18336
|
+
sharer: ShareSharerValidator,
|
|
18337
|
+
presentation: ShareManifestPresentationValidator,
|
|
18338
|
+
selection: ShareSelectionEntryValidator.array().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
18339
|
+
endorsements: ShareEndorsementEntryValidator.array().max(MAX_ENDORSEMENTS).default([])
|
|
18340
|
+
}).strict();
|
|
18341
|
+
var classificationFailure = /* @__PURE__ */ __name2((code, message, path = []) => ({ ok: false, code, message, path }), "classificationFailure");
|
|
18342
|
+
var readSignedClaimId = /* @__PURE__ */ __name2((member) => {
|
|
18343
|
+
if (member === null || typeof member !== "object") return void 0;
|
|
18344
|
+
const record2 = member;
|
|
18345
|
+
const claim = record2.credentialSubject ?? record2.endorsement;
|
|
18346
|
+
if (claim === null || typeof claim !== "object") return void 0;
|
|
18347
|
+
const claimRecord = claim;
|
|
18348
|
+
const nested = claimRecord.endorsement;
|
|
18349
|
+
const nestedId = nested !== null && typeof nested === "object" ? nested.id : void 0;
|
|
18350
|
+
return claimRecord.id ?? nestedId;
|
|
18351
|
+
}, "readSignedClaimId");
|
|
18352
|
+
var classifyShareManifest = /* @__PURE__ */ __name2((payload) => {
|
|
18353
|
+
const members = payload.presentation?.verifiableCredential;
|
|
18354
|
+
if (!Array.isArray(members) || members.length === 0) {
|
|
18355
|
+
return classificationFailure("NO_PRESENTATION_MEMBERS", "presentation has no credentials");
|
|
18356
|
+
}
|
|
18357
|
+
if (members.length > MAX_VP_MEMBERS) {
|
|
18358
|
+
return classificationFailure(
|
|
18359
|
+
"TOO_MANY_VP_MEMBERS",
|
|
18360
|
+
`presentation has ${members.length} members, over the ${MAX_VP_MEMBERS} bound`
|
|
18361
|
+
);
|
|
18362
|
+
}
|
|
18363
|
+
const selection = payload.selection;
|
|
18364
|
+
const endorsements = payload.endorsements ?? [];
|
|
18365
|
+
if (!Array.isArray(selection) || selection.length < 1 || selection.length > MAX_SELECTED_CREDENTIALS) {
|
|
18366
|
+
return classificationFailure("BAD_SELECTION", "selection must contain 1..50 entries");
|
|
18367
|
+
}
|
|
18368
|
+
if (!Array.isArray(endorsements) || endorsements.length > MAX_ENDORSEMENTS) {
|
|
18369
|
+
return classificationFailure(
|
|
18370
|
+
"BAD_ENDORSEMENTS",
|
|
18371
|
+
"endorsements must contain at most 200 entries"
|
|
18372
|
+
);
|
|
18373
|
+
}
|
|
18374
|
+
const selectedIndices = [];
|
|
18375
|
+
const selected = /* @__PURE__ */ new Set();
|
|
18376
|
+
for (let index = 0; index < selection.length; index += 1) {
|
|
18377
|
+
const entry = selection[index];
|
|
18378
|
+
const credentialIndex = entry?.credentialIndex;
|
|
18379
|
+
if (!Number.isSafeInteger(credentialIndex) || credentialIndex < 0 || credentialIndex >= members.length) {
|
|
18380
|
+
return classificationFailure(
|
|
18381
|
+
"SELECTION_INDEX_OUT_OF_BOUNDS",
|
|
18382
|
+
`selection[${index}].credentialIndex is out of bounds`,
|
|
18383
|
+
["selection", index, "credentialIndex"]
|
|
18384
|
+
);
|
|
18385
|
+
}
|
|
18386
|
+
if (selected.has(credentialIndex)) {
|
|
18387
|
+
return classificationFailure(
|
|
18388
|
+
"SELECTION_INDEX_DUPLICATE",
|
|
18389
|
+
`selection[${index}].credentialIndex is duplicated`,
|
|
18390
|
+
["selection", index, "credentialIndex"]
|
|
18391
|
+
);
|
|
18392
|
+
}
|
|
18393
|
+
selected.add(credentialIndex);
|
|
18394
|
+
selectedIndices.push(credentialIndex);
|
|
18395
|
+
}
|
|
18396
|
+
const classified = new Set(selected);
|
|
18397
|
+
const endorsementIndices = [];
|
|
18398
|
+
for (let index = 0; index < endorsements.length; index += 1) {
|
|
18399
|
+
const entry = endorsements[index];
|
|
18400
|
+
const credentialIndex = entry?.credentialIndex;
|
|
18401
|
+
const targetIndex = entry?.targetCredentialIndex;
|
|
18402
|
+
if (!Number.isSafeInteger(credentialIndex) || credentialIndex < 0 || credentialIndex >= members.length) {
|
|
18403
|
+
return classificationFailure(
|
|
18404
|
+
"ENDORSEMENT_INDEX_OUT_OF_BOUNDS",
|
|
18405
|
+
`endorsements[${index}].credentialIndex is out of bounds`,
|
|
18406
|
+
["endorsements", index, "credentialIndex"]
|
|
18407
|
+
);
|
|
18408
|
+
}
|
|
18409
|
+
if (classified.has(credentialIndex)) {
|
|
18410
|
+
return classificationFailure(
|
|
18411
|
+
"VP_MEMBER_CLASSIFIED_TWICE",
|
|
18412
|
+
`endorsements[${index}].credentialIndex was already classified`,
|
|
18413
|
+
["endorsements", index, "credentialIndex"]
|
|
18414
|
+
);
|
|
18415
|
+
}
|
|
18416
|
+
if (!selected.has(targetIndex)) {
|
|
18417
|
+
return classificationFailure(
|
|
18418
|
+
"ENDORSEMENT_TARGET_NOT_SELECTED",
|
|
18419
|
+
`endorsements[${index}].targetCredentialIndex must reference a selected credential`,
|
|
18420
|
+
["endorsements", index, "targetCredentialIndex"]
|
|
18421
|
+
);
|
|
18422
|
+
}
|
|
18423
|
+
const referenced = readSignedClaimId(members[credentialIndex]);
|
|
18424
|
+
const target = members[targetIndex];
|
|
18425
|
+
const targetId = target !== null && typeof target === "object" ? target.id : void 0;
|
|
18426
|
+
if (typeof referenced !== "string" || typeof targetId !== "string" || referenced !== targetId) {
|
|
18427
|
+
return classificationFailure(
|
|
18428
|
+
"ENDORSEMENT_TARGET_UNBOUND",
|
|
18429
|
+
`endorsements[${index}] claim does not reference the target credential id`,
|
|
18430
|
+
["endorsements", index]
|
|
18431
|
+
);
|
|
18432
|
+
}
|
|
18433
|
+
classified.add(credentialIndex);
|
|
18434
|
+
endorsementIndices.push(credentialIndex);
|
|
18435
|
+
}
|
|
18436
|
+
if (classified.size !== members.length) {
|
|
18437
|
+
return classificationFailure(
|
|
18438
|
+
"UNCLASSIFIED_VP_MEMBER",
|
|
18439
|
+
"every presentation member must be classified exactly once",
|
|
18440
|
+
["presentation", "verifiableCredential"]
|
|
18441
|
+
);
|
|
18442
|
+
}
|
|
18443
|
+
return {
|
|
18444
|
+
ok: true,
|
|
18445
|
+
classification: { selectedIndices, endorsementIndices, memberCount: members.length }
|
|
18446
|
+
};
|
|
18447
|
+
}, "classifyShareManifest");
|
|
18448
|
+
var SharePayloadValidator = SharePayloadValidatorShape.superRefine((payload, ctx) => {
|
|
18449
|
+
const result = classifyShareManifest(payload);
|
|
18450
|
+
if (!result.ok) {
|
|
18451
|
+
ctx.addIssue({
|
|
18452
|
+
code: "custom",
|
|
18453
|
+
message: result.message,
|
|
18454
|
+
path: result.path,
|
|
18455
|
+
params: { shareLinkCode: result.code }
|
|
18456
|
+
});
|
|
18457
|
+
}
|
|
18458
|
+
});
|
|
18459
|
+
var ShareRecoverySelectionValidator = external_exports.object({
|
|
18460
|
+
ref: external_exports.string().min(1).max(MAX_SHARE_SOURCE_URI_CHARS),
|
|
18461
|
+
order: external_exports.number().int().min(0).max(MAX_SELECTED_CREDENTIALS - 1)
|
|
18462
|
+
}).strict();
|
|
18463
|
+
var ShareRecoveryEndorsementValidator = external_exports.object({ targetRef: external_exports.string().min(1).max(MAX_SHARE_SOURCE_URI_CHARS) }).strict();
|
|
18464
|
+
var ShareRecoveryPlaintextValidator = external_exports.object({
|
|
18465
|
+
protocol: external_exports.literal(SHARE_RECOVERY_PROTOCOL),
|
|
18466
|
+
shareId: ShareLinkIdValidator,
|
|
18467
|
+
ownerProfileId: external_exports.string().min(1).max(128),
|
|
18468
|
+
createdAt: external_exports.iso.datetime(),
|
|
18469
|
+
latest: external_exports.object({ contentVersion: safeVersion, key: ShareContentKeyValidator }).strict(),
|
|
18470
|
+
selection: ShareRecoverySelectionValidator.array().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
18471
|
+
endorsements: ShareRecoveryEndorsementValidator.array().max(MAX_ENDORSEMENTS).default([])
|
|
18472
|
+
}).strict().superRefine((recovery, ctx) => {
|
|
18473
|
+
const orders = /* @__PURE__ */ new Set();
|
|
18474
|
+
recovery.selection.forEach((entry, index) => {
|
|
18475
|
+
if (entry.order >= recovery.selection.length) {
|
|
18476
|
+
ctx.addIssue({
|
|
18477
|
+
code: "custom",
|
|
18478
|
+
message: "order must be within the selection bounds",
|
|
18479
|
+
path: ["selection", index, "order"]
|
|
18480
|
+
});
|
|
18481
|
+
}
|
|
18482
|
+
if (orders.has(entry.order)) {
|
|
18483
|
+
ctx.addIssue({
|
|
18484
|
+
code: "custom",
|
|
18485
|
+
message: "order must be unique within the selection",
|
|
18486
|
+
path: ["selection", index, "order"]
|
|
18487
|
+
});
|
|
18488
|
+
}
|
|
18489
|
+
orders.add(entry.order);
|
|
18490
|
+
});
|
|
18491
|
+
});
|
|
18492
|
+
var ShareOwnerRecoveryValidator = JWEValidator2.refine(
|
|
18493
|
+
(value) => utf8ByteLength(JSON.stringify(value)) <= MAX_SHARE_RECOVERY_JWE_BYTES,
|
|
18494
|
+
{ message: `serialized recovery JWE must be at most ${MAX_SHARE_RECOVERY_JWE_BYTES} bytes` }
|
|
18495
|
+
);
|
|
18496
|
+
var ShareLinkStatusValidator = external_exports.enum(["pending", "active", "stopped"]);
|
|
18497
|
+
var ShareContentStateValidator = external_exports.enum(["staging", "finalized", "content_missing"]);
|
|
18498
|
+
var ShareLinkValidator = external_exports.object({
|
|
18499
|
+
id: ShareLinkIdValidator,
|
|
18500
|
+
title: external_exports.string().min(1).max(120),
|
|
18501
|
+
note: external_exports.string().max(500).optional(),
|
|
18502
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
18503
|
+
version: safeVersion,
|
|
18504
|
+
contentVersion: safeVersion,
|
|
18505
|
+
status: ShareLinkStatusValidator,
|
|
18506
|
+
contentState: ShareContentStateValidator,
|
|
18507
|
+
createdAt: external_exports.iso.datetime(),
|
|
18508
|
+
updatedAt: external_exports.iso.datetime(),
|
|
18509
|
+
expiresAt: external_exports.iso.datetime().nullable(),
|
|
18510
|
+
stoppedAt: external_exports.iso.datetime().nullable(),
|
|
18511
|
+
lastViewedAt: external_exports.iso.datetime().nullable(),
|
|
18512
|
+
viewCount: external_exports.number().int().min(0).optional(),
|
|
18513
|
+
passcodeProtected: external_exports.boolean(),
|
|
18514
|
+
notifyOnView: external_exports.boolean(),
|
|
18515
|
+
minorPolicy: external_exports.object({
|
|
18516
|
+
isMinor: external_exports.boolean().nullable(),
|
|
18517
|
+
policyResolved: external_exports.boolean(),
|
|
18518
|
+
defaultExpiryDays: external_exports.union([external_exports.literal(30), external_exports.literal(365)]),
|
|
18519
|
+
viewCountingEnabled: external_exports.boolean()
|
|
18520
|
+
}),
|
|
18521
|
+
/**
|
|
18522
|
+
* Guarded application/API URL for the content. Optional because owner APIs in
|
|
18523
|
+
* D1 have no public resolve/content endpoint yet; it must never be a
|
|
18524
|
+
* LearnCloud object URL or carry a fabricated decryption key.
|
|
18525
|
+
*/
|
|
18526
|
+
contentUrl: external_exports.string().optional()
|
|
18527
|
+
});
|
|
18528
|
+
var clientRequestId = external_exports.string().uuid();
|
|
18529
|
+
var CreateShareLinkInputValidator = external_exports.object({
|
|
18530
|
+
id: ShareLinkIdValidator,
|
|
18531
|
+
clientRequestId,
|
|
18532
|
+
title: external_exports.string().min(1).max(120),
|
|
18533
|
+
note: external_exports.string().max(500).optional(),
|
|
18534
|
+
expiresAt: external_exports.iso.datetime().nullable().optional(),
|
|
18535
|
+
passcode: external_exports.string().min(8).max(64).optional(),
|
|
18536
|
+
notifyOnView: external_exports.boolean().default(false),
|
|
18537
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
18538
|
+
contentVersion: external_exports.literal(1),
|
|
18539
|
+
envelope: ShareEnvelopeValidator,
|
|
18540
|
+
ownerEncryptedRecovery: ShareOwnerRecoveryValidator
|
|
18541
|
+
}).strict();
|
|
18542
|
+
var UpdateShareLinkInputValidator = external_exports.object({
|
|
18543
|
+
id: ShareLinkIdValidator,
|
|
18544
|
+
expectedVersion: safeVersion,
|
|
18545
|
+
clientRequestId,
|
|
18546
|
+
title: external_exports.string().min(1).max(120).optional(),
|
|
18547
|
+
note: external_exports.string().max(500).nullable().optional(),
|
|
18548
|
+
expiresAt: external_exports.iso.datetime().nullable().optional(),
|
|
18549
|
+
/** Omitted preserves the current passcode, null removes it, and a string replaces it. */
|
|
18550
|
+
passcode: external_exports.string().min(8).max(64).nullable().optional(),
|
|
18551
|
+
notifyOnView: external_exports.boolean().optional(),
|
|
18552
|
+
contentVersion: safeVersion.optional(),
|
|
18553
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS).optional(),
|
|
18554
|
+
envelope: ShareEnvelopeValidator.optional(),
|
|
18555
|
+
ownerEncryptedRecovery: ShareOwnerRecoveryValidator.optional()
|
|
18556
|
+
}).strict().superRefine((value, ctx) => {
|
|
18557
|
+
const provided = [
|
|
18558
|
+
value.contentVersion,
|
|
18559
|
+
value.selectedCount,
|
|
18560
|
+
value.envelope,
|
|
18561
|
+
value.ownerEncryptedRecovery
|
|
18562
|
+
].filter((field) => field !== void 0).length;
|
|
18563
|
+
if (provided !== 0 && provided !== 4) {
|
|
18564
|
+
ctx.addIssue({
|
|
18565
|
+
code: "custom",
|
|
18566
|
+
message: "content replacement requires contentVersion, selectedCount, envelope and ownerEncryptedRecovery together"
|
|
18567
|
+
});
|
|
18568
|
+
}
|
|
18569
|
+
});
|
|
18570
|
+
var ShareLinkIdInputValidator = external_exports.object({ id: ShareLinkIdValidator }).strict();
|
|
18571
|
+
var ShareLinkOperationKeyInputValidator = external_exports.object({ id: ShareLinkIdValidator, operationId: external_exports.string().uuid() }).strict();
|
|
18572
|
+
var ShareLinkOwnerCommitOutputValidator = external_exports.discriminatedUnion("status", [
|
|
18573
|
+
external_exports.object({ status: external_exports.literal("completed"), share: ShareLinkValidator }).strict(),
|
|
18574
|
+
external_exports.object({
|
|
18575
|
+
status: external_exports.literal("pending"),
|
|
18576
|
+
id: ShareLinkIdValidator,
|
|
18577
|
+
operationId: external_exports.string().uuid()
|
|
18578
|
+
}).strict()
|
|
18579
|
+
]);
|
|
18580
|
+
var ShareLinkOwnerStatusOutputValidator = external_exports.discriminatedUnion("status", [
|
|
18581
|
+
external_exports.object({ status: external_exports.literal("found"), share: ShareLinkValidator }).strict(),
|
|
18582
|
+
external_exports.object({
|
|
18583
|
+
status: external_exports.literal("pending"),
|
|
18584
|
+
id: ShareLinkIdValidator,
|
|
18585
|
+
operationId: external_exports.string().uuid()
|
|
18586
|
+
}).strict(),
|
|
18587
|
+
external_exports.object({ status: external_exports.literal("not_found"), id: ShareLinkIdValidator }).strict()
|
|
18588
|
+
]);
|
|
18589
|
+
var ShareLinkOwnerRecoveryOutputValidator = external_exports.object({ recovery: ShareOwnerRecoveryValidator }).strict();
|
|
18590
|
+
var ShareLinkOwnerContentOutputValidator = external_exports.object({
|
|
18591
|
+
id: ShareLinkIdValidator,
|
|
18592
|
+
contentVersion: safeVersion,
|
|
18593
|
+
envelope: ShareEnvelopeValidator
|
|
18594
|
+
}).strict();
|
|
18595
|
+
var ResolveShareLinkInputValidator = external_exports.object({
|
|
18596
|
+
id: ShareLinkIdValidator,
|
|
18597
|
+
/** Sent only in a POST body; it must never be placed in a share URL. */
|
|
18598
|
+
passcode: external_exports.string().min(4).max(64).optional()
|
|
18599
|
+
}).strict();
|
|
18600
|
+
var ShareLinkPublicStateValidator = external_exports.discriminatedUnion("state", [
|
|
18601
|
+
external_exports.object({
|
|
18602
|
+
state: external_exports.literal("passcode_required"),
|
|
18603
|
+
id: ShareLinkIdValidator
|
|
18604
|
+
}).strict(),
|
|
18605
|
+
external_exports.object({ state: external_exports.literal("try_later"), id: ShareLinkIdValidator }).strict(),
|
|
18606
|
+
external_exports.object({
|
|
18607
|
+
state: external_exports.literal("active"),
|
|
18608
|
+
id: ShareLinkIdValidator,
|
|
18609
|
+
title: external_exports.string().max(120),
|
|
18610
|
+
note: external_exports.string().max(500).optional(),
|
|
18611
|
+
selectedCount: external_exports.number().int().min(1).max(MAX_SELECTED_CREDENTIALS),
|
|
18612
|
+
contentVersion: safeVersion,
|
|
18613
|
+
contentUrl: external_exports.string(),
|
|
18614
|
+
sharer: external_exports.object({
|
|
18615
|
+
displayName: external_exports.string().max(120),
|
|
18616
|
+
avatar: external_exports.string().max(2048).optional()
|
|
18617
|
+
}),
|
|
18618
|
+
createdAt: external_exports.iso.datetime(),
|
|
18619
|
+
updatedAt: external_exports.iso.datetime(),
|
|
18620
|
+
expiresAt: external_exports.iso.datetime().nullable()
|
|
18621
|
+
}).strict(),
|
|
18622
|
+
external_exports.object({
|
|
18623
|
+
state: external_exports.literal("expired"),
|
|
18624
|
+
id: ShareLinkIdValidator,
|
|
18625
|
+
expiresAt: external_exports.iso.datetime()
|
|
18626
|
+
}).strict(),
|
|
18627
|
+
external_exports.object({
|
|
18628
|
+
state: external_exports.literal("stopped"),
|
|
18629
|
+
id: ShareLinkIdValidator,
|
|
18630
|
+
stoppedAt: external_exports.iso.datetime()
|
|
18631
|
+
}).strict(),
|
|
18632
|
+
external_exports.object({ state: external_exports.literal("not_found"), id: ShareLinkIdValidator }).strict()
|
|
18633
|
+
]);
|
|
18634
|
+
var ListShareLinksInputValidator = external_exports.object({
|
|
18635
|
+
limit: external_exports.number().int().min(1).max(50).default(25),
|
|
18636
|
+
cursor: external_exports.string().max(512).optional()
|
|
18637
|
+
}).strict();
|
|
18638
|
+
var PaginatedShareLinksValidator = PaginationResponseValidator.extend({
|
|
18639
|
+
records: ShareLinkValidator.array()
|
|
18640
|
+
});
|
|
18641
|
+
var AcknowledgeViewInputValidator = external_exports.object({
|
|
18642
|
+
receipt: external_exports.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/)
|
|
18643
|
+
}).strict();
|
|
18644
|
+
var AcknowledgeViewOutputValidator = external_exports.object({ ok: external_exports.literal(true) }).strict();
|
|
18645
|
+
var SHARE_VIEW_RECEIPT_TTL_SECONDS = 10 * 60;
|
|
18646
|
+
var ShareLinkPublicContentViewValidator = external_exports.object({
|
|
18647
|
+
id: ShareLinkIdValidator,
|
|
18648
|
+
contentVersion: safeVersion,
|
|
18649
|
+
envelope: ShareEnvelopeValidator,
|
|
18650
|
+
contentUrl: external_exports.string(),
|
|
18651
|
+
receipt: external_exports.string().min(22).max(128).regex(/^[A-Za-z0-9_-]+$/)
|
|
18652
|
+
}).strict();
|
|
18132
18653
|
}
|
|
18133
18654
|
});
|
|
18134
18655
|
|
|
@@ -19226,6 +19747,101 @@ var parseEnvironment = /* @__PURE__ */ __name((schema, raw, context) => {
|
|
|
19226
19747
|
);
|
|
19227
19748
|
}, "parseEnvironment");
|
|
19228
19749
|
|
|
19750
|
+
// src/share-content-canonical.ts
|
|
19751
|
+
var DEFAULT_MAX_CANONICAL_BYTES = 2 * 1024 * 1024;
|
|
19752
|
+
var DEFAULT_MAX_CANONICAL_DEPTH = 32;
|
|
19753
|
+
var LONE_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
19754
|
+
var ShareContentCanonicalizationError = class extends Error {
|
|
19755
|
+
constructor(message) {
|
|
19756
|
+
super(message);
|
|
19757
|
+
this.code = "UNSUPPORTED_REQUEST_VALUE";
|
|
19758
|
+
this.name = "ShareContentCanonicalizationError";
|
|
19759
|
+
}
|
|
19760
|
+
static {
|
|
19761
|
+
__name(this, "ShareContentCanonicalizationError");
|
|
19762
|
+
}
|
|
19763
|
+
};
|
|
19764
|
+
var serializeCanonical = /* @__PURE__ */ __name((value, seen, depth, maxDepth) => {
|
|
19765
|
+
if (value === null) return "null";
|
|
19766
|
+
switch (typeof value) {
|
|
19767
|
+
case "boolean":
|
|
19768
|
+
return value ? "true" : "false";
|
|
19769
|
+
case "string": {
|
|
19770
|
+
if (LONE_SURROGATE_RE.test(value)) {
|
|
19771
|
+
throw new ShareContentCanonicalizationError(
|
|
19772
|
+
"string contains an unpaired surrogate"
|
|
19773
|
+
);
|
|
19774
|
+
}
|
|
19775
|
+
return JSON.stringify(value);
|
|
19776
|
+
}
|
|
19777
|
+
case "number": {
|
|
19778
|
+
if (!Number.isSafeInteger(value) || Object.is(value, -0)) {
|
|
19779
|
+
throw new ShareContentCanonicalizationError(
|
|
19780
|
+
"numbers must be safe integers without a negative-zero sign"
|
|
19781
|
+
);
|
|
19782
|
+
}
|
|
19783
|
+
return String(value);
|
|
19784
|
+
}
|
|
19785
|
+
case "object": {
|
|
19786
|
+
if (depth >= maxDepth) {
|
|
19787
|
+
throw new ShareContentCanonicalizationError(
|
|
19788
|
+
"value exceeds the maximum nesting depth"
|
|
19789
|
+
);
|
|
19790
|
+
}
|
|
19791
|
+
if (seen.has(value)) {
|
|
19792
|
+
throw new ShareContentCanonicalizationError("cyclic value is not supported");
|
|
19793
|
+
}
|
|
19794
|
+
seen.add(value);
|
|
19795
|
+
try {
|
|
19796
|
+
if (Array.isArray(value)) {
|
|
19797
|
+
const items = [];
|
|
19798
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
19799
|
+
if (!(index in value)) {
|
|
19800
|
+
throw new ShareContentCanonicalizationError(
|
|
19801
|
+
"sparse arrays are not supported"
|
|
19802
|
+
);
|
|
19803
|
+
}
|
|
19804
|
+
items.push(serializeCanonical(value[index], seen, depth + 1, maxDepth));
|
|
19805
|
+
}
|
|
19806
|
+
return `[${items.join(",")}]`;
|
|
19807
|
+
}
|
|
19808
|
+
const prototype = Object.getPrototypeOf(value);
|
|
19809
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
19810
|
+
throw new ShareContentCanonicalizationError("only plain objects are supported");
|
|
19811
|
+
}
|
|
19812
|
+
const record = value;
|
|
19813
|
+
const entries = Object.keys(record).sort().map((key) => {
|
|
19814
|
+
if (LONE_SURROGATE_RE.test(key)) {
|
|
19815
|
+
throw new ShareContentCanonicalizationError(
|
|
19816
|
+
"object key contains an unpaired surrogate"
|
|
19817
|
+
);
|
|
19818
|
+
}
|
|
19819
|
+
return `${JSON.stringify(key)}:${serializeCanonical(
|
|
19820
|
+
record[key],
|
|
19821
|
+
seen,
|
|
19822
|
+
depth + 1,
|
|
19823
|
+
maxDepth
|
|
19824
|
+
)}`;
|
|
19825
|
+
});
|
|
19826
|
+
return `{${entries.join(",")}}`;
|
|
19827
|
+
} finally {
|
|
19828
|
+
seen.delete(value);
|
|
19829
|
+
}
|
|
19830
|
+
}
|
|
19831
|
+
default:
|
|
19832
|
+
throw new ShareContentCanonicalizationError(`unsupported value type: ${typeof value}`);
|
|
19833
|
+
}
|
|
19834
|
+
}, "serializeCanonical");
|
|
19835
|
+
var canonicalizeShareContentRequestBody = /* @__PURE__ */ __name((body, options = {}) => {
|
|
19836
|
+
const maxBytes = options.maxBytes ?? DEFAULT_MAX_CANONICAL_BYTES;
|
|
19837
|
+
const maxDepth = options.maxDepth ?? DEFAULT_MAX_CANONICAL_DEPTH;
|
|
19838
|
+
const serialized = serializeCanonical(body, /* @__PURE__ */ new Set(), 0, maxDepth);
|
|
19839
|
+
if (new TextEncoder().encode(serialized).byteLength > maxBytes) {
|
|
19840
|
+
throw new ShareContentCanonicalizationError("canonical request exceeds the maximum size");
|
|
19841
|
+
}
|
|
19842
|
+
return serialized;
|
|
19843
|
+
}, "canonicalizeShareContentRequestBody");
|
|
19844
|
+
|
|
19229
19845
|
// src/index.ts
|
|
19230
19846
|
var isHex = /* @__PURE__ */ __name((str) => /^[0-9a-f]+$/i.test(str), "isHex");
|
|
19231
19847
|
var isEncrypted = /* @__PURE__ */ __name((item) => {
|
|
@@ -19275,6 +19891,8 @@ var isAppDidWeb = /* @__PURE__ */ __name((did) => {
|
|
|
19275
19891
|
}, "isAppDidWeb");
|
|
19276
19892
|
export {
|
|
19277
19893
|
AGE_RATING_TO_MIN_AGE,
|
|
19894
|
+
DEFAULT_MAX_CANONICAL_BYTES,
|
|
19895
|
+
DEFAULT_MAX_CANONICAL_DEPTH,
|
|
19278
19896
|
DEFAULT_RESOLUTIONS,
|
|
19279
19897
|
EnvironmentConfigurationError,
|
|
19280
19898
|
ImageResizingValidator,
|
|
@@ -19285,9 +19903,11 @@ export {
|
|
|
19285
19903
|
MANAGED_REFRESH_SERVICE_CONTEXT,
|
|
19286
19904
|
MANAGED_REFRESH_TYPE_IRI,
|
|
19287
19905
|
RegExpTransformer,
|
|
19906
|
+
ShareContentCanonicalizationError,
|
|
19288
19907
|
calculateAgeFromDob,
|
|
19289
19908
|
canonicalizeCredentialContent,
|
|
19290
19909
|
canonicalizeCredentialJson,
|
|
19910
|
+
canonicalizeShareContentRequestBody,
|
|
19291
19911
|
capitalizeFirstLetter,
|
|
19292
19912
|
changeQuality4 as changeQuality,
|
|
19293
19913
|
checkAppInstallEligibility,
|