arca-sdk 1.2.1 → 1.2.2

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/index.cjs CHANGED
@@ -291,6 +291,18 @@ var TicketManager = class {
291
291
 
292
292
  // src/utils/network.ts
293
293
  var import_https = __toESM(require("https"), 1);
294
+ var import_tls = __toESM(require("tls"), 1);
295
+ function checkArcaServerIdentity(hostname, cert) {
296
+ const error = import_tls.default.checkServerIdentity(hostname, cert);
297
+ if (error && hostname.endsWith("arca.gob.ar")) {
298
+ const fallbackHost = hostname.replace("arca.gob.ar", "afip.gov.ar");
299
+ const retryError = import_tls.default.checkServerIdentity(fallbackHost, cert);
300
+ if (!retryError) {
301
+ return void 0;
302
+ }
303
+ }
304
+ return error;
305
+ }
294
306
  async function callArcaApi(url, options) {
295
307
  const timeout = options.timeout || 15e3;
296
308
  const isNode = typeof process !== "undefined" && process.versions && process.versions.node;
@@ -306,7 +318,8 @@ async function callArcaApi(url, options) {
306
318
  minVersion: "TLSv1",
307
319
  // @ts-ignore - Propiedad específica para mitigar "dh key too small" en Node 18+
308
320
  minDHSize: 1024,
309
- rejectUnauthorized: true
321
+ rejectUnauthorized: true,
322
+ checkServerIdentity: checkArcaServerIdentity
310
323
  });
311
324
  const reqOptions = {
312
325
  method: options.method,