@0xpolygonid/js-sdk 1.43.0 → 1.44.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.
@@ -8811,10 +8811,14 @@ var FetchHandler = class _FetchHandler extends AbstractMessageHandler {
8811
8811
  if (!issuanceMsg.body?.credential) {
8812
8812
  throw new Error("credential is missing in issuance response message");
8813
8813
  }
8814
- if (!(issuanceMsg.body.credential instanceof W3CCredential)) {
8815
- throw new Error("credential object is not properly unmarshaled");
8814
+ let credential = issuanceMsg.body.credential;
8815
+ if (!(credential instanceof W3CCredential)) {
8816
+ if (typeof credential !== "object" || credential === null) {
8817
+ throw new Error("credential object is not properly unmarshaled");
8818
+ }
8819
+ credential = W3CCredential.fromJSON(credential);
8816
8820
  }
8817
- await this.opts.credentialWallet.save(issuanceMsg.body.credential);
8821
+ await this.opts.credentialWallet.save(credential);
8818
8822
  return null;
8819
8823
  }
8820
8824
  /**
@@ -8829,7 +8833,6 @@ var FetchHandler = class _FetchHandler extends AbstractMessageHandler {
8829
8833
  if (!opts?.allowExpiredMessages) {
8830
8834
  verifyExpiresTime(issuanceMsg);
8831
8835
  }
8832
- issuanceMsg.body.credential = W3CCredential.fromJSON(issuanceMsg.body.credential);
8833
8836
  await this.handleIssuanceResponseMsg(issuanceMsg);
8834
8837
  return Uint8Array.from([]);
8835
8838
  }