@learncard/react 2.12.7 → 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.
- package/dist/cjs/{BoostGenericCard-470b0e5a.js → BoostGenericCard-64c11fe1.js} +2 -2
- package/dist/cjs/{BoostGenericCard-470b0e5a.js.map → BoostGenericCard-64c11fe1.js.map} +1 -1
- package/dist/cjs/{CertificateDisplayCard-230b3faf.js → CertificateDisplayCard-b5e72ee5.js} +3 -3
- package/dist/cjs/{CertificateDisplayCard-230b3faf.js.map → CertificateDisplayCard-b5e72ee5.js.map} +1 -1
- package/dist/cjs/{MeritBadgeDisplayCard-a15ae981.js → MeritBadgeDisplayCard-50423eeb.js} +3 -3
- package/dist/cjs/{MeritBadgeDisplayCard-a15ae981.js.map → MeritBadgeDisplayCard-50423eeb.js.map} +1 -1
- package/dist/cjs/{MeritBadgeSkillsCount-d6ee29b1.js → MeritBadgeSkillsCount-f121a3db.js} +2 -2
- package/dist/cjs/{MeritBadgeSkillsCount-d6ee29b1.js.map → MeritBadgeSkillsCount-f121a3db.js.map} +1 -1
- package/dist/cjs/{VCCard-ff6aff86.js → VCCard-72ec54b5.js} +3 -3
- package/dist/cjs/{VCCard-ff6aff86.js.map → VCCard-72ec54b5.js.map} +1 -1
- package/dist/cjs/{VCDisplayBackFace-a2ffb5cf.js → VCDisplayBackFace-c6204dda.js} +3 -3
- package/dist/cjs/{VCDisplayBackFace-a2ffb5cf.js.map → VCDisplayBackFace-c6204dda.js.map} +1 -1
- package/dist/cjs/{VCDisplayCard-db565cac.js → VCDisplayCard-e0fbeb3c.js} +3 -3
- package/dist/cjs/{VCDisplayCard-db565cac.js.map → VCDisplayCard-e0fbeb3c.js.map} +1 -1
- package/dist/cjs/{VCDisplayCard2-023672a4.js → VCDisplayCard2-5d805202.js} +16 -7
- package/dist/cjs/VCDisplayCard2-5d805202.js.map +1 -0
- package/dist/cjs/{VCVerificationPill-0db1d7c8.js → VCVerificationPill-90e6ab77.js} +2 -2
- package/dist/cjs/{VCVerificationPill-0db1d7c8.js.map → VCVerificationPill-90e6ab77.js.map} +1 -1
- package/dist/cjs/{credential.helpers-88f72e5c.js → credential.helpers-0f0e8f00.js} +2 -2
- package/dist/cjs/{credential.helpers-88f72e5c.js.map → credential.helpers-0f0e8f00.js.map} +1 -1
- package/dist/cjs/index.js +11 -11
- package/dist/cjs/index14.js +11 -11
- package/dist/cjs/index22.js +4 -4
- package/dist/cjs/index39.js +9 -9
- package/dist/cjs/index4.js +3 -3
- package/dist/cjs/index40.js +4 -4
- package/dist/cjs/index41.js +5 -5
- package/dist/cjs/index42.js +5 -5
- package/dist/cjs/index43.js +1 -1
- package/dist/cjs/index46.js +2 -2
- package/dist/cjs/index7.js +3 -3
- package/dist/cjs/{types.esm-94c6d461.js → types.esm-9062360c.js} +458 -1
- package/dist/{esm/types.esm-434cff58.js.map → cjs/types.esm-9062360c.js.map} +1 -1
- package/dist/esm/{BoostGenericCard-c9916371.js → BoostGenericCard-a2c5d561.js} +2 -2
- package/dist/esm/{BoostGenericCard-c9916371.js.map → BoostGenericCard-a2c5d561.js.map} +1 -1
- package/dist/esm/{CertificateDisplayCard-b5399522.js → CertificateDisplayCard-68d8d6ee.js} +3 -3
- package/dist/esm/{CertificateDisplayCard-b5399522.js.map → CertificateDisplayCard-68d8d6ee.js.map} +1 -1
- package/dist/esm/{MeritBadgeDisplayCard-58245297.js → MeritBadgeDisplayCard-7a32129d.js} +3 -3
- package/dist/esm/{MeritBadgeDisplayCard-58245297.js.map → MeritBadgeDisplayCard-7a32129d.js.map} +1 -1
- package/dist/esm/{MeritBadgeSkillsCount-faee4025.js → MeritBadgeSkillsCount-f0a53047.js} +2 -2
- package/dist/esm/{MeritBadgeSkillsCount-faee4025.js.map → MeritBadgeSkillsCount-f0a53047.js.map} +1 -1
- package/dist/esm/{VCCard-d72f1f76.js → VCCard-a117cfd8.js} +3 -3
- package/dist/esm/{VCCard-d72f1f76.js.map → VCCard-a117cfd8.js.map} +1 -1
- package/dist/esm/{VCDisplayBackFace-66b2683d.js → VCDisplayBackFace-2381affa.js} +3 -3
- package/dist/esm/{VCDisplayBackFace-66b2683d.js.map → VCDisplayBackFace-2381affa.js.map} +1 -1
- package/dist/esm/{VCDisplayCard-64896eb8.js → VCDisplayCard-52e66021.js} +3 -3
- package/dist/esm/{VCDisplayCard-64896eb8.js.map → VCDisplayCard-52e66021.js.map} +1 -1
- package/dist/esm/{VCDisplayCard2-54710551.js → VCDisplayCard2-b3b641a1.js} +16 -7
- package/dist/esm/VCDisplayCard2-b3b641a1.js.map +1 -0
- package/dist/esm/{VCVerificationPill-3e840476.js → VCVerificationPill-680c4e23.js} +2 -2
- package/dist/esm/{VCVerificationPill-3e840476.js.map → VCVerificationPill-680c4e23.js.map} +1 -1
- package/dist/esm/{credential.helpers-f4495f8f.js → credential.helpers-43119589.js} +2 -2
- package/dist/esm/{credential.helpers-f4495f8f.js.map → credential.helpers-43119589.js.map} +1 -1
- package/dist/esm/index.js +11 -11
- package/dist/esm/index14.js +11 -11
- package/dist/esm/index22.js +4 -4
- package/dist/esm/index39.js +9 -9
- package/dist/esm/index4.js +3 -3
- package/dist/esm/index40.js +4 -4
- package/dist/esm/index41.js +5 -5
- package/dist/esm/index42.js +5 -5
- package/dist/esm/index43.js +1 -1
- package/dist/esm/index46.js +2 -2
- package/dist/esm/index7.js +3 -3
- package/dist/esm/{types.esm-434cff58.js → types.esm-b9cb7331.js} +458 -1
- package/dist/{cjs/types.esm-94c6d461.js.map → esm/types.esm-b9cb7331.js.map} +1 -1
- package/dist/main.css +1 -1
- package/dist/main.js +1 -1
- package/package.json +4 -4
- package/src/components/VCDisplayCard2/VCIDDisplayFrontFace.tsx +8 -2
- package/dist/cjs/VCDisplayCard2-023672a4.js.map +0 -1
- package/dist/esm/VCDisplayCard2-54710551.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 = {}))
|
|
@@ -9786,6 +9787,12 @@ object({
|
|
|
9786
9787
|
this.name = "AuthSessionError";
|
|
9787
9788
|
}
|
|
9788
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
|
+
});
|
|
9789
9796
|
var BITSTRING_STATUS_PURPOSES = ["revocation", "suspension"];
|
|
9790
9797
|
var BitstringStatusPurposeValidator = _enum(BITSTRING_STATUS_PURPOSES);
|
|
9791
9798
|
var BitstringStatusListEntryValidator = object({
|
|
@@ -9894,6 +9901,456 @@ object({
|
|
|
9894
9901
|
version: number().default(1),
|
|
9895
9902
|
messages: array(inAppMessageValidator).default([])
|
|
9896
9903
|
}).passthrough();
|
|
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;
|
|
9921
|
+
}
|
|
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) {
|
|
10153
|
+
ctx.addIssue({
|
|
10154
|
+
code: "custom",
|
|
10155
|
+
message: result.message,
|
|
10156
|
+
path: result.path,
|
|
10157
|
+
params: { shareLinkCode: result.code }
|
|
10158
|
+
});
|
|
10159
|
+
}
|
|
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) {
|
|
10178
|
+
ctx.addIssue({
|
|
10179
|
+
code: "custom",
|
|
10180
|
+
message: "order must be within the selection bounds",
|
|
10181
|
+
path: ["selection", index, "order"]
|
|
10182
|
+
});
|
|
10183
|
+
}
|
|
10184
|
+
if (orders.has(entry.order)) {
|
|
10185
|
+
ctx.addIssue({
|
|
10186
|
+
code: "custom",
|
|
10187
|
+
message: "order must be unique within the selection",
|
|
10188
|
+
path: ["selection", index, "order"]
|
|
10189
|
+
});
|
|
10190
|
+
}
|
|
10191
|
+
orders.add(entry.order);
|
|
10192
|
+
});
|
|
10193
|
+
});
|
|
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()
|
|
10229
|
+
});
|
|
10230
|
+
var clientRequestId = string().uuid();
|
|
10231
|
+
object({
|
|
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();
|
|
10244
|
+
object({
|
|
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
|
+
}
|
|
10271
|
+
});
|
|
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()
|
|
10281
|
+
]);
|
|
10282
|
+
discriminatedUnion("status", [
|
|
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()
|
|
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();
|
|
9897
10354
|
|
|
9898
10355
|
exports.VerificationStatusEnum = VerificationStatusEnum;
|
|
9899
|
-
//# sourceMappingURL=types.esm-
|
|
10356
|
+
//# sourceMappingURL=types.esm-9062360c.js.map
|