@mattrglobal/verifier-sdk-web 2.0.3-unstable.9 → 2.1.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/lib/verifier-js-no-deps.cjs.js +28 -17
- package/dist/lib/verifier-js-no-deps.cjs.js.map +1 -1
- package/dist/lib/verifier-js.cjs.js +28 -17
- package/dist/lib/verifier-js.cjs.js.map +1 -1
- package/dist/typings/verifier/types/verifier-web-sdk.d.ts +1 -1
- package/dist/verifier-js.development.js +28 -17
- package/dist/verifier-js.development.js.map +1 -1
- package/dist/verifier-js.production.esm.js +3 -3
- package/dist/verifier-js.production.esm.js.map +1 -1
- package/dist/verifier-js.production.js +3 -3
- package/dist/verifier-js.production.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Do Not Translate or Localize
|
|
8
8
|
*
|
|
9
9
|
* Bundle of @mattrglobal/verifier-sdk-web
|
|
10
|
-
* Generated: 2025-
|
|
11
|
-
* Version: 2.0
|
|
10
|
+
* Generated: 2025-09-16
|
|
11
|
+
* Version: 2.1.0
|
|
12
12
|
* Dependencies:
|
|
13
13
|
*/
|
|
14
14
|
|
|
@@ -250,7 +250,7 @@ var LocalStorageKey;
|
|
|
250
250
|
|
|
251
251
|
const MATTR_SDK_VERSION_HEADER = "x-mattr-sdk-version";
|
|
252
252
|
|
|
253
|
-
const MATTR_SDK_VERSION_VALUE = "2.0
|
|
253
|
+
const MATTR_SDK_VERSION_VALUE = "2.1.0";
|
|
254
254
|
|
|
255
255
|
var MessageEventDataType;
|
|
256
256
|
|
|
@@ -493,15 +493,18 @@ const getHashParamValue = (hash, param) => {
|
|
|
493
493
|
};
|
|
494
494
|
|
|
495
495
|
const createSession = async ({credentialQuery: credentialQuery, challenge: challenge, redirectUri: redirectUri, apiBaseUrl: apiBaseUrl, walletProviderId: walletProviderId, dcApiSupported: dcApiSupported, applicationId: applicationId}) => {
|
|
496
|
+
const openid4vpConfiguration = !!walletProviderId || !!redirectUri ? {
|
|
497
|
+
redirectUri: redirectUri,
|
|
498
|
+
walletProviderId: walletProviderId
|
|
499
|
+
} : undefined;
|
|
496
500
|
const postData = {
|
|
497
501
|
credentialQuery: credentialQuery,
|
|
498
502
|
challenge: challenge,
|
|
499
503
|
applicationId: applicationId,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
dcApiSupported: dcApiSupported
|
|
504
|
+
dcApiSupported: dcApiSupported,
|
|
505
|
+
openid4vpConfiguration: openid4vpConfiguration
|
|
503
506
|
};
|
|
504
|
-
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions`, {
|
|
507
|
+
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions`, {
|
|
505
508
|
method: "POST",
|
|
506
509
|
headers: {
|
|
507
510
|
"Content-Type": "application/json"
|
|
@@ -522,7 +525,7 @@ const createSession = async ({credentialQuery: credentialQuery, challenge: chall
|
|
|
522
525
|
};
|
|
523
526
|
|
|
524
527
|
const abortSession = async ({apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey}) => {
|
|
525
|
-
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/abort`, {
|
|
528
|
+
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/abort`, {
|
|
526
529
|
method: "POST",
|
|
527
530
|
headers: {
|
|
528
531
|
"Content-Type": "application/json",
|
|
@@ -772,8 +775,7 @@ const requestCredentialsWithDigitalCredentialsApi = async options => {
|
|
|
772
775
|
sessionId: sessionId,
|
|
773
776
|
sessionKey: sessionKey,
|
|
774
777
|
challenge: challenge,
|
|
775
|
-
|
|
776
|
-
data: parsedCredentialResponse.data
|
|
778
|
+
response: parsedCredentialResponse
|
|
777
779
|
});
|
|
778
780
|
if (credentialVerificationResult.isErr()) {
|
|
779
781
|
return neverthrow.err({
|
|
@@ -814,8 +816,19 @@ const parseCredentialResponse = credentialResponse => {
|
|
|
814
816
|
}
|
|
815
817
|
});
|
|
816
818
|
}
|
|
819
|
+
if (typeof credentialResponse === "object" && "toJSON" in credentialResponse && typeof credentialResponse.toJSON === "function") {
|
|
820
|
+
return neverthrow.ok(credentialResponse.toJSON());
|
|
821
|
+
}
|
|
817
822
|
if (typeof credentialResponse === "object") {
|
|
818
|
-
|
|
823
|
+
const entries = [];
|
|
824
|
+
for (const key in credentialResponse) {
|
|
825
|
+
const value = credentialResponse[key];
|
|
826
|
+
if (typeof value === "function" || value === undefined || value === null) {
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
entries.push([ key, value ]);
|
|
830
|
+
}
|
|
831
|
+
return neverthrow.ok(Object.fromEntries(entries));
|
|
819
832
|
}
|
|
820
833
|
if (typeof credentialResponse === "string") {
|
|
821
834
|
try {
|
|
@@ -841,13 +854,11 @@ const parseCredentialResponse = credentialResponse => {
|
|
|
841
854
|
};
|
|
842
855
|
|
|
843
856
|
const verifyCredentialResponse = async options => {
|
|
844
|
-
const {apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey, challenge: challenge,
|
|
845
|
-
const requestBody = {
|
|
846
|
-
protocol: protocol,
|
|
847
|
-
data: data,
|
|
857
|
+
const {apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey, challenge: challenge, response: response} = options;
|
|
858
|
+
const requestBody = Object.assign(Object.assign({}, response), {
|
|
848
859
|
challenge: challenge
|
|
849
|
-
};
|
|
850
|
-
const credentialVerificationResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/dc-api/response`, {
|
|
860
|
+
});
|
|
861
|
+
const credentialVerificationResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/dc-api/response`, {
|
|
851
862
|
method: "POST",
|
|
852
863
|
headers: {
|
|
853
864
|
"Content-Type": "application/json",
|