@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.
@@ -9370,10 +9370,14 @@ var FetchHandler = class _FetchHandler extends AbstractMessageHandler {
9370
9370
  if (!issuanceMsg.body?.credential) {
9371
9371
  throw new Error("credential is missing in issuance response message");
9372
9372
  }
9373
- if (!(issuanceMsg.body.credential instanceof W3CCredential)) {
9374
- throw new Error("credential object is not properly unmarshaled");
9373
+ let credential = issuanceMsg.body.credential;
9374
+ if (!(credential instanceof W3CCredential)) {
9375
+ if (typeof credential !== "object" || credential === null) {
9376
+ throw new Error("credential object is not properly unmarshaled");
9377
+ }
9378
+ credential = W3CCredential.fromJSON(credential);
9375
9379
  }
9376
- await this.opts.credentialWallet.save(issuanceMsg.body.credential);
9380
+ await this.opts.credentialWallet.save(credential);
9377
9381
  return null;
9378
9382
  }
9379
9383
  /**
@@ -9388,7 +9392,6 @@ var FetchHandler = class _FetchHandler extends AbstractMessageHandler {
9388
9392
  if (!opts?.allowExpiredMessages) {
9389
9393
  verifyExpiresTime(issuanceMsg);
9390
9394
  }
9391
- issuanceMsg.body.credential = W3CCredential.fromJSON(issuanceMsg.body.credential);
9392
9395
  await this.handleIssuanceResponseMsg(issuanceMsg);
9393
9396
  return Uint8Array.from([]);
9394
9397
  }