apacuana-sdk-core 0.5.0 → 0.6.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.
Files changed (55) hide show
  1. package/README.md +128 -55
  2. package/babel.config.cjs +11 -0
  3. package/coverage/clover.xml +179 -170
  4. package/coverage/coverage-final.json +8 -8
  5. package/coverage/lcov-report/api/index.html +131 -0
  6. package/coverage/lcov-report/api/signatures.js.html +1093 -0
  7. package/coverage/lcov-report/api/users.js.html +292 -0
  8. package/coverage/lcov-report/config/index.html +116 -0
  9. package/coverage/lcov-report/config/index.js.html +208 -0
  10. package/coverage/lcov-report/errors/index.html +116 -0
  11. package/coverage/lcov-report/errors/index.js.html +148 -0
  12. package/coverage/lcov-report/index.html +26 -26
  13. package/coverage/lcov-report/src/api/certs.js.html +65 -35
  14. package/coverage/lcov-report/src/api/index.html +27 -27
  15. package/coverage/lcov-report/src/api/revocations.js.html +21 -3
  16. package/coverage/lcov-report/src/api/signatures.js.html +123 -18
  17. package/coverage/lcov-report/src/api/users.js.html +24 -3
  18. package/coverage/lcov-report/src/config/index.html +1 -1
  19. package/coverage/lcov-report/src/config/index.js.html +1 -1
  20. package/coverage/lcov-report/src/errors/index.html +1 -1
  21. package/coverage/lcov-report/src/errors/index.js.html +8 -8
  22. package/coverage/lcov-report/src/index.html +1 -1
  23. package/coverage/lcov-report/src/index.js.html +9 -3
  24. package/coverage/lcov-report/src/utils/constant.js.html +3 -3
  25. package/coverage/lcov-report/src/utils/helpers.js.html +134 -32
  26. package/coverage/lcov-report/src/utils/httpClient.js.html +6 -72
  27. package/coverage/lcov-report/src/utils/index.html +20 -20
  28. package/coverage/lcov-report/utils/constant.js.html +145 -0
  29. package/coverage/lcov-report/utils/httpClient.js.html +646 -0
  30. package/coverage/lcov-report/utils/index.html +131 -0
  31. package/coverage/lcov.info +335 -298
  32. package/dist/api/certs.d.ts +17 -3
  33. package/dist/api/revocations.d.ts +17 -2
  34. package/dist/api/signatures.d.ts +18 -1
  35. package/dist/api/users.d.ts +22 -6
  36. package/dist/index.d.ts +4 -0
  37. package/dist/index.js +616 -242
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +616 -242
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/utils/helpers.d.ts +3 -1
  42. package/jest.config.cjs +6 -1
  43. package/package.json +12 -7
  44. package/rollup.config.js +1 -1
  45. package/src/api/certs.js +21 -11
  46. package/src/api/revocations.js +7 -1
  47. package/src/api/signatures.js +43 -8
  48. package/src/api/users.js +8 -1
  49. package/src/index.js +3 -1
  50. package/src/utils/constant.js +2 -2
  51. package/src/utils/helpers.js +56 -22
  52. package/src/utils/httpClient.js +0 -22
  53. package/tests/api/certs.test.js +30 -48
  54. package/tsconfig.json +2 -1
  55. package/.babelrc +0 -3
package/dist/index.mjs CHANGED
@@ -283,8 +283,8 @@ var VERIFICATION_STATUS = {
283
283
  APPROVED: 1
284
284
  };
285
285
  var INTEGRATION_TYPE = {
286
- ONBOARDING: 'onboarding',
287
- ONPREMISE: 'onpremise'
286
+ ONBOARDING: "ONBOARDING",
287
+ ONPREMISE: "ONPREMISE"
288
288
  };
289
289
 
290
290
  var config = {
@@ -396,9 +396,6 @@ var initHttpClient = function initHttpClient() {
396
396
  throw new ApacuanaAPIError("Error desconocido en la petici\xF3n: ".concat(error.message), 0, "UNKNOWN_REQUEST_ERROR");
397
397
  }
398
398
  });
399
-
400
- // eslint-disable-next-line no-console
401
- console.log("[HTTP Client] Cliente HTTP (Axios) REAL inicializado con URL base:", config.apiUrl);
402
399
  };
403
400
 
404
401
  /**
@@ -417,7 +414,6 @@ var setAuthToken = function setAuthToken(token) {
417
414
  // Actualizamos la cabecera Authorization de la instancia de Axios.
418
415
  axiosInstance.defaults.headers.common.Authorization = "Bearer ".concat(token);
419
416
  // eslint-disable-next-line no-console
420
- console.log("[HTTP Client] Cabecera Authorization actualizada con nuevo token.");
421
417
  };
422
418
 
423
419
  /**
@@ -451,12 +447,7 @@ var httpRequest = /*#__PURE__*/function () {
451
447
  case 1:
452
448
  // Creamos el cuerpo de la petición fusionando los datos de la llamada
453
449
  // con los parámetros de inicialización.
454
- dataToSend = _objectSpread2({}, data); // eslint-disable-next-line no-console
455
- console.log("[HTTP Client] Realizando petici\xF3n ".concat(method, " a: ").concat(axiosInstance.defaults.baseURL).concat(path));
456
- // eslint-disable-next-line no-console
457
- console.log("[HTTP Client] Headers (via Axios config):", axiosInstance.defaults.headers);
458
- // eslint-disable-next-line no-console
459
- console.log("[HTTP Client] Datos enviados:", dataToSend);
450
+ dataToSend = _objectSpread2({}, data);
460
451
  _context.p = 2;
461
452
  _t = method.toUpperCase();
462
453
  _context.n = _t === "GET" ? 3 : _t === "POST" ? 5 : _t === "PUT" ? 7 : _t === "DELETE" ? 9 : 11;
@@ -492,10 +483,6 @@ var httpRequest = /*#__PURE__*/function () {
492
483
  case 11:
493
484
  throw new ApacuanaAPIError("M\xE9todo HTTP no soportado: ".concat(method), 405, "UNSUPPORTED_HTTP_METHOD");
494
485
  case 12:
495
- // Si la promesa se resolvió, la respuesta es exitosa.
496
- // El interceptor ya manejó los errores 4xx/5xx y los errores lógicos 2xx.
497
- // eslint-disable-next-line no-console
498
- console.log("[HTTP Client] Respuesta exitosa de ".concat(path, ":"), response.data);
499
486
  return _context.a(2, response.data);
500
487
  case 13:
501
488
  _context.p = 13;
@@ -515,12 +502,19 @@ var httpRequest = /*#__PURE__*/function () {
515
502
  };
516
503
  }();
517
504
 
505
+ /**
506
+ * @typedef {object} GetCustomerResponse
507
+ * @property {string} token - El token de sesión del usuario.
508
+ * @property {object} userData - Los datos del usuario obtenidos.
509
+ * @property {boolean} success - Indica si la operación fue exitosa.
510
+ */
511
+
518
512
  /**
519
513
  * Obtiene el token de un usuario a través de una petición POST.
520
514
  * Este método es útil para endpoints que requieren datos en el cuerpo de la petición
521
515
  * para buscar un usuario, como un ID de sesión o un token de acceso.
522
516
  *
523
- * @returns {Promise<{token: string, userData: object, success: boolean}>} Objeto con el token de sesión, los datos del usuario y un indicador de éxito.
517
+ * @returns {Promise<GetCustomerResponse>} Objeto con el token de sesión, los datos del usuario y un indicador de éxito.
524
518
  * @throws {Error} Si los parámetros de entrada son inválidos.
525
519
  * @throws {ApacuanaAPIError} Si ocurre un error en la API de Apacuana.
526
520
  */
@@ -577,10 +571,16 @@ var getCustomer = /*#__PURE__*/function () {
577
571
  };
578
572
  }();
579
573
 
574
+ /**
575
+ * @typedef {object} RequestRevocationResponse
576
+ * @property {string} revocationStatus - El estado de la solicitud de revocación (e.g., "pending").
577
+ * @property {string|number} requestId - El ID de la solicitud de revocación.
578
+ */
579
+
580
580
  /**
581
581
  * Simula la solicitud de revocación de un certificado.
582
582
  * @param {string} reasonCode - Código o descripción del motivo de la revocación.
583
- * @returns {Promise<object>} Objeto con el estado de la solicitud de revocación.
583
+ * @returns {Promise<RequestRevocationResponse>} Objeto con el estado de la solicitud de revocación.
584
584
  */
585
585
  var requestRevocation = /*#__PURE__*/function () {
586
586
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(reasonCode) {
@@ -636,18 +636,20 @@ function getDefaultExportFromCjs (x) {
636
636
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
637
637
  }
638
638
 
639
- var cryptoJs = {exports: {}};
639
+ var cryptoJs$1 = {exports: {}};
640
640
 
641
641
  function commonjsRequire(path) {
642
642
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
643
643
  }
644
644
 
645
- var core = {exports: {}};
645
+ var core$1 = {exports: {}};
646
+
647
+ var core = core$1.exports;
646
648
 
647
649
  var hasRequiredCore;
648
650
 
649
651
  function requireCore () {
650
- if (hasRequiredCore) return core.exports;
652
+ if (hasRequiredCore) return core$1.exports;
651
653
  hasRequiredCore = 1;
652
654
  (function (module, exports) {
653
655
  (function (root, factory) {
@@ -655,7 +657,7 @@ function requireCore () {
655
657
  // CommonJS
656
658
  module.exports = factory();
657
659
  }
658
- }(commonjsGlobal, function () {
660
+ }(core, function () {
659
661
 
660
662
  /*globals window, global, require*/
661
663
 
@@ -1449,16 +1451,18 @@ function requireCore () {
1449
1451
  return CryptoJS;
1450
1452
 
1451
1453
  }));
1452
- } (core));
1453
- return core.exports;
1454
+ } (core$1));
1455
+ return core$1.exports;
1454
1456
  }
1455
1457
 
1456
- var x64Core = {exports: {}};
1458
+ var x64Core$1 = {exports: {}};
1459
+
1460
+ var x64Core = x64Core$1.exports;
1457
1461
 
1458
1462
  var hasRequiredX64Core;
1459
1463
 
1460
1464
  function requireX64Core () {
1461
- if (hasRequiredX64Core) return x64Core.exports;
1465
+ if (hasRequiredX64Core) return x64Core$1.exports;
1462
1466
  hasRequiredX64Core = 1;
1463
1467
  (function (module, exports) {
1464
1468
  (function (root, factory) {
@@ -1466,7 +1470,7 @@ function requireX64Core () {
1466
1470
  // CommonJS
1467
1471
  module.exports = factory(requireCore());
1468
1472
  }
1469
- }(commonjsGlobal, function (CryptoJS) {
1473
+ }(x64Core, function (CryptoJS) {
1470
1474
 
1471
1475
  (function (undefined$1) {
1472
1476
  // Shortcuts
@@ -1757,16 +1761,18 @@ function requireX64Core () {
1757
1761
  return CryptoJS;
1758
1762
 
1759
1763
  }));
1760
- } (x64Core));
1761
- return x64Core.exports;
1764
+ } (x64Core$1));
1765
+ return x64Core$1.exports;
1762
1766
  }
1763
1767
 
1764
- var libTypedarrays = {exports: {}};
1768
+ var libTypedarrays$1 = {exports: {}};
1769
+
1770
+ var libTypedarrays = libTypedarrays$1.exports;
1765
1771
 
1766
1772
  var hasRequiredLibTypedarrays;
1767
1773
 
1768
1774
  function requireLibTypedarrays () {
1769
- if (hasRequiredLibTypedarrays) return libTypedarrays.exports;
1775
+ if (hasRequiredLibTypedarrays) return libTypedarrays$1.exports;
1770
1776
  hasRequiredLibTypedarrays = 1;
1771
1777
  (function (module, exports) {
1772
1778
  (function (root, factory) {
@@ -1774,7 +1780,7 @@ function requireLibTypedarrays () {
1774
1780
  // CommonJS
1775
1781
  module.exports = factory(requireCore());
1776
1782
  }
1777
- }(commonjsGlobal, function (CryptoJS) {
1783
+ }(libTypedarrays, function (CryptoJS) {
1778
1784
 
1779
1785
  (function () {
1780
1786
  // Check if typed arrays are supported
@@ -1837,16 +1843,18 @@ function requireLibTypedarrays () {
1837
1843
  return CryptoJS.lib.WordArray;
1838
1844
 
1839
1845
  }));
1840
- } (libTypedarrays));
1841
- return libTypedarrays.exports;
1846
+ } (libTypedarrays$1));
1847
+ return libTypedarrays$1.exports;
1842
1848
  }
1843
1849
 
1844
- var encUtf16 = {exports: {}};
1850
+ var encUtf16$1 = {exports: {}};
1851
+
1852
+ var encUtf16 = encUtf16$1.exports;
1845
1853
 
1846
1854
  var hasRequiredEncUtf16;
1847
1855
 
1848
1856
  function requireEncUtf16 () {
1849
- if (hasRequiredEncUtf16) return encUtf16.exports;
1857
+ if (hasRequiredEncUtf16) return encUtf16$1.exports;
1850
1858
  hasRequiredEncUtf16 = 1;
1851
1859
  (function (module, exports) {
1852
1860
  (function (root, factory) {
@@ -1854,7 +1862,7 @@ function requireEncUtf16 () {
1854
1862
  // CommonJS
1855
1863
  module.exports = factory(requireCore());
1856
1864
  }
1857
- }(commonjsGlobal, function (CryptoJS) {
1865
+ }(encUtf16, function (CryptoJS) {
1858
1866
 
1859
1867
  (function () {
1860
1868
  // Shortcuts
@@ -1990,16 +1998,18 @@ function requireEncUtf16 () {
1990
1998
  return CryptoJS.enc.Utf16;
1991
1999
 
1992
2000
  }));
1993
- } (encUtf16));
1994
- return encUtf16.exports;
2001
+ } (encUtf16$1));
2002
+ return encUtf16$1.exports;
1995
2003
  }
1996
2004
 
1997
- var encBase64 = {exports: {}};
2005
+ var encBase64$1 = {exports: {}};
2006
+
2007
+ var encBase64 = encBase64$1.exports;
1998
2008
 
1999
2009
  var hasRequiredEncBase64;
2000
2010
 
2001
2011
  function requireEncBase64 () {
2002
- if (hasRequiredEncBase64) return encBase64.exports;
2012
+ if (hasRequiredEncBase64) return encBase64$1.exports;
2003
2013
  hasRequiredEncBase64 = 1;
2004
2014
  (function (module, exports) {
2005
2015
  (function (root, factory) {
@@ -2007,7 +2017,7 @@ function requireEncBase64 () {
2007
2017
  // CommonJS
2008
2018
  module.exports = factory(requireCore());
2009
2019
  }
2010
- }(commonjsGlobal, function (CryptoJS) {
2020
+ }(encBase64, function (CryptoJS) {
2011
2021
 
2012
2022
  (function () {
2013
2023
  // Shortcuts
@@ -2130,16 +2140,18 @@ function requireEncBase64 () {
2130
2140
  return CryptoJS.enc.Base64;
2131
2141
 
2132
2142
  }));
2133
- } (encBase64));
2134
- return encBase64.exports;
2143
+ } (encBase64$1));
2144
+ return encBase64$1.exports;
2135
2145
  }
2136
2146
 
2137
- var encBase64url = {exports: {}};
2147
+ var encBase64url$1 = {exports: {}};
2148
+
2149
+ var encBase64url = encBase64url$1.exports;
2138
2150
 
2139
2151
  var hasRequiredEncBase64url;
2140
2152
 
2141
2153
  function requireEncBase64url () {
2142
- if (hasRequiredEncBase64url) return encBase64url.exports;
2154
+ if (hasRequiredEncBase64url) return encBase64url$1.exports;
2143
2155
  hasRequiredEncBase64url = 1;
2144
2156
  (function (module, exports) {
2145
2157
  (function (root, factory) {
@@ -2147,7 +2159,7 @@ function requireEncBase64url () {
2147
2159
  // CommonJS
2148
2160
  module.exports = factory(requireCore());
2149
2161
  }
2150
- }(commonjsGlobal, function (CryptoJS) {
2162
+ }(encBase64url, function (CryptoJS) {
2151
2163
 
2152
2164
  (function () {
2153
2165
  // Shortcuts
@@ -2282,16 +2294,18 @@ function requireEncBase64url () {
2282
2294
  return CryptoJS.enc.Base64url;
2283
2295
 
2284
2296
  }));
2285
- } (encBase64url));
2286
- return encBase64url.exports;
2297
+ } (encBase64url$1));
2298
+ return encBase64url$1.exports;
2287
2299
  }
2288
2300
 
2289
- var md5 = {exports: {}};
2301
+ var md5$1 = {exports: {}};
2302
+
2303
+ var md5 = md5$1.exports;
2290
2304
 
2291
2305
  var hasRequiredMd5;
2292
2306
 
2293
2307
  function requireMd5 () {
2294
- if (hasRequiredMd5) return md5.exports;
2308
+ if (hasRequiredMd5) return md5$1.exports;
2295
2309
  hasRequiredMd5 = 1;
2296
2310
  (function (module, exports) {
2297
2311
  (function (root, factory) {
@@ -2299,7 +2313,7 @@ function requireMd5 () {
2299
2313
  // CommonJS
2300
2314
  module.exports = factory(requireCore());
2301
2315
  }
2302
- }(commonjsGlobal, function (CryptoJS) {
2316
+ }(md5, function (CryptoJS) {
2303
2317
 
2304
2318
  (function (Math) {
2305
2319
  // Shortcuts
@@ -2554,16 +2568,18 @@ function requireMd5 () {
2554
2568
  return CryptoJS.MD5;
2555
2569
 
2556
2570
  }));
2557
- } (md5));
2558
- return md5.exports;
2571
+ } (md5$1));
2572
+ return md5$1.exports;
2559
2573
  }
2560
2574
 
2561
- var sha1$2 = {exports: {}};
2575
+ var sha1$3 = {exports: {}};
2576
+
2577
+ var sha1$2 = sha1$3.exports;
2562
2578
 
2563
2579
  var hasRequiredSha1;
2564
2580
 
2565
2581
  function requireSha1 () {
2566
- if (hasRequiredSha1) return sha1$2.exports;
2582
+ if (hasRequiredSha1) return sha1$3.exports;
2567
2583
  hasRequiredSha1 = 1;
2568
2584
  (function (module, exports) {
2569
2585
  (function (root, factory) {
@@ -2571,7 +2587,7 @@ function requireSha1 () {
2571
2587
  // CommonJS
2572
2588
  module.exports = factory(requireCore());
2573
2589
  }
2574
- }(commonjsGlobal, function (CryptoJS) {
2590
+ }(sha1$2, function (CryptoJS) {
2575
2591
 
2576
2592
  (function () {
2577
2593
  // Shortcuts
@@ -2708,16 +2724,18 @@ function requireSha1 () {
2708
2724
  return CryptoJS.SHA1;
2709
2725
 
2710
2726
  }));
2711
- } (sha1$2));
2712
- return sha1$2.exports;
2727
+ } (sha1$3));
2728
+ return sha1$3.exports;
2713
2729
  }
2714
2730
 
2715
- var sha256$2 = {exports: {}};
2731
+ var sha256$3 = {exports: {}};
2732
+
2733
+ var sha256$2 = sha256$3.exports;
2716
2734
 
2717
2735
  var hasRequiredSha256;
2718
2736
 
2719
2737
  function requireSha256 () {
2720
- if (hasRequiredSha256) return sha256$2.exports;
2738
+ if (hasRequiredSha256) return sha256$3.exports;
2721
2739
  hasRequiredSha256 = 1;
2722
2740
  (function (module, exports) {
2723
2741
  (function (root, factory) {
@@ -2725,7 +2743,7 @@ function requireSha256 () {
2725
2743
  // CommonJS
2726
2744
  module.exports = factory(requireCore());
2727
2745
  }
2728
- }(commonjsGlobal, function (CryptoJS) {
2746
+ }(sha256$2, function (CryptoJS) {
2729
2747
 
2730
2748
  (function (Math) {
2731
2749
  // Shortcuts
@@ -2911,16 +2929,18 @@ function requireSha256 () {
2911
2929
  return CryptoJS.SHA256;
2912
2930
 
2913
2931
  }));
2914
- } (sha256$2));
2915
- return sha256$2.exports;
2932
+ } (sha256$3));
2933
+ return sha256$3.exports;
2916
2934
  }
2917
2935
 
2918
- var sha224 = {exports: {}};
2936
+ var sha224$1 = {exports: {}};
2937
+
2938
+ var sha224 = sha224$1.exports;
2919
2939
 
2920
2940
  var hasRequiredSha224;
2921
2941
 
2922
2942
  function requireSha224 () {
2923
- if (hasRequiredSha224) return sha224.exports;
2943
+ if (hasRequiredSha224) return sha224$1.exports;
2924
2944
  hasRequiredSha224 = 1;
2925
2945
  (function (module, exports) {
2926
2946
  (function (root, factory, undef) {
@@ -2928,7 +2948,7 @@ function requireSha224 () {
2928
2948
  // CommonJS
2929
2949
  module.exports = factory(requireCore(), requireSha256());
2930
2950
  }
2931
- }(commonjsGlobal, function (CryptoJS) {
2951
+ }(sha224, function (CryptoJS) {
2932
2952
 
2933
2953
  (function () {
2934
2954
  // Shortcuts
@@ -2995,16 +3015,18 @@ function requireSha224 () {
2995
3015
  return CryptoJS.SHA224;
2996
3016
 
2997
3017
  }));
2998
- } (sha224));
2999
- return sha224.exports;
3018
+ } (sha224$1));
3019
+ return sha224$1.exports;
3000
3020
  }
3001
3021
 
3002
- var sha512$2 = {exports: {}};
3022
+ var sha512$3 = {exports: {}};
3023
+
3024
+ var sha512$2 = sha512$3.exports;
3003
3025
 
3004
3026
  var hasRequiredSha512;
3005
3027
 
3006
3028
  function requireSha512 () {
3007
- if (hasRequiredSha512) return sha512$2.exports;
3029
+ if (hasRequiredSha512) return sha512$3.exports;
3008
3030
  hasRequiredSha512 = 1;
3009
3031
  (function (module, exports) {
3010
3032
  (function (root, factory, undef) {
@@ -3012,7 +3034,7 @@ function requireSha512 () {
3012
3034
  // CommonJS
3013
3035
  module.exports = factory(requireCore(), requireX64Core());
3014
3036
  }
3015
- }(commonjsGlobal, function (CryptoJS) {
3037
+ }(sha512$2, function (CryptoJS) {
3016
3038
 
3017
3039
  (function () {
3018
3040
  // Shortcuts
@@ -3325,16 +3347,18 @@ function requireSha512 () {
3325
3347
  return CryptoJS.SHA512;
3326
3348
 
3327
3349
  }));
3328
- } (sha512$2));
3329
- return sha512$2.exports;
3350
+ } (sha512$3));
3351
+ return sha512$3.exports;
3330
3352
  }
3331
3353
 
3332
- var sha384$2 = {exports: {}};
3354
+ var sha384$3 = {exports: {}};
3355
+
3356
+ var sha384$2 = sha384$3.exports;
3333
3357
 
3334
3358
  var hasRequiredSha384;
3335
3359
 
3336
3360
  function requireSha384 () {
3337
- if (hasRequiredSha384) return sha384$2.exports;
3361
+ if (hasRequiredSha384) return sha384$3.exports;
3338
3362
  hasRequiredSha384 = 1;
3339
3363
  (function (module, exports) {
3340
3364
  (function (root, factory, undef) {
@@ -3342,7 +3366,7 @@ function requireSha384 () {
3342
3366
  // CommonJS
3343
3367
  module.exports = factory(requireCore(), requireX64Core(), requireSha512());
3344
3368
  }
3345
- }(commonjsGlobal, function (CryptoJS) {
3369
+ }(sha384$2, function (CryptoJS) {
3346
3370
 
3347
3371
  (function () {
3348
3372
  // Shortcuts
@@ -3412,16 +3436,18 @@ function requireSha384 () {
3412
3436
  return CryptoJS.SHA384;
3413
3437
 
3414
3438
  }));
3415
- } (sha384$2));
3416
- return sha384$2.exports;
3439
+ } (sha384$3));
3440
+ return sha384$3.exports;
3417
3441
  }
3418
3442
 
3419
- var sha3 = {exports: {}};
3443
+ var sha3$1 = {exports: {}};
3444
+
3445
+ var sha3 = sha3$1.exports;
3420
3446
 
3421
3447
  var hasRequiredSha3;
3422
3448
 
3423
3449
  function requireSha3 () {
3424
- if (hasRequiredSha3) return sha3.exports;
3450
+ if (hasRequiredSha3) return sha3$1.exports;
3425
3451
  hasRequiredSha3 = 1;
3426
3452
  (function (module, exports) {
3427
3453
  (function (root, factory, undef) {
@@ -3429,7 +3455,7 @@ function requireSha3 () {
3429
3455
  // CommonJS
3430
3456
  module.exports = factory(requireCore(), requireX64Core());
3431
3457
  }
3432
- }(commonjsGlobal, function (CryptoJS) {
3458
+ }(sha3, function (CryptoJS) {
3433
3459
 
3434
3460
  (function (Math) {
3435
3461
  // Shortcuts
@@ -3742,16 +3768,18 @@ function requireSha3 () {
3742
3768
  return CryptoJS.SHA3;
3743
3769
 
3744
3770
  }));
3745
- } (sha3));
3746
- return sha3.exports;
3771
+ } (sha3$1));
3772
+ return sha3$1.exports;
3747
3773
  }
3748
3774
 
3749
- var ripemd160 = {exports: {}};
3775
+ var ripemd160$1 = {exports: {}};
3776
+
3777
+ var ripemd160 = ripemd160$1.exports;
3750
3778
 
3751
3779
  var hasRequiredRipemd160;
3752
3780
 
3753
3781
  function requireRipemd160 () {
3754
- if (hasRequiredRipemd160) return ripemd160.exports;
3782
+ if (hasRequiredRipemd160) return ripemd160$1.exports;
3755
3783
  hasRequiredRipemd160 = 1;
3756
3784
  (function (module, exports) {
3757
3785
  (function (root, factory) {
@@ -3759,7 +3787,7 @@ function requireRipemd160 () {
3759
3787
  // CommonJS
3760
3788
  module.exports = factory(requireCore());
3761
3789
  }
3762
- }(commonjsGlobal, function (CryptoJS) {
3790
+ }(ripemd160, function (CryptoJS) {
3763
3791
 
3764
3792
  /** @preserve
3765
3793
  (c) 2012 by Cédric Mesnil. All rights reserved.
@@ -4013,16 +4041,18 @@ function requireRipemd160 () {
4013
4041
  return CryptoJS.RIPEMD160;
4014
4042
 
4015
4043
  }));
4016
- } (ripemd160));
4017
- return ripemd160.exports;
4044
+ } (ripemd160$1));
4045
+ return ripemd160$1.exports;
4018
4046
  }
4019
4047
 
4020
- var hmac = {exports: {}};
4048
+ var hmac$1 = {exports: {}};
4049
+
4050
+ var hmac = hmac$1.exports;
4021
4051
 
4022
4052
  var hasRequiredHmac;
4023
4053
 
4024
4054
  function requireHmac () {
4025
- if (hasRequiredHmac) return hmac.exports;
4055
+ if (hasRequiredHmac) return hmac$1.exports;
4026
4056
  hasRequiredHmac = 1;
4027
4057
  (function (module, exports) {
4028
4058
  (function (root, factory) {
@@ -4030,7 +4060,7 @@ function requireHmac () {
4030
4060
  // CommonJS
4031
4061
  module.exports = factory(requireCore());
4032
4062
  }
4033
- }(commonjsGlobal, function (CryptoJS) {
4063
+ }(hmac, function (CryptoJS) {
4034
4064
 
4035
4065
  (function () {
4036
4066
  // Shortcuts
@@ -4160,16 +4190,18 @@ function requireHmac () {
4160
4190
 
4161
4191
 
4162
4192
  }));
4163
- } (hmac));
4164
- return hmac.exports;
4193
+ } (hmac$1));
4194
+ return hmac$1.exports;
4165
4195
  }
4166
4196
 
4167
- var pbkdf2 = {exports: {}};
4197
+ var pbkdf2$1 = {exports: {}};
4198
+
4199
+ var pbkdf2 = pbkdf2$1.exports;
4168
4200
 
4169
4201
  var hasRequiredPbkdf2;
4170
4202
 
4171
4203
  function requirePbkdf2 () {
4172
- if (hasRequiredPbkdf2) return pbkdf2.exports;
4204
+ if (hasRequiredPbkdf2) return pbkdf2$1.exports;
4173
4205
  hasRequiredPbkdf2 = 1;
4174
4206
  (function (module, exports) {
4175
4207
  (function (root, factory, undef) {
@@ -4177,7 +4209,7 @@ function requirePbkdf2 () {
4177
4209
  // CommonJS
4178
4210
  module.exports = factory(requireCore(), requireSha256(), requireHmac());
4179
4211
  }
4180
- }(commonjsGlobal, function (CryptoJS) {
4212
+ }(pbkdf2, function (CryptoJS) {
4181
4213
 
4182
4214
  (function () {
4183
4215
  // Shortcuts
@@ -4309,16 +4341,18 @@ function requirePbkdf2 () {
4309
4341
  return CryptoJS.PBKDF2;
4310
4342
 
4311
4343
  }));
4312
- } (pbkdf2));
4313
- return pbkdf2.exports;
4344
+ } (pbkdf2$1));
4345
+ return pbkdf2$1.exports;
4314
4346
  }
4315
4347
 
4316
- var evpkdf = {exports: {}};
4348
+ var evpkdf$1 = {exports: {}};
4349
+
4350
+ var evpkdf = evpkdf$1.exports;
4317
4351
 
4318
4352
  var hasRequiredEvpkdf;
4319
4353
 
4320
4354
  function requireEvpkdf () {
4321
- if (hasRequiredEvpkdf) return evpkdf.exports;
4355
+ if (hasRequiredEvpkdf) return evpkdf$1.exports;
4322
4356
  hasRequiredEvpkdf = 1;
4323
4357
  (function (module, exports) {
4324
4358
  (function (root, factory, undef) {
@@ -4326,7 +4360,7 @@ function requireEvpkdf () {
4326
4360
  // CommonJS
4327
4361
  module.exports = factory(requireCore(), requireSha1(), requireHmac());
4328
4362
  }
4329
- }(commonjsGlobal, function (CryptoJS) {
4363
+ }(evpkdf, function (CryptoJS) {
4330
4364
 
4331
4365
  (function () {
4332
4366
  // Shortcuts
@@ -4447,16 +4481,18 @@ function requireEvpkdf () {
4447
4481
  return CryptoJS.EvpKDF;
4448
4482
 
4449
4483
  }));
4450
- } (evpkdf));
4451
- return evpkdf.exports;
4484
+ } (evpkdf$1));
4485
+ return evpkdf$1.exports;
4452
4486
  }
4453
4487
 
4454
- var cipherCore = {exports: {}};
4488
+ var cipherCore$1 = {exports: {}};
4489
+
4490
+ var cipherCore = cipherCore$1.exports;
4455
4491
 
4456
4492
  var hasRequiredCipherCore;
4457
4493
 
4458
4494
  function requireCipherCore () {
4459
- if (hasRequiredCipherCore) return cipherCore.exports;
4495
+ if (hasRequiredCipherCore) return cipherCore$1.exports;
4460
4496
  hasRequiredCipherCore = 1;
4461
4497
  (function (module, exports) {
4462
4498
  (function (root, factory, undef) {
@@ -4464,7 +4500,7 @@ function requireCipherCore () {
4464
4500
  // CommonJS
4465
4501
  module.exports = factory(requireCore(), requireEvpkdf());
4466
4502
  }
4467
- }(commonjsGlobal, function (CryptoJS) {
4503
+ }(cipherCore, function (CryptoJS) {
4468
4504
 
4469
4505
  /**
4470
4506
  * Cipher core components.
@@ -5346,16 +5382,18 @@ function requireCipherCore () {
5346
5382
 
5347
5383
 
5348
5384
  }));
5349
- } (cipherCore));
5350
- return cipherCore.exports;
5385
+ } (cipherCore$1));
5386
+ return cipherCore$1.exports;
5351
5387
  }
5352
5388
 
5353
- var modeCfb = {exports: {}};
5389
+ var modeCfb$1 = {exports: {}};
5390
+
5391
+ var modeCfb = modeCfb$1.exports;
5354
5392
 
5355
5393
  var hasRequiredModeCfb;
5356
5394
 
5357
5395
  function requireModeCfb () {
5358
- if (hasRequiredModeCfb) return modeCfb.exports;
5396
+ if (hasRequiredModeCfb) return modeCfb$1.exports;
5359
5397
  hasRequiredModeCfb = 1;
5360
5398
  (function (module, exports) {
5361
5399
  (function (root, factory, undef) {
@@ -5363,7 +5401,7 @@ function requireModeCfb () {
5363
5401
  // CommonJS
5364
5402
  module.exports = factory(requireCore(), requireCipherCore());
5365
5403
  }
5366
- }(commonjsGlobal, function (CryptoJS) {
5404
+ }(modeCfb, function (CryptoJS) {
5367
5405
 
5368
5406
  /**
5369
5407
  * Cipher Feedback block mode.
@@ -5430,16 +5468,18 @@ function requireModeCfb () {
5430
5468
  return CryptoJS.mode.CFB;
5431
5469
 
5432
5470
  }));
5433
- } (modeCfb));
5434
- return modeCfb.exports;
5471
+ } (modeCfb$1));
5472
+ return modeCfb$1.exports;
5435
5473
  }
5436
5474
 
5437
- var modeCtr = {exports: {}};
5475
+ var modeCtr$1 = {exports: {}};
5476
+
5477
+ var modeCtr = modeCtr$1.exports;
5438
5478
 
5439
5479
  var hasRequiredModeCtr;
5440
5480
 
5441
5481
  function requireModeCtr () {
5442
- if (hasRequiredModeCtr) return modeCtr.exports;
5482
+ if (hasRequiredModeCtr) return modeCtr$1.exports;
5443
5483
  hasRequiredModeCtr = 1;
5444
5484
  (function (module, exports) {
5445
5485
  (function (root, factory, undef) {
@@ -5447,7 +5487,7 @@ function requireModeCtr () {
5447
5487
  // CommonJS
5448
5488
  module.exports = factory(requireCore(), requireCipherCore());
5449
5489
  }
5450
- }(commonjsGlobal, function (CryptoJS) {
5490
+ }(modeCtr, function (CryptoJS) {
5451
5491
 
5452
5492
  /**
5453
5493
  * Counter block mode.
@@ -5492,16 +5532,18 @@ function requireModeCtr () {
5492
5532
  return CryptoJS.mode.CTR;
5493
5533
 
5494
5534
  }));
5495
- } (modeCtr));
5496
- return modeCtr.exports;
5535
+ } (modeCtr$1));
5536
+ return modeCtr$1.exports;
5497
5537
  }
5498
5538
 
5499
- var modeCtrGladman = {exports: {}};
5539
+ var modeCtrGladman$1 = {exports: {}};
5540
+
5541
+ var modeCtrGladman = modeCtrGladman$1.exports;
5500
5542
 
5501
5543
  var hasRequiredModeCtrGladman;
5502
5544
 
5503
5545
  function requireModeCtrGladman () {
5504
- if (hasRequiredModeCtrGladman) return modeCtrGladman.exports;
5546
+ if (hasRequiredModeCtrGladman) return modeCtrGladman$1.exports;
5505
5547
  hasRequiredModeCtrGladman = 1;
5506
5548
  (function (module, exports) {
5507
5549
  (function (root, factory, undef) {
@@ -5509,7 +5551,7 @@ function requireModeCtrGladman () {
5509
5551
  // CommonJS
5510
5552
  module.exports = factory(requireCore(), requireCipherCore());
5511
5553
  }
5512
- }(commonjsGlobal, function (CryptoJS) {
5554
+ }(modeCtrGladman, function (CryptoJS) {
5513
5555
 
5514
5556
  /** @preserve
5515
5557
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
@@ -5612,16 +5654,18 @@ function requireModeCtrGladman () {
5612
5654
  return CryptoJS.mode.CTRGladman;
5613
5655
 
5614
5656
  }));
5615
- } (modeCtrGladman));
5616
- return modeCtrGladman.exports;
5657
+ } (modeCtrGladman$1));
5658
+ return modeCtrGladman$1.exports;
5617
5659
  }
5618
5660
 
5619
- var modeOfb = {exports: {}};
5661
+ var modeOfb$1 = {exports: {}};
5662
+
5663
+ var modeOfb = modeOfb$1.exports;
5620
5664
 
5621
5665
  var hasRequiredModeOfb;
5622
5666
 
5623
5667
  function requireModeOfb () {
5624
- if (hasRequiredModeOfb) return modeOfb.exports;
5668
+ if (hasRequiredModeOfb) return modeOfb$1.exports;
5625
5669
  hasRequiredModeOfb = 1;
5626
5670
  (function (module, exports) {
5627
5671
  (function (root, factory, undef) {
@@ -5629,7 +5673,7 @@ function requireModeOfb () {
5629
5673
  // CommonJS
5630
5674
  module.exports = factory(requireCore(), requireCipherCore());
5631
5675
  }
5632
- }(commonjsGlobal, function (CryptoJS) {
5676
+ }(modeOfb, function (CryptoJS) {
5633
5677
 
5634
5678
  /**
5635
5679
  * Output Feedback block mode.
@@ -5670,16 +5714,18 @@ function requireModeOfb () {
5670
5714
  return CryptoJS.mode.OFB;
5671
5715
 
5672
5716
  }));
5673
- } (modeOfb));
5674
- return modeOfb.exports;
5717
+ } (modeOfb$1));
5718
+ return modeOfb$1.exports;
5675
5719
  }
5676
5720
 
5677
- var modeEcb = {exports: {}};
5721
+ var modeEcb$1 = {exports: {}};
5722
+
5723
+ var modeEcb = modeEcb$1.exports;
5678
5724
 
5679
5725
  var hasRequiredModeEcb;
5680
5726
 
5681
5727
  function requireModeEcb () {
5682
- if (hasRequiredModeEcb) return modeEcb.exports;
5728
+ if (hasRequiredModeEcb) return modeEcb$1.exports;
5683
5729
  hasRequiredModeEcb = 1;
5684
5730
  (function (module, exports) {
5685
5731
  (function (root, factory, undef) {
@@ -5687,7 +5733,7 @@ function requireModeEcb () {
5687
5733
  // CommonJS
5688
5734
  module.exports = factory(requireCore(), requireCipherCore());
5689
5735
  }
5690
- }(commonjsGlobal, function (CryptoJS) {
5736
+ }(modeEcb, function (CryptoJS) {
5691
5737
 
5692
5738
  /**
5693
5739
  * Electronic Codebook block mode.
@@ -5714,16 +5760,18 @@ function requireModeEcb () {
5714
5760
  return CryptoJS.mode.ECB;
5715
5761
 
5716
5762
  }));
5717
- } (modeEcb));
5718
- return modeEcb.exports;
5763
+ } (modeEcb$1));
5764
+ return modeEcb$1.exports;
5719
5765
  }
5720
5766
 
5721
- var padAnsix923 = {exports: {}};
5767
+ var padAnsix923$1 = {exports: {}};
5768
+
5769
+ var padAnsix923 = padAnsix923$1.exports;
5722
5770
 
5723
5771
  var hasRequiredPadAnsix923;
5724
5772
 
5725
5773
  function requirePadAnsix923 () {
5726
- if (hasRequiredPadAnsix923) return padAnsix923.exports;
5774
+ if (hasRequiredPadAnsix923) return padAnsix923$1.exports;
5727
5775
  hasRequiredPadAnsix923 = 1;
5728
5776
  (function (module, exports) {
5729
5777
  (function (root, factory, undef) {
@@ -5731,7 +5779,7 @@ function requirePadAnsix923 () {
5731
5779
  // CommonJS
5732
5780
  module.exports = factory(requireCore(), requireCipherCore());
5733
5781
  }
5734
- }(commonjsGlobal, function (CryptoJS) {
5782
+ }(padAnsix923, function (CryptoJS) {
5735
5783
 
5736
5784
  /**
5737
5785
  * ANSI X.923 padding strategy.
@@ -5767,16 +5815,18 @@ function requirePadAnsix923 () {
5767
5815
  return CryptoJS.pad.Ansix923;
5768
5816
 
5769
5817
  }));
5770
- } (padAnsix923));
5771
- return padAnsix923.exports;
5818
+ } (padAnsix923$1));
5819
+ return padAnsix923$1.exports;
5772
5820
  }
5773
5821
 
5774
- var padIso10126 = {exports: {}};
5822
+ var padIso10126$1 = {exports: {}};
5823
+
5824
+ var padIso10126 = padIso10126$1.exports;
5775
5825
 
5776
5826
  var hasRequiredPadIso10126;
5777
5827
 
5778
5828
  function requirePadIso10126 () {
5779
- if (hasRequiredPadIso10126) return padIso10126.exports;
5829
+ if (hasRequiredPadIso10126) return padIso10126$1.exports;
5780
5830
  hasRequiredPadIso10126 = 1;
5781
5831
  (function (module, exports) {
5782
5832
  (function (root, factory, undef) {
@@ -5784,7 +5834,7 @@ function requirePadIso10126 () {
5784
5834
  // CommonJS
5785
5835
  module.exports = factory(requireCore(), requireCipherCore());
5786
5836
  }
5787
- }(commonjsGlobal, function (CryptoJS) {
5837
+ }(padIso10126, function (CryptoJS) {
5788
5838
 
5789
5839
  /**
5790
5840
  * ISO 10126 padding strategy.
@@ -5815,16 +5865,18 @@ function requirePadIso10126 () {
5815
5865
  return CryptoJS.pad.Iso10126;
5816
5866
 
5817
5867
  }));
5818
- } (padIso10126));
5819
- return padIso10126.exports;
5868
+ } (padIso10126$1));
5869
+ return padIso10126$1.exports;
5820
5870
  }
5821
5871
 
5822
- var padIso97971 = {exports: {}};
5872
+ var padIso97971$1 = {exports: {}};
5873
+
5874
+ var padIso97971 = padIso97971$1.exports;
5823
5875
 
5824
5876
  var hasRequiredPadIso97971;
5825
5877
 
5826
5878
  function requirePadIso97971 () {
5827
- if (hasRequiredPadIso97971) return padIso97971.exports;
5879
+ if (hasRequiredPadIso97971) return padIso97971$1.exports;
5828
5880
  hasRequiredPadIso97971 = 1;
5829
5881
  (function (module, exports) {
5830
5882
  (function (root, factory, undef) {
@@ -5832,7 +5884,7 @@ function requirePadIso97971 () {
5832
5884
  // CommonJS
5833
5885
  module.exports = factory(requireCore(), requireCipherCore());
5834
5886
  }
5835
- }(commonjsGlobal, function (CryptoJS) {
5887
+ }(padIso97971, function (CryptoJS) {
5836
5888
 
5837
5889
  /**
5838
5890
  * ISO/IEC 9797-1 Padding Method 2.
@@ -5859,16 +5911,18 @@ function requirePadIso97971 () {
5859
5911
  return CryptoJS.pad.Iso97971;
5860
5912
 
5861
5913
  }));
5862
- } (padIso97971));
5863
- return padIso97971.exports;
5914
+ } (padIso97971$1));
5915
+ return padIso97971$1.exports;
5864
5916
  }
5865
5917
 
5866
- var padZeropadding = {exports: {}};
5918
+ var padZeropadding$1 = {exports: {}};
5919
+
5920
+ var padZeropadding = padZeropadding$1.exports;
5867
5921
 
5868
5922
  var hasRequiredPadZeropadding;
5869
5923
 
5870
5924
  function requirePadZeropadding () {
5871
- if (hasRequiredPadZeropadding) return padZeropadding.exports;
5925
+ if (hasRequiredPadZeropadding) return padZeropadding$1.exports;
5872
5926
  hasRequiredPadZeropadding = 1;
5873
5927
  (function (module, exports) {
5874
5928
  (function (root, factory, undef) {
@@ -5876,7 +5930,7 @@ function requirePadZeropadding () {
5876
5930
  // CommonJS
5877
5931
  module.exports = factory(requireCore(), requireCipherCore());
5878
5932
  }
5879
- }(commonjsGlobal, function (CryptoJS) {
5933
+ }(padZeropadding, function (CryptoJS) {
5880
5934
 
5881
5935
  /**
5882
5936
  * Zero padding strategy.
@@ -5910,16 +5964,18 @@ function requirePadZeropadding () {
5910
5964
  return CryptoJS.pad.ZeroPadding;
5911
5965
 
5912
5966
  }));
5913
- } (padZeropadding));
5914
- return padZeropadding.exports;
5967
+ } (padZeropadding$1));
5968
+ return padZeropadding$1.exports;
5915
5969
  }
5916
5970
 
5917
- var padNopadding = {exports: {}};
5971
+ var padNopadding$1 = {exports: {}};
5972
+
5973
+ var padNopadding = padNopadding$1.exports;
5918
5974
 
5919
5975
  var hasRequiredPadNopadding;
5920
5976
 
5921
5977
  function requirePadNopadding () {
5922
- if (hasRequiredPadNopadding) return padNopadding.exports;
5978
+ if (hasRequiredPadNopadding) return padNopadding$1.exports;
5923
5979
  hasRequiredPadNopadding = 1;
5924
5980
  (function (module, exports) {
5925
5981
  (function (root, factory, undef) {
@@ -5927,7 +5983,7 @@ function requirePadNopadding () {
5927
5983
  // CommonJS
5928
5984
  module.exports = factory(requireCore(), requireCipherCore());
5929
5985
  }
5930
- }(commonjsGlobal, function (CryptoJS) {
5986
+ }(padNopadding, function (CryptoJS) {
5931
5987
 
5932
5988
  /**
5933
5989
  * A noop padding strategy.
@@ -5944,16 +6000,18 @@ function requirePadNopadding () {
5944
6000
  return CryptoJS.pad.NoPadding;
5945
6001
 
5946
6002
  }));
5947
- } (padNopadding));
5948
- return padNopadding.exports;
6003
+ } (padNopadding$1));
6004
+ return padNopadding$1.exports;
5949
6005
  }
5950
6006
 
5951
- var formatHex = {exports: {}};
6007
+ var formatHex$1 = {exports: {}};
6008
+
6009
+ var formatHex = formatHex$1.exports;
5952
6010
 
5953
6011
  var hasRequiredFormatHex;
5954
6012
 
5955
6013
  function requireFormatHex () {
5956
- if (hasRequiredFormatHex) return formatHex.exports;
6014
+ if (hasRequiredFormatHex) return formatHex$1.exports;
5957
6015
  hasRequiredFormatHex = 1;
5958
6016
  (function (module, exports) {
5959
6017
  (function (root, factory, undef) {
@@ -5961,7 +6019,7 @@ function requireFormatHex () {
5961
6019
  // CommonJS
5962
6020
  module.exports = factory(requireCore(), requireCipherCore());
5963
6021
  }
5964
- }(commonjsGlobal, function (CryptoJS) {
6022
+ }(formatHex, function (CryptoJS) {
5965
6023
 
5966
6024
  (function (undefined$1) {
5967
6025
  // Shortcuts
@@ -6014,16 +6072,18 @@ function requireFormatHex () {
6014
6072
  return CryptoJS.format.Hex;
6015
6073
 
6016
6074
  }));
6017
- } (formatHex));
6018
- return formatHex.exports;
6075
+ } (formatHex$1));
6076
+ return formatHex$1.exports;
6019
6077
  }
6020
6078
 
6021
- var aes = {exports: {}};
6079
+ var aes$1 = {exports: {}};
6080
+
6081
+ var aes = aes$1.exports;
6022
6082
 
6023
6083
  var hasRequiredAes;
6024
6084
 
6025
6085
  function requireAes () {
6026
- if (hasRequiredAes) return aes.exports;
6086
+ if (hasRequiredAes) return aes$1.exports;
6027
6087
  hasRequiredAes = 1;
6028
6088
  (function (module, exports) {
6029
6089
  (function (root, factory, undef) {
@@ -6031,7 +6091,7 @@ function requireAes () {
6031
6091
  // CommonJS
6032
6092
  module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore());
6033
6093
  }
6034
- }(commonjsGlobal, function (CryptoJS) {
6094
+ }(aes, function (CryptoJS) {
6035
6095
 
6036
6096
  (function () {
6037
6097
  // Shortcuts
@@ -6252,16 +6312,18 @@ function requireAes () {
6252
6312
  return CryptoJS.AES;
6253
6313
 
6254
6314
  }));
6255
- } (aes));
6256
- return aes.exports;
6315
+ } (aes$1));
6316
+ return aes$1.exports;
6257
6317
  }
6258
6318
 
6259
- var tripledes = {exports: {}};
6319
+ var tripledes$1 = {exports: {}};
6320
+
6321
+ var tripledes = tripledes$1.exports;
6260
6322
 
6261
6323
  var hasRequiredTripledes;
6262
6324
 
6263
6325
  function requireTripledes () {
6264
- if (hasRequiredTripledes) return tripledes.exports;
6326
+ if (hasRequiredTripledes) return tripledes$1.exports;
6265
6327
  hasRequiredTripledes = 1;
6266
6328
  (function (module, exports) {
6267
6329
  (function (root, factory, undef) {
@@ -6269,7 +6331,7 @@ function requireTripledes () {
6269
6331
  // CommonJS
6270
6332
  module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore());
6271
6333
  }
6272
- }(commonjsGlobal, function (CryptoJS) {
6334
+ }(tripledes, function (CryptoJS) {
6273
6335
 
6274
6336
  (function () {
6275
6337
  // Shortcuts
@@ -7035,16 +7097,18 @@ function requireTripledes () {
7035
7097
  return CryptoJS.TripleDES;
7036
7098
 
7037
7099
  }));
7038
- } (tripledes));
7039
- return tripledes.exports;
7100
+ } (tripledes$1));
7101
+ return tripledes$1.exports;
7040
7102
  }
7041
7103
 
7042
- var rc4 = {exports: {}};
7104
+ var rc4$1 = {exports: {}};
7105
+
7106
+ var rc4 = rc4$1.exports;
7043
7107
 
7044
7108
  var hasRequiredRc4;
7045
7109
 
7046
7110
  function requireRc4 () {
7047
- if (hasRequiredRc4) return rc4.exports;
7111
+ if (hasRequiredRc4) return rc4$1.exports;
7048
7112
  hasRequiredRc4 = 1;
7049
7113
  (function (module, exports) {
7050
7114
  (function (root, factory, undef) {
@@ -7052,7 +7116,7 @@ function requireRc4 () {
7052
7116
  // CommonJS
7053
7117
  module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore());
7054
7118
  }
7055
- }(commonjsGlobal, function (CryptoJS) {
7119
+ }(rc4, function (CryptoJS) {
7056
7120
 
7057
7121
  (function () {
7058
7122
  // Shortcuts
@@ -7178,16 +7242,18 @@ function requireRc4 () {
7178
7242
  return CryptoJS.RC4;
7179
7243
 
7180
7244
  }));
7181
- } (rc4));
7182
- return rc4.exports;
7245
+ } (rc4$1));
7246
+ return rc4$1.exports;
7183
7247
  }
7184
7248
 
7185
- var rabbit = {exports: {}};
7249
+ var rabbit$1 = {exports: {}};
7250
+
7251
+ var rabbit = rabbit$1.exports;
7186
7252
 
7187
7253
  var hasRequiredRabbit;
7188
7254
 
7189
7255
  function requireRabbit () {
7190
- if (hasRequiredRabbit) return rabbit.exports;
7256
+ if (hasRequiredRabbit) return rabbit$1.exports;
7191
7257
  hasRequiredRabbit = 1;
7192
7258
  (function (module, exports) {
7193
7259
  (function (root, factory, undef) {
@@ -7195,7 +7261,7 @@ function requireRabbit () {
7195
7261
  // CommonJS
7196
7262
  module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore());
7197
7263
  }
7198
- }(commonjsGlobal, function (CryptoJS) {
7264
+ }(rabbit, function (CryptoJS) {
7199
7265
 
7200
7266
  (function () {
7201
7267
  // Shortcuts
@@ -7374,16 +7440,18 @@ function requireRabbit () {
7374
7440
  return CryptoJS.Rabbit;
7375
7441
 
7376
7442
  }));
7377
- } (rabbit));
7378
- return rabbit.exports;
7443
+ } (rabbit$1));
7444
+ return rabbit$1.exports;
7379
7445
  }
7380
7446
 
7381
- var rabbitLegacy = {exports: {}};
7447
+ var rabbitLegacy$1 = {exports: {}};
7448
+
7449
+ var rabbitLegacy = rabbitLegacy$1.exports;
7382
7450
 
7383
7451
  var hasRequiredRabbitLegacy;
7384
7452
 
7385
7453
  function requireRabbitLegacy () {
7386
- if (hasRequiredRabbitLegacy) return rabbitLegacy.exports;
7454
+ if (hasRequiredRabbitLegacy) return rabbitLegacy$1.exports;
7387
7455
  hasRequiredRabbitLegacy = 1;
7388
7456
  (function (module, exports) {
7389
7457
  (function (root, factory, undef) {
@@ -7391,7 +7459,7 @@ function requireRabbitLegacy () {
7391
7459
  // CommonJS
7392
7460
  module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore());
7393
7461
  }
7394
- }(commonjsGlobal, function (CryptoJS) {
7462
+ }(rabbitLegacy, function (CryptoJS) {
7395
7463
 
7396
7464
  (function () {
7397
7465
  // Shortcuts
@@ -7568,16 +7636,18 @@ function requireRabbitLegacy () {
7568
7636
  return CryptoJS.RabbitLegacy;
7569
7637
 
7570
7638
  }));
7571
- } (rabbitLegacy));
7572
- return rabbitLegacy.exports;
7639
+ } (rabbitLegacy$1));
7640
+ return rabbitLegacy$1.exports;
7573
7641
  }
7574
7642
 
7575
- var blowfish = {exports: {}};
7643
+ var blowfish$1 = {exports: {}};
7644
+
7645
+ var blowfish = blowfish$1.exports;
7576
7646
 
7577
7647
  var hasRequiredBlowfish;
7578
7648
 
7579
7649
  function requireBlowfish () {
7580
- if (hasRequiredBlowfish) return blowfish.exports;
7650
+ if (hasRequiredBlowfish) return blowfish$1.exports;
7581
7651
  hasRequiredBlowfish = 1;
7582
7652
  (function (module, exports) {
7583
7653
  (function (root, factory, undef) {
@@ -7585,7 +7655,7 @@ function requireBlowfish () {
7585
7655
  // CommonJS
7586
7656
  module.exports = factory(requireCore(), requireEncBase64(), requireMd5(), requireEvpkdf(), requireCipherCore());
7587
7657
  }
7588
- }(commonjsGlobal, function (CryptoJS) {
7658
+ }(blowfish, function (CryptoJS) {
7589
7659
 
7590
7660
  (function () {
7591
7661
  // Shortcuts
@@ -8043,24 +8113,33 @@ function requireBlowfish () {
8043
8113
  return CryptoJS.Blowfish;
8044
8114
 
8045
8115
  }));
8046
- } (blowfish));
8047
- return blowfish.exports;
8116
+ } (blowfish$1));
8117
+ return blowfish$1.exports;
8048
8118
  }
8049
8119
 
8050
- (function (module, exports) {
8120
+ var cryptoJs = cryptoJs$1.exports;
8121
+
8122
+ var hasRequiredCryptoJs;
8123
+
8124
+ function requireCryptoJs () {
8125
+ if (hasRequiredCryptoJs) return cryptoJs$1.exports;
8126
+ hasRequiredCryptoJs = 1;
8127
+ (function (module, exports) {
8051
8128
  (function (root, factory, undef) {
8052
- {
8053
- // CommonJS
8054
- module.exports = factory(requireCore(), requireX64Core(), requireLibTypedarrays(), requireEncUtf16(), requireEncBase64(), requireEncBase64url(), requireMd5(), requireSha1(), requireSha256(), requireSha224(), requireSha512(), requireSha384(), requireSha3(), requireRipemd160(), requireHmac(), requirePbkdf2(), requireEvpkdf(), requireCipherCore(), requireModeCfb(), requireModeCtr(), requireModeCtrGladman(), requireModeOfb(), requireModeEcb(), requirePadAnsix923(), requirePadIso10126(), requirePadIso97971(), requirePadZeropadding(), requirePadNopadding(), requireFormatHex(), requireAes(), requireTripledes(), requireRc4(), requireRabbit(), requireRabbitLegacy(), requireBlowfish());
8055
- }
8056
- }(commonjsGlobal, function (CryptoJS) {
8129
+ {
8130
+ // CommonJS
8131
+ module.exports = factory(requireCore(), requireX64Core(), requireLibTypedarrays(), requireEncUtf16(), requireEncBase64(), requireEncBase64url(), requireMd5(), requireSha1(), requireSha256(), requireSha224(), requireSha512(), requireSha384(), requireSha3(), requireRipemd160(), requireHmac(), requirePbkdf2(), requireEvpkdf(), requireCipherCore(), requireModeCfb(), requireModeCtr(), requireModeCtrGladman(), requireModeOfb(), requireModeEcb(), requirePadAnsix923(), requirePadIso10126(), requirePadIso97971(), requirePadZeropadding(), requirePadNopadding(), requireFormatHex(), requireAes(), requireTripledes(), requireRc4(), requireRabbit(), requireRabbitLegacy(), requireBlowfish());
8132
+ }
8133
+ }(cryptoJs, function (CryptoJS) {
8057
8134
 
8058
- return CryptoJS;
8135
+ return CryptoJS;
8059
8136
 
8060
- }));
8061
- } (cryptoJs));
8137
+ }));
8138
+ } (cryptoJs$1));
8139
+ return cryptoJs$1.exports;
8140
+ }
8062
8141
 
8063
- var cryptoJsExports = cryptoJs.exports;
8142
+ var cryptoJsExports = requireCryptoJs();
8064
8143
  var CryptoJS = /*@__PURE__*/getDefaultExportFromCjs(cryptoJsExports);
8065
8144
 
8066
8145
  /*!
@@ -32733,16 +32812,11 @@ var validateOnBoardingSignerData = function validateOnBoardingSignerData(signerD
32733
32812
  }
32734
32813
  });
32735
32814
  };
32736
- var validateCsr = function validateCsr(csr) {
32737
- var base64Regex = /^[A-Za-z0-9+/=]+$/;
32738
- if (!csr) {
32739
- throw new ApacuanaAPIError("La solicitud de firma de certificado (CSR) es requerida.", 400, "INVALID_PARAMETER");
32740
- }
32741
- if (typeof csr !== "string" || csr.trim() === "") {
32742
- throw new ApacuanaAPIError("El CSR debe ser una cadena de texto válida y no puede estar vacía.", 400, "INVALID_PARAMETER_FORMAT");
32743
- }
32744
- if (!base64Regex.test(csr)) {
32745
- throw new ApacuanaAPIError("El CSR debe estar codificado en formato base64 válido.", 400, "INVALID_PARAMETER_FORMAT");
32815
+ var validateCsr = function validateCsr(encryptedCSR) {
32816
+ if (!encryptedCSR || _typeof(encryptedCSR) !== "object" || !encryptedCSR.csr || typeof encryptedCSR.csr !== "string" || encryptedCSR.csr.trim() === "") {
32817
+ throw new ApacuanaAPIError('The "encryptedCSR" parameter is required and must be an object ' + 'with a non-empty "csr" string property.', 400,
32818
+ // Bad Request
32819
+ "INVALID_PARAMETER_FORMAT");
32746
32820
  }
32747
32821
  };
32748
32822
  var validateGetDocsData = function validateGetDocsData(data) {
@@ -32758,6 +32832,26 @@ var validateGetDigestData = function validateGetDigestData(signData) {
32758
32832
  throw new ApacuanaAPIError("Los parámetros 'cert' y 'signatureId' son requeridos y deben ser cadenas de texto.", 400, "INVALID_PARAMETER");
32759
32833
  }
32760
32834
  };
32835
+ var validateOnBoardingSignDocumentData = function validateOnBoardingSignDocumentData(signData) {
32836
+ if (!signData || _typeof(signData) !== "object") {
32837
+ throw new ApacuanaAPIError("Sign data is required and must be an object.", 400, "INVALID_PARAMETER");
32838
+ }
32839
+ var signature = signData.signature,
32840
+ cert = signData.cert,
32841
+ signedDigest = signData.signedDigest;
32842
+ if (!signature || _typeof(signature) !== "object" || !signature.id) {
32843
+ throw new ApacuanaAPIError("Signature object with an 'id' property is required.", 400, "INVALID_PARAMETER");
32844
+ }
32845
+ if (!Array.isArray(signature.positions)) {
32846
+ throw new ApacuanaAPIError("Signature 'positions' must be an array.", 400, "INVALID_PARAMETER");
32847
+ }
32848
+ if (!cert || typeof cert !== "string") {
32849
+ throw new ApacuanaAPIError("Certificate 'cert' is required and must be a string.", 400, "INVALID_PARAMETER");
32850
+ }
32851
+ if (!signedDigest || typeof signedDigest !== "string") {
32852
+ throw new ApacuanaAPIError("Signed digest 'signedDigest' is required and must be a string.", 400, "INVALID_PARAMETER");
32853
+ }
32854
+ };
32761
32855
  var helpers = {
32762
32856
  getCertificateStatus: getCertificateStatus,
32763
32857
  exportPrivateKey: exportPrivateKey,
@@ -32766,29 +32860,41 @@ var helpers = {
32766
32860
  validateOnBoardingSignerData: validateOnBoardingSignerData,
32767
32861
  validateCsr: validateCsr,
32768
32862
  validateGetDocsData: validateGetDocsData,
32769
- validateGetDigestData: validateGetDigestData
32863
+ validateGetDigestData: validateGetDigestData,
32864
+ validateOnBoardingSignDocumentData: validateOnBoardingSignDocumentData
32770
32865
  };
32771
32866
 
32867
+ /**
32868
+ * @typedef {object} GenerateCertResponse
32869
+ * @property {string} cert - El certificado generado en formato string.
32870
+ * @property {boolean} success - Indica si la operación fue exitosa.
32871
+ */
32872
+
32873
+ /**
32874
+ * @typedef {object} GetCertStatusResponse
32875
+ * @property {string} status - El estado actual del certificado del usuario.
32876
+ * @property {boolean} success - Indica si la operación fue exitosa.
32877
+ */
32878
+
32772
32879
  var generateCertOnBoarding = /*#__PURE__*/function () {
32773
32880
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
32774
- var csr,
32775
- encryptedCSR,
32881
+ var encryptedCSR,
32776
32882
  response,
32777
32883
  cert,
32884
+ certifiedid,
32778
32885
  _args = arguments,
32779
32886
  _t;
32780
32887
  return _regenerator().w(function (_context) {
32781
32888
  while (1) switch (_context.p = _context.n) {
32782
32889
  case 0:
32783
- csr = _args.length > 0 && _args[0] !== undefined ? _args[0] : undefined;
32890
+ encryptedCSR = _args.length > 0 && _args[0] !== undefined ? _args[0] : undefined;
32784
32891
  _context.p = 1;
32785
- encryptedCSR = helpers.encryptedCsr(csr);
32786
32892
  _context.n = 2;
32787
32893
  return httpRequest("services/api/register/certificate", encryptedCSR, "POST");
32788
32894
  case 2:
32789
32895
  response = _context.v;
32790
- cert = response.cert;
32791
- if (cert) {
32896
+ cert = response.cert, certifiedid = response.certifiedid;
32897
+ if (!(!cert || !certifiedid)) {
32792
32898
  _context.n = 3;
32793
32899
  break;
32794
32900
  }
@@ -32796,6 +32902,7 @@ var generateCertOnBoarding = /*#__PURE__*/function () {
32796
32902
  case 3:
32797
32903
  return _context.a(2, {
32798
32904
  cert: cert,
32905
+ certifiedid: certifiedid,
32799
32906
  success: true
32800
32907
  });
32801
32908
  case 4:
@@ -32836,27 +32943,27 @@ var generateCertOnPremise = /*#__PURE__*/function () {
32836
32943
  /**
32837
32944
  * Generates a digital certificate.
32838
32945
  * @param {string} [csr] - Certificate Signing Request (CSR).
32839
- * @returns {Promise<{cert: string, success: boolean}>} Object with the generated certificate and a success indicator.
32946
+ * @returns {Promise<GenerateCertResponse>} Object with the generated certificate and a success indicator.
32840
32947
  * @throws {ApacuanaAPIError} If the CSR is invalid, if the API response does not contain the certificate, or if the integration type is not supported.
32841
32948
  * @throws {Error} If certificate generation fails for another reason.
32842
32949
  */
32843
32950
  var generateCert = /*#__PURE__*/function () {
32844
32951
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
32845
- var csr,
32952
+ var encryptedCSR,
32846
32953
  _getConfig,
32847
32954
  integrationType,
32848
32955
  _args3 = arguments;
32849
32956
  return _regenerator().w(function (_context3) {
32850
32957
  while (1) switch (_context3.n) {
32851
32958
  case 0:
32852
- csr = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : undefined;
32959
+ encryptedCSR = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : undefined;
32853
32960
  _getConfig = getConfig(), integrationType = _getConfig.integrationType;
32854
- helpers.validateCsr(csr);
32961
+ helpers.validateCsr(encryptedCSR);
32855
32962
  if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
32856
32963
  _context3.n = 1;
32857
32964
  break;
32858
32965
  }
32859
- return _context3.a(2, generateCertOnBoarding(csr));
32966
+ return _context3.a(2, generateCertOnBoarding(encryptedCSR));
32860
32967
  case 1:
32861
32968
  if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
32862
32969
  _context3.n = 2;
@@ -32878,7 +32985,7 @@ var generateCert = /*#__PURE__*/function () {
32878
32985
  /**
32879
32986
  * Gets the user's certificate status.
32880
32987
  * @param {boolean} [isCertificateInDevice=false] - Indicates if the certificate is already on the device.
32881
- * @returns {{status: string, success: boolean}} Object with the certificate status and a success indicator.
32988
+ * @returns {GetCertStatusResponse} Object with the certificate status and a success indicator.
32882
32989
  */
32883
32990
  var getCertStatus = function getCertStatus() {
32884
32991
  var isCertificateInDevice = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
@@ -32890,9 +32997,196 @@ var getCertStatus = function getCertStatus() {
32890
32997
  };
32891
32998
  };
32892
32999
 
33000
+ // =================================================================
33001
+ // Type Definitions
33002
+ // =================================================================
33003
+
33004
+ /**
33005
+ * Define la estructura de un objeto Firmante.
33006
+ * @typedef {object} Signer
33007
+ * @property {string} name - Nombre completo del firmante.
33008
+ * @property {string} email - Correo electrónico del firmante.
33009
+ * @property {string} document - Documento de identidad del firmante.
33010
+ */
33011
+
33012
+ /**
33013
+ * Define la estructura de datos para añadir un firmante.
33014
+ * @typedef {object} SignerData
33015
+ * @property {string} docId - Identificador único del documento.
33016
+ * @property {Signer} signer - Objeto con la información del firmante.
33017
+ */
33018
+
33019
+ /**
33020
+ * Define la estructura de la respuesta al añadir un firmante.
33021
+ * @typedef {object} AddSignerResponse
33022
+ * @property {string} signer - Identificador de confirmación del firmante añadido.
33023
+ * @property {boolean} success - Indica si la operación fue exitosa.
33024
+ */
33025
+
33026
+ /**
33027
+ * Define la estructura de datos para obtener el digest de un documento.
33028
+ * @typedef {object} GetDigestData
33029
+ * @property {string} cert - Certificado del firmante en formato base64.
33030
+ * @property {string} signatureId - Identificador único del proceso de firma.
33031
+ */
33032
+
33033
+ /**
33034
+ * Define la estructura de la respuesta al obtener el digest.
33035
+ * @typedef {object} GetDigestResponse
33036
+ * @property {string} digest - El digest del documento que se va a firmar.
33037
+ * @property {boolean} success - Indica si la operación fue exitosa.
33038
+ */
33039
+
33040
+ /**
33041
+ * Define la estructura de los parámetros para obtener documentos.
33042
+ * @typedef {object} GetDocsParams
33043
+ * @property {number} page - Número de página para la paginación.
33044
+ * @property {number} size - Cantidad de registros por página.
33045
+ * @property {string} [status] - (Opcional) Estado para filtrar los documentos.
33046
+ */
33047
+
33048
+ /**
33049
+ * Define la estructura de la respuesta al obtener documentos.
33050
+ * @typedef {object} GetDocsResponse
33051
+ * @property {number} totalRecords - El número total de registros encontrados.
33052
+ * @property {Array<object>} records - Un arreglo con los registros de los documentos.
33053
+ * @property {boolean} success - Indica si la operación fue exitosa.
33054
+ */
33055
+
33056
+ /**
33057
+ * @typedef {object} SignDocumentData
33058
+ * @property {object} signature - Objeto con información de la firma.
33059
+ * @property {string} signature.id - ID de la firma.
33060
+ * @property {Array<object>} signature.positions - Posiciones de la firma.
33061
+ * @property {string} cert - Certificado en base64.
33062
+ * @property {string} signedDigest - Digest firmado.
33063
+ */
33064
+
33065
+ // =================================================================
33066
+ // Internal Functions
33067
+ // =================================================================
33068
+
33069
+ var signDocumentOnBoarding = /*#__PURE__*/function () {
33070
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(signData) {
33071
+ var signature, cert, signedDigest, signBody, response, _t;
33072
+ return _regenerator().w(function (_context) {
33073
+ while (1) switch (_context.p = _context.n) {
33074
+ case 0:
33075
+ helpers.validateOnBoardingSignDocumentData(signData);
33076
+ signature = signData.signature, cert = signData.cert, signedDigest = signData.signedDigest;
33077
+ _context.p = 1;
33078
+ signBody = {
33079
+ positions: JSON.stringify(signature.positions.map(function (p) {
33080
+ return {
33081
+ x: p.x,
33082
+ y: p.y,
33083
+ page: p.page,
33084
+ status: 1
33085
+ };
33086
+ })),
33087
+ publickey: cert,
33088
+ signeddigest: signedDigest
33089
+ };
33090
+ _context.n = 2;
33091
+ return httpRequest("services/api/documents/sign/".concat(signature.id), signBody, "PUT");
33092
+ case 2:
33093
+ response = _context.v;
33094
+ return _context.a(2, response);
33095
+ case 3:
33096
+ _context.p = 3;
33097
+ _t = _context.v;
33098
+ if (!(_t instanceof ApacuanaAPIError)) {
33099
+ _context.n = 4;
33100
+ break;
33101
+ }
33102
+ throw _t;
33103
+ case 4:
33104
+ throw new ApacuanaAPIError("Failed to sign document: ".concat(_t.message || "Unknown error"));
33105
+ case 5:
33106
+ return _context.a(2);
33107
+ }
33108
+ }, _callee, null, [[1, 3]]);
33109
+ }));
33110
+ return function signDocumentOnBoarding(_x) {
33111
+ return _ref.apply(this, arguments);
33112
+ };
33113
+ }();
33114
+ var signDocumentOnPremise = /*#__PURE__*/function () {
33115
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
33116
+ return _regenerator().w(function (_context2) {
33117
+ while (1) switch (_context2.n) {
33118
+ case 0:
33119
+ throw new ApacuanaAPIError("Document signing is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
33120
+ case 1:
33121
+ return _context2.a(2);
33122
+ }
33123
+ }, _callee2);
33124
+ }));
33125
+ return function signDocumentOnPremise() {
33126
+ return _ref2.apply(this, arguments);
33127
+ };
33128
+ }();
33129
+ var getDigestToSignOnBoarding = /*#__PURE__*/function () {
33130
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(signData) {
33131
+ var _response$data, response, digest, _t2;
33132
+ return _regenerator().w(function (_context3) {
33133
+ while (1) switch (_context3.p = _context3.n) {
33134
+ case 0:
33135
+ _context3.p = 0;
33136
+ _context3.n = 1;
33137
+ return httpRequest("services/api/documents/getdigest/".concat(signData.signatureId), {
33138
+ publickey: signData.cert
33139
+ }, "POST");
33140
+ case 1:
33141
+ response = _context3.v;
33142
+ digest = ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.digest) || response.digest;
33143
+ if (digest) {
33144
+ _context3.n = 2;
33145
+ break;
33146
+ }
33147
+ throw new ApacuanaAPIError("Signature generation failed: digest not found in the response.", 500, "API_RESPONSE_ERROR");
33148
+ case 2:
33149
+ return _context3.a(2, {
33150
+ digest: digest,
33151
+ success: true
33152
+ });
33153
+ case 3:
33154
+ _context3.p = 3;
33155
+ _t2 = _context3.v;
33156
+ if (!(_t2.name === "ApacuanaAPIError")) {
33157
+ _context3.n = 4;
33158
+ break;
33159
+ }
33160
+ throw _t2;
33161
+ case 4:
33162
+ throw new ApacuanaAPIError("Failed to sign document (on-boarding): ".concat(_t2.message));
33163
+ case 5:
33164
+ return _context3.a(2);
33165
+ }
33166
+ }, _callee3, null, [[0, 3]]);
33167
+ }));
33168
+ return function getDigestToSignOnBoarding(_x2) {
33169
+ return _ref3.apply(this, arguments);
33170
+ };
33171
+ }();
33172
+ var getDigestToSignOnPremise = /*#__PURE__*/function () {
33173
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
33174
+ return _regenerator().w(function (_context4) {
33175
+ while (1) switch (_context4.n) {
33176
+ case 0:
33177
+ throw new ApacuanaAPIError("Digest retrieval is not supported for integration type: ONPREMISE", 501, "NOT_IMPLEMENTED");
33178
+ case 1:
33179
+ return _context4.a(2);
33180
+ }
33181
+ }, _callee4);
33182
+ }));
33183
+ return function getDigestToSignOnPremise() {
33184
+ return _ref4.apply(this, arguments);
33185
+ };
33186
+ }();
32893
33187
  var addSignerOnBoarding = /*#__PURE__*/function () {
32894
33188
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(signerData) {
32895
- var _t2;
33189
+ var _t3;
32896
33190
  return _regenerator().w(function (_context5) {
32897
33191
  while (1) switch (_context5.p = _context5.n) {
32898
33192
  case 0:
@@ -32907,20 +33201,20 @@ var addSignerOnBoarding = /*#__PURE__*/function () {
32907
33201
  });
32908
33202
  case 3:
32909
33203
  _context5.p = 3;
32910
- _t2 = _context5.v;
32911
- if (!(_t2 instanceof ApacuanaAPIError)) {
33204
+ _t3 = _context5.v;
33205
+ if (!(_t3 instanceof ApacuanaAPIError)) {
32912
33206
  _context5.n = 4;
32913
33207
  break;
32914
33208
  }
32915
- throw _t2;
33209
+ throw _t3;
32916
33210
  case 4:
32917
- throw new Error("Failed to add signer in On-Boarding: ".concat(_t2.message));
33211
+ throw new Error("Failed to add signer in On-Boarding: ".concat(_t3.message));
32918
33212
  case 5:
32919
33213
  return _context5.a(2);
32920
33214
  }
32921
33215
  }, _callee5, null, [[1, 3]]);
32922
33216
  }));
32923
- return function addSignerOnBoarding(_x2) {
33217
+ return function addSignerOnBoarding(_x3) {
32924
33218
  return _ref5.apply(this, arguments);
32925
33219
  };
32926
33220
  }();
@@ -32956,7 +33250,7 @@ var getDocsOnPremise = /*#__PURE__*/function () {
32956
33250
  }();
32957
33251
  var getDocsOnBoarding = /*#__PURE__*/function () {
32958
33252
  var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(data) {
32959
- var _getConfig, customerId, params, apiUrl, response, _t3;
33253
+ var _getConfig, customerId, params, apiUrl, response, _t4;
32960
33254
  return _regenerator().w(function (_context8) {
32961
33255
  while (1) switch (_context8.p = _context8.n) {
32962
33256
  case 0:
@@ -32988,24 +33282,102 @@ var getDocsOnBoarding = /*#__PURE__*/function () {
32988
33282
  });
32989
33283
  case 3:
32990
33284
  _context8.p = 3;
32991
- _t3 = _context8.v;
32992
- if (!(_t3.name === "ApacuanaAPIError")) {
33285
+ _t4 = _context8.v;
33286
+ if (!(_t4.name === "ApacuanaAPIError")) {
32993
33287
  _context8.n = 4;
32994
33288
  break;
32995
33289
  }
32996
- throw _t3;
33290
+ throw _t4;
32997
33291
  case 4:
32998
- throw new ApacuanaAPIError("Failed to get document list (on-boarding): ".concat(_t3.message));
33292
+ throw new ApacuanaAPIError("Failed to get document list (on-boarding): ".concat(_t4.message));
32999
33293
  case 5:
33000
33294
  return _context8.a(2);
33001
33295
  }
33002
33296
  }, _callee8, null, [[1, 3]]);
33003
33297
  }));
33004
- return function getDocsOnBoarding(_x3) {
33298
+ return function getDocsOnBoarding(_x4) {
33005
33299
  return _ref8.apply(this, arguments);
33006
33300
  };
33007
33301
  }();
33008
33302
 
33303
+ // =================================================================
33304
+ // Exported Functions
33305
+ // =================================================================
33306
+
33307
+ /**
33308
+ * Firma un documento PDF con un certificado digital.
33309
+ * NOTA: Esta función no está implementada actualmente para ningún tipo de integración.
33310
+ * @param {SignDocumentData} signData - Datos necesarios para la firma.
33311
+ * @returns {Promise<object>}
33312
+ * @throws {ApacuanaAPIError} Arroja un error 'NOT_IMPLEMENTED' para cualquier tipo de integración.
33313
+ */
33314
+ var signDocument = /*#__PURE__*/function () {
33315
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(signData) {
33316
+ var _getConfig2, integrationType;
33317
+ return _regenerator().w(function (_context9) {
33318
+ while (1) switch (_context9.n) {
33319
+ case 0:
33320
+ _getConfig2 = getConfig(), integrationType = _getConfig2.integrationType;
33321
+ if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33322
+ _context9.n = 1;
33323
+ break;
33324
+ }
33325
+ return _context9.a(2, signDocumentOnBoarding(signData));
33326
+ case 1:
33327
+ if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33328
+ _context9.n = 2;
33329
+ break;
33330
+ }
33331
+ return _context9.a(2, signDocumentOnPremise());
33332
+ case 2:
33333
+ throw new ApacuanaAPIError("Unsupported integration type: ".concat(integrationType), 400, "UNSUPPORTED_INTEGRATION_TYPE");
33334
+ case 3:
33335
+ return _context9.a(2);
33336
+ }
33337
+ }, _callee9);
33338
+ }));
33339
+ return function signDocument(_x5) {
33340
+ return _ref9.apply(this, arguments);
33341
+ };
33342
+ }();
33343
+
33344
+ /**
33345
+ * Obtiene el digest de un documento para ser firmado.
33346
+ * @param {GetDigestData} signData - Datos requeridos para obtener el digest.
33347
+ * @returns {Promise<GetDigestResponse>} Una promesa que resuelve a un objeto con el digest del documento.
33348
+ * @throws {ApacuanaAPIError} Si los datos de entrada son inválidos, la llamada a la API falla, o el tipo de integración no es soportado.
33349
+ */
33350
+ var getDigest = /*#__PURE__*/function () {
33351
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(signData) {
33352
+ var _getConfig3, integrationType;
33353
+ return _regenerator().w(function (_context0) {
33354
+ while (1) switch (_context0.n) {
33355
+ case 0:
33356
+ helpers.validateGetDigestData(signData);
33357
+ _getConfig3 = getConfig(), integrationType = _getConfig3.integrationType;
33358
+ if (!(integrationType === INTEGRATION_TYPE.ONBOARDING)) {
33359
+ _context0.n = 1;
33360
+ break;
33361
+ }
33362
+ return _context0.a(2, getDigestToSignOnBoarding(signData));
33363
+ case 1:
33364
+ if (!(integrationType === INTEGRATION_TYPE.ONPREMISE)) {
33365
+ _context0.n = 2;
33366
+ break;
33367
+ }
33368
+ return _context0.a(2, getDigestToSignOnPremise());
33369
+ case 2:
33370
+ throw new ApacuanaAPIError("Document retrieval is not supported for an unknown integration type: ".concat(integrationType), 501, "NOT_IMPLEMENTED");
33371
+ case 3:
33372
+ return _context0.a(2);
33373
+ }
33374
+ }, _callee0);
33375
+ }));
33376
+ return function getDigest(_x6) {
33377
+ return _ref0.apply(this, arguments);
33378
+ };
33379
+ }();
33380
+
33009
33381
  /**
33010
33382
  * Añade un firmante a un documento.
33011
33383
  * @param {SignerData} signerData - Los datos del firmante que se va a añadir.
@@ -33043,7 +33415,7 @@ var addSigner = /*#__PURE__*/function () {
33043
33415
  }
33044
33416
  }, _callee1);
33045
33417
  }));
33046
- return function addSigner(_x5) {
33418
+ return function addSigner(_x7) {
33047
33419
  return _ref1.apply(this, arguments);
33048
33420
  };
33049
33421
  }();
@@ -33080,7 +33452,7 @@ var getDocs = /*#__PURE__*/function () {
33080
33452
  }
33081
33453
  }, _callee10);
33082
33454
  }));
33083
- return function getDocs(_x6) {
33455
+ return function getDocs(_x8) {
33084
33456
  return _ref10.apply(this, arguments);
33085
33457
  };
33086
33458
  }();
@@ -33159,7 +33531,9 @@ var apacuana = {
33159
33531
  getCustomer: getCustomer,
33160
33532
  addSigner: addSigner,
33161
33533
  getDocs: getDocs,
33162
- generateCert: generateCert
33534
+ generateCert: generateCert,
33535
+ signDocument: signDocument,
33536
+ getDigest: getDigest
33163
33537
  };
33164
33538
 
33165
33539
  export { apacuana as default };