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