@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
|
* neverthrow -- 4.3.0
|
|
@@ -1585,7 +1585,7 @@ var LocalStorageKey;
|
|
|
1585
1585
|
|
|
1586
1586
|
const MATTR_SDK_VERSION_HEADER = "x-mattr-sdk-version";
|
|
1587
1587
|
|
|
1588
|
-
const MATTR_SDK_VERSION_VALUE = "2.0
|
|
1588
|
+
const MATTR_SDK_VERSION_VALUE = "2.1.0";
|
|
1589
1589
|
|
|
1590
1590
|
var MessageEventDataType;
|
|
1591
1591
|
|
|
@@ -1859,15 +1859,18 @@ const getHashParamValue = (hash, param) => {
|
|
|
1859
1859
|
};
|
|
1860
1860
|
|
|
1861
1861
|
const createSession = async ({credentialQuery: credentialQuery, challenge: challenge, redirectUri: redirectUri, apiBaseUrl: apiBaseUrl, walletProviderId: walletProviderId, dcApiSupported: dcApiSupported, applicationId: applicationId}) => {
|
|
1862
|
+
const openid4vpConfiguration = !!walletProviderId || !!redirectUri ? {
|
|
1863
|
+
redirectUri: redirectUri,
|
|
1864
|
+
walletProviderId: walletProviderId
|
|
1865
|
+
} : undefined;
|
|
1862
1866
|
const postData = {
|
|
1863
1867
|
credentialQuery: credentialQuery,
|
|
1864
1868
|
challenge: challenge,
|
|
1865
1869
|
applicationId: applicationId,
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
dcApiSupported: dcApiSupported
|
|
1870
|
+
dcApiSupported: dcApiSupported,
|
|
1871
|
+
openid4vpConfiguration: openid4vpConfiguration
|
|
1869
1872
|
};
|
|
1870
|
-
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions`, {
|
|
1873
|
+
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions`, {
|
|
1871
1874
|
method: "POST",
|
|
1872
1875
|
headers: {
|
|
1873
1876
|
"Content-Type": "application/json"
|
|
@@ -1888,7 +1891,7 @@ const createSession = async ({credentialQuery: credentialQuery, challenge: chall
|
|
|
1888
1891
|
};
|
|
1889
1892
|
|
|
1890
1893
|
const abortSession = async ({apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey}) => {
|
|
1891
|
-
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/abort`, {
|
|
1894
|
+
const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/abort`, {
|
|
1892
1895
|
method: "POST",
|
|
1893
1896
|
headers: {
|
|
1894
1897
|
"Content-Type": "application/json",
|
|
@@ -2138,8 +2141,7 @@ const requestCredentialsWithDigitalCredentialsApi = async options => {
|
|
|
2138
2141
|
sessionId: sessionId,
|
|
2139
2142
|
sessionKey: sessionKey,
|
|
2140
2143
|
challenge: challenge,
|
|
2141
|
-
|
|
2142
|
-
data: parsedCredentialResponse.data
|
|
2144
|
+
response: parsedCredentialResponse
|
|
2143
2145
|
});
|
|
2144
2146
|
if (credentialVerificationResult.isErr()) {
|
|
2145
2147
|
return err({
|
|
@@ -2180,8 +2182,19 @@ const parseCredentialResponse = credentialResponse => {
|
|
|
2180
2182
|
}
|
|
2181
2183
|
});
|
|
2182
2184
|
}
|
|
2185
|
+
if (typeof credentialResponse === "object" && "toJSON" in credentialResponse && typeof credentialResponse.toJSON === "function") {
|
|
2186
|
+
return ok(credentialResponse.toJSON());
|
|
2187
|
+
}
|
|
2183
2188
|
if (typeof credentialResponse === "object") {
|
|
2184
|
-
|
|
2189
|
+
const entries = [];
|
|
2190
|
+
for (const key in credentialResponse) {
|
|
2191
|
+
const value = credentialResponse[key];
|
|
2192
|
+
if (typeof value === "function" || value === undefined || value === null) {
|
|
2193
|
+
continue;
|
|
2194
|
+
}
|
|
2195
|
+
entries.push([ key, value ]);
|
|
2196
|
+
}
|
|
2197
|
+
return ok(Object.fromEntries(entries));
|
|
2185
2198
|
}
|
|
2186
2199
|
if (typeof credentialResponse === "string") {
|
|
2187
2200
|
try {
|
|
@@ -2207,13 +2220,11 @@ const parseCredentialResponse = credentialResponse => {
|
|
|
2207
2220
|
};
|
|
2208
2221
|
|
|
2209
2222
|
const verifyCredentialResponse = async options => {
|
|
2210
|
-
const {apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey, challenge: challenge,
|
|
2211
|
-
const requestBody = {
|
|
2212
|
-
protocol: protocol,
|
|
2213
|
-
data: data,
|
|
2223
|
+
const {apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey, challenge: challenge, response: response} = options;
|
|
2224
|
+
const requestBody = Object.assign(Object.assign({}, response), {
|
|
2214
2225
|
challenge: challenge
|
|
2215
|
-
};
|
|
2216
|
-
const credentialVerificationResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/dc-api/response`, {
|
|
2226
|
+
});
|
|
2227
|
+
const credentialVerificationResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/dc-api/response`, {
|
|
2217
2228
|
method: "POST",
|
|
2218
2229
|
headers: {
|
|
2219
2230
|
"Content-Type": "application/json",
|