@mattrglobal/verifier-sdk-web 2.0.3-unstable.40 → 2.0.3-unstable.41

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.
@@ -1867,7 +1867,7 @@ const createSession = async ({credentialQuery: credentialQuery, challenge: chall
1867
1867
  walletProviderId: walletProviderId,
1868
1868
  dcApiSupported: dcApiSupported
1869
1869
  };
1870
- const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions`, {
1870
+ const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions`, {
1871
1871
  method: "POST",
1872
1872
  headers: {
1873
1873
  "Content-Type": "application/json"
@@ -1888,7 +1888,7 @@ const createSession = async ({credentialQuery: credentialQuery, challenge: chall
1888
1888
  };
1889
1889
 
1890
1890
  const abortSession = async ({apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey}) => {
1891
- const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/abort`, {
1891
+ const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/abort`, {
1892
1892
  method: "POST",
1893
1893
  headers: {
1894
1894
  "Content-Type": "application/json",
@@ -1926,7 +1926,7 @@ const exchangeSessionResult = async ({challenge: challenge, responseCode: respon
1926
1926
  challenge: challenge,
1927
1927
  responseCode: responseCode
1928
1928
  };
1929
- const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/result`, {
1929
+ const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/result`, {
1930
1930
  method: "POST",
1931
1931
  headers: {
1932
1932
  "Content-Type": "application/json"
@@ -2180,8 +2180,19 @@ const parseCredentialResponse = credentialResponse => {
2180
2180
  }
2181
2181
  });
2182
2182
  }
2183
+ if (typeof credentialResponse === "object" && "toJSON" in credentialResponse && typeof credentialResponse.toJSON === "function") {
2184
+ return ok(credentialResponse.toJSON());
2185
+ }
2183
2186
  if (typeof credentialResponse === "object") {
2184
- return ok(credentialResponse);
2187
+ const entries = [];
2188
+ for (const key in credentialResponse) {
2189
+ const value = credentialResponse[key];
2190
+ if (typeof value === "function" || value === undefined || value === null) {
2191
+ continue;
2192
+ }
2193
+ entries.push([ key, value ]);
2194
+ }
2195
+ return ok(Object.fromEntries(entries));
2185
2196
  }
2186
2197
  if (typeof credentialResponse === "string") {
2187
2198
  try {
@@ -2213,7 +2224,7 @@ const verifyCredentialResponse = async options => {
2213
2224
  data: data,
2214
2225
  challenge: challenge
2215
2226
  };
2216
- const credentialVerificationResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/dc-api/response`, {
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",