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

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.
@@ -501,7 +501,7 @@ const createSession = async ({credentialQuery: credentialQuery, challenge: chall
501
501
  walletProviderId: walletProviderId,
502
502
  dcApiSupported: dcApiSupported
503
503
  };
504
- const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions`, {
504
+ const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions`, {
505
505
  method: "POST",
506
506
  headers: {
507
507
  "Content-Type": "application/json"
@@ -522,7 +522,7 @@ const createSession = async ({credentialQuery: credentialQuery, challenge: chall
522
522
  };
523
523
 
524
524
  const abortSession = async ({apiBaseUrl: apiBaseUrl, sessionId: sessionId, sessionKey: sessionKey}) => {
525
- const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/abort`, {
525
+ const responseResult = await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/abort`, {
526
526
  method: "POST",
527
527
  headers: {
528
528
  "Content-Type": "application/json",
@@ -560,7 +560,7 @@ const exchangeSessionResult = async ({challenge: challenge, responseCode: respon
560
560
  challenge: challenge,
561
561
  responseCode: responseCode
562
562
  };
563
- const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/result`, {
563
+ const fetchResultFn = async () => await safeFetch(`${apiBaseUrl}/v2/presentations/web/sessions/${sessionId}/result`, {
564
564
  method: "POST",
565
565
  headers: {
566
566
  "Content-Type": "application/json"
@@ -814,8 +814,19 @@ const parseCredentialResponse = credentialResponse => {
814
814
  }
815
815
  });
816
816
  }
817
+ if (typeof credentialResponse === "object" && "toJSON" in credentialResponse && typeof credentialResponse.toJSON === "function") {
818
+ return neverthrow.ok(credentialResponse.toJSON());
819
+ }
817
820
  if (typeof credentialResponse === "object") {
818
- return neverthrow.ok(credentialResponse);
821
+ const entries = [];
822
+ for (const key in credentialResponse) {
823
+ const value = credentialResponse[key];
824
+ if (typeof value === "function" || value === undefined || value === null) {
825
+ continue;
826
+ }
827
+ entries.push([ key, value ]);
828
+ }
829
+ return neverthrow.ok(Object.fromEntries(entries));
819
830
  }
820
831
  if (typeof credentialResponse === "string") {
821
832
  try {
@@ -847,7 +858,7 @@ const verifyCredentialResponse = async options => {
847
858
  data: data,
848
859
  challenge: challenge
849
860
  };
850
- const credentialVerificationResult = await safeFetch(`${apiBaseUrl}/v2/presentations/sessions/${sessionId}/dc-api/response`, {
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",