@mattrglobal/verifier-sdk-web 1.1.1-unstable.160 → 1.1.1-unstable.162
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/lib/verifier-js-no-deps.cjs.js +16 -26
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +270 -200
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/verifier/types/credential-presentation.d.ts +12 -39
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +15 -15
- package/dist/verifier-js.development.js +268 -197
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +2 -2
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +2 -2
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +3 -3
|
@@ -69,10 +69,20 @@ const unwrap = (result, errMessage) => {
|
|
|
69
69
|
|
|
70
70
|
const isType = validator => value => v__namespace.safeParse(validator, value).success;
|
|
71
71
|
|
|
72
|
-
const getValidationErrors = issues =>
|
|
73
|
-
message: message,
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
const getValidationErrors = issues => {
|
|
73
|
+
const formatIssue = ({message: message, path: path}) => ({
|
|
74
|
+
message: message,
|
|
75
|
+
path: path === null || path === void 0 ? void 0 : path.map((p => p.key))
|
|
76
|
+
});
|
|
77
|
+
const uniqueErrors = new Map;
|
|
78
|
+
issues.flatMap((issue => issue.type === "union" && issue.issues ? issue.issues.map(formatIssue) : [ formatIssue(issue) ])).forEach((error => {
|
|
79
|
+
const key = `${error.message}-${JSON.stringify(error.path)}`;
|
|
80
|
+
if (!uniqueErrors.has(key)) {
|
|
81
|
+
uniqueErrors.set(key, error);
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
return Array.from(uniqueErrors.values());
|
|
85
|
+
};
|
|
76
86
|
|
|
77
87
|
const validateType = (value, validator) => {
|
|
78
88
|
const result = v__namespace.safeParse(validator, value);
|
|
@@ -165,14 +175,6 @@ var PresentationErrorType;
|
|
|
165
175
|
PresentationErrorType["Unknown"] = "Unknown";
|
|
166
176
|
})(PresentationErrorType || (PresentationErrorType = {}));
|
|
167
177
|
|
|
168
|
-
const PresentationSuccessResultValidator = v__namespace.object({
|
|
169
|
-
sessionId: v__namespace.string(),
|
|
170
|
-
challenge: v__namespace.string(),
|
|
171
|
-
credentialQuery: v__namespace.array(CredentialQueryValidator),
|
|
172
|
-
credentials: v__namespace.optional(v__namespace.array(v__namespace.any())),
|
|
173
|
-
credentialErrors: v__namespace.optional(v__namespace.array(v__namespace.any()))
|
|
174
|
-
});
|
|
175
|
-
|
|
176
178
|
const PresentationResultRelaxValidator = v__namespace.object({
|
|
177
179
|
sessionId: v__namespace.string(),
|
|
178
180
|
challenge: v__namespace.optional(v__namespace.string()),
|
|
@@ -182,18 +184,6 @@ const PresentationResultRelaxValidator = v__namespace.object({
|
|
|
182
184
|
error: v__namespace.optional(v__namespace.unknown())
|
|
183
185
|
});
|
|
184
186
|
|
|
185
|
-
const PresentationFailureResultValidator = v__namespace.object({
|
|
186
|
-
sessionId: v__namespace.string(),
|
|
187
|
-
challenge: v__namespace.string(),
|
|
188
|
-
credentialQuery: v__namespace.array(CredentialQueryValidator),
|
|
189
|
-
error: v__namespace.object({
|
|
190
|
-
type: v__namespace.picklist(Object.values(PresentationErrorType)),
|
|
191
|
-
message: v__namespace.string()
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const PresentationSessionResultValidator = v__namespace.union([ PresentationSuccessResultValidator, PresentationFailureResultValidator ]);
|
|
196
|
-
|
|
197
187
|
exports.Mode = void 0;
|
|
198
188
|
|
|
199
189
|
(function(Mode) {
|
|
@@ -627,7 +617,7 @@ const receiveMessageHandler = options => async event => {
|
|
|
627
617
|
return;
|
|
628
618
|
}
|
|
629
619
|
onComplete({
|
|
630
|
-
result:
|
|
620
|
+
result: "challenge" in result.value ? result.value : undefined,
|
|
631
621
|
sessionId: result.value.sessionId,
|
|
632
622
|
sessionCompletedInRedirect: false
|
|
633
623
|
});
|
|
@@ -770,7 +760,7 @@ const requestCredentialsWithDigitalCredentialsApi = async options => {
|
|
|
770
760
|
}
|
|
771
761
|
const verificationResult = credentialVerificationResult.value;
|
|
772
762
|
return neverthrow.ok({
|
|
773
|
-
result:
|
|
763
|
+
result: "challenge" in verificationResult ? verificationResult : undefined,
|
|
774
764
|
sessionId: sessionId
|
|
775
765
|
});
|
|
776
766
|
};
|