@it-enterprise/digital-signature 1.4.3 → 1.4.5

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.
@@ -163,9 +163,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
163
163
  }), n.d(t, "EndUserKeysType", function() {
164
164
  return K;
165
165
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_191", function() {
166
- return ie;
166
+ return re;
167
167
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_257", function() {
168
- return Y;
168
+ return ie;
169
169
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_307", function() {
170
170
  return X;
171
171
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_FILE", function() {
@@ -173,7 +173,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
173
173
  }), n.d(t, "EU_KEYS_LENGTH_DS_UA_CERT", function() {
174
174
  return Q;
175
175
  }), n.d(t, "EndUserKeysLengthDSUA", function() {
176
- return re;
176
+ return Y;
177
177
  }), n.d(t, "EU_KEYS_LENGTH_KEP_UA_257", function() {
178
178
  return ae;
179
179
  }), n.d(t, "EU_KEYS_LENGTH_KEP_UA_431", function() {
@@ -415,10 +415,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
415
415
  (function(e) {
416
416
  e[e.None = q] = "None", e[e.DSTUAndECDHWithGOST = J] = "DSTUAndECDHWithGOST", e[e.RSAWithSHA = ee] = "RSAWithSHA", e[e.ECDSAWithSHA = te] = "ECDSAWithSHA", e[e.DSTUAndECDHWithDSTU = ne] = "DSTUAndECDHWithDSTU";
417
417
  })(K ||= {});
418
- var re, ie = 1, Y = 2, X = 3, Z = 4, Q = 5;
418
+ var Y, re = 1, ie = 2, X = 3, Z = 4, Q = 5;
419
419
  (function(e) {
420
- e[e.EC_191 = ie] = "EC_191", e[e.EC_257 = Y] = "EC_257", e[e.EC_307 = X] = "EC_307", e[e.File = Z] = "File", e[e.Cert = Q] = "Cert";
421
- })(re ||= {});
420
+ e[e.EC_191 = re] = "EC_191", e[e.EC_257 = ie] = "EC_257", e[e.EC_307 = X] = "EC_307", e[e.File = Z] = "File", e[e.Cert = Q] = "Cert";
421
+ })(Y ||= {});
422
422
  var $, ae = 1, oe = 2, se = 3, ce = 4, le = 5;
423
423
  (function(e) {
424
424
  e[e.EC_257 = ae] = "EC_257", e[e.EC_431 = oe] = "EC_431", e[e.EC_571 = se] = "EC_571", e[e.File = Z] = "File", e[e.Cert = Q] = "Cert";
@@ -2962,22 +2962,22 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
2962
2962
  }, ne.prototype.GetOwnerInfo = function() {
2963
2963
  return this.ownerInfo;
2964
2964
  };
2965
- var re = function(e, t) {
2965
+ var Y = function(e, t) {
2966
2966
  this.setClassInfo("EndUserReference", 1), this.fields = {
2967
2967
  name: "string",
2968
2968
  data: "byteArray"
2969
2969
  }, this.initializeFields(), this.name = e, this.data = t;
2970
2970
  };
2971
- h.makeTransferable(re), re.prototype.GetName = function() {
2971
+ h.makeTransferable(Y), Y.prototype.GetName = function() {
2972
2972
  return this.name;
2973
- }, re.prototype.SetName = function(e) {
2973
+ }, Y.prototype.SetName = function(e) {
2974
2974
  this.name = e;
2975
- }, re.prototype.GetData = function() {
2975
+ }, Y.prototype.GetData = function() {
2976
2976
  return this.data;
2977
- }, re.prototype.SetData = function(e) {
2977
+ }, Y.prototype.SetData = function(e) {
2978
2978
  this.data = e;
2979
2979
  };
2980
- var ie = function(e, t, n, r, i) {
2980
+ var re = function(e, t, n, r, i) {
2981
2981
  this.setClassInfo("EndUserSSSignHashResult", 1), this.fields = {
2982
2982
  error: "number",
2983
2983
  hash: "string",
@@ -2986,33 +2986,33 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
2986
2986
  status: "string"
2987
2987
  }, this.initializeFields(), this.error = e, this.hash = t, this.signature = n, this.statusCode = r, this.status = i;
2988
2988
  };
2989
- h.makeTransferable(ie), ie.prototype.GetError = function() {
2989
+ h.makeTransferable(re), re.prototype.GetError = function() {
2990
2990
  return this.error;
2991
- }, ie.prototype.GetHash = function() {
2991
+ }, re.prototype.GetHash = function() {
2992
2992
  return this.hash;
2993
- }, ie.prototype.GetSignature = function() {
2993
+ }, re.prototype.GetSignature = function() {
2994
2994
  return this.signature;
2995
- }, ie.prototype.GetStatusCode = function() {
2995
+ }, re.prototype.GetStatusCode = function() {
2996
2996
  return this.statusCode;
2997
- }, ie.prototype.GetStatus = function() {
2997
+ }, re.prototype.GetStatus = function() {
2998
2998
  return this.status;
2999
2999
  };
3000
- var Y = function() {
3000
+ var ie = function() {
3001
3001
  this.setClassInfo("EndUserMakeCertificateResult", 1), this.fields = {
3002
3002
  privateKey: "byteArray",
3003
3003
  certificates: "array",
3004
3004
  cmpRequest: "byteArray"
3005
3005
  }, this.initializeFields();
3006
3006
  };
3007
- h.makeTransferable(Y), Y.prototype.GetPrivateKey = function() {
3007
+ h.makeTransferable(ie), ie.prototype.GetPrivateKey = function() {
3008
3008
  return this.privateKey;
3009
- }, Y.prototype.GetCertificate = function(e) {
3009
+ }, ie.prototype.GetCertificate = function(e) {
3010
3010
  return e < 0 || e >= this.certificates.length ? null : this.certificates[e];
3011
- }, Y.prototype.GetCertificatesCount = function() {
3011
+ }, ie.prototype.GetCertificatesCount = function() {
3012
3012
  return this.certificates.length;
3013
- }, Y.prototype.GetCertificates = function() {
3013
+ }, ie.prototype.GetCertificates = function() {
3014
3014
  return this.certificates;
3015
- }, Y.prototype.GetCMPRequest = function() {
3015
+ }, ie.prototype.GetCMPRequest = function() {
3016
3016
  return this.cmpRequest;
3017
3017
  };
3018
3018
  var X = function() {
@@ -5225,7 +5225,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5225
5225
  n
5226
5226
  ]), this._funcCall("CtxSetParameter", a, r, i, null);
5227
5227
  }, $.prototype.CreateReference = function(e, t) {
5228
- return new re(e, t);
5228
+ return new Y(e, t);
5229
5229
  }, $.prototype.ASiCGetASiCType = function(e, t, n) {
5230
5230
  var r;
5231
5231
  if (typeof e != "string" || (e = this._base64Decode(e, n)) != null) return r = this._funcMakeParams([new g(e)]), this._funcCall("ASiCGetASiCType", r, t, n, null);
@@ -9582,6 +9582,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9582
9582
  base64ToArray: () => v,
9583
9583
  convertFromBase64: () => S,
9584
9584
  convertToBase64: () => x,
9585
+ dateWithoutTimezone: () => A,
9585
9586
  downloadAndSignFiles: () => D,
9586
9587
  downloadData: () => p,
9587
9588
  format: () => h,
@@ -9712,7 +9713,7 @@ function T(e) {
9712
9713
  }
9713
9714
  }
9714
9715
  function E(e) {
9715
- return new URL(e).pathname.split("/").pop();
9716
+ return e = new URL(e), e.searchParams.get("file") || e.searchParams.get("name") || e.pathname.split("/").pop();
9716
9717
  }
9717
9718
  async function D(e, t) {
9718
9719
  let n = (e) => typeof e == "string" && T(e) || typeof e == "object" && typeof e.name == "string" && typeof e.val == "string" && T(e.val);
@@ -9752,7 +9753,14 @@ async function D(e, t) {
9752
9753
  function O(e) {
9753
9754
  return e === !1 || e == null;
9754
9755
  }
9755
- var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9756
+ var k = () => Date.now() >= new Date(2026, 6, 1);
9757
+ function A(e) {
9758
+ let t = e.getTimezoneOffset() * 6e4;
9759
+ return new Date(e.valueOf() - t).toISOString().slice(0, -1);
9760
+ }
9761
+ //#endregion
9762
+ //#region src/GlSign.js
9763
+ var j = class {
9756
9764
  constructor(e) {
9757
9765
  e ||= "";
9758
9766
  let t = e.split(";");
@@ -9762,15 +9770,15 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9762
9770
  let r = this._getZoneValue(t, 24), i = this._getZoneValue(t, 25) === "+" || this._getZoneValue(t, 25) !== "-" && null;
9763
9771
  this.DirectAccess = i === !0 || i !== !1 && !this.ApplyProxySettings && !this.UseProxy, this.PreLoadClientLibraries = this._getZoneValue(t, 26) === "+";
9764
9772
  let a = parseInt(this._getZoneValue(t, 27));
9765
- if (this.WebClientFileSize = a < 5 ? 5 : a > 127 ? 127 : a, this.UseTSL = this._getZoneValue(t, 28) === "+", this.UmcaservicePort = this._getZoneValue(t, 29), !r) this.KSPs = q(this.AllowTestKeys);
9773
+ if (this.WebClientFileSize = a < 5 ? 5 : a > 127 ? 127 : a, this.UseTSL = this._getZoneValue(t, 28) === "+", this.UmcaservicePort = this._getZoneValue(t, 29), !r) this.KSPs = J(this.AllowTestKeys);
9766
9774
  else {
9767
9775
  try {
9768
9776
  r = S(r), this.KSPs = JSON.parse(r);
9769
9777
  } catch (e) {
9770
9778
  console.error("error parsing KSPs from GlSign"), console.error(e);
9771
9779
  }
9772
- (!this.KSPs || this.KSPs.length === 0) && (this.KSPs = q(this.AllowTestKeys)), this.KSPs.forEach((e) => {
9773
- if (e.ksp === V.DIIA || e.ksp === V.IIT || e.ksp === V.PB || e.ksp === V.VTOKEN) {
9780
+ (!this.KSPs || this.KSPs.length === 0) && (this.KSPs = J(this.AllowTestKeys)), this.KSPs.forEach((e) => {
9781
+ if (e.ksp === H.DIIA || e.ksp === H.IIT || e.ksp === H.PB || e.ksp === H.VTOKEN) {
9774
9782
  if (e.address.includes("cabinet.e-life.com.ua") || e.address.includes("sserver.amokey.com") || e.address.includes("smart-sign.dpsu.gov.ua") || e.address.includes("sign-ca.mvs.gov.ua") || e.address.includes("id.edin.ua") || e.address.includes("business.ukrsibbank.com")) return;
9775
9783
  (!Array.isArray(e.signAlgos) || e.signAlgos.length == 0) && (e.signAlgos = [f.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564, f.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311]);
9776
9784
  }
@@ -9786,46 +9794,46 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9786
9794
  let a = i.split(n);
9787
9795
  return this._getZoneValue(a, r);
9788
9796
  }
9789
- }, j = /* @__PURE__ */ s({
9790
- CertificatesProvider: () => I,
9791
- DefaultCertificatesProvider: () => L,
9792
- DefaultSettingProvider: () => N,
9793
- DigitalSignatureKeyType: () => B,
9797
+ }, M = /* @__PURE__ */ s({
9798
+ CertificatesProvider: () => L,
9799
+ DefaultCertificatesProvider: () => R,
9800
+ DefaultSettingProvider: () => P,
9801
+ DigitalSignatureKeyType: () => V,
9794
9802
  DigitalSignatureKeyTypeFile: () => 0,
9795
9803
  DigitalSignatureKeyTypeKSP: () => 2,
9796
9804
  DigitalSignatureKeyTypeToken: () => 1,
9797
9805
  DigitalSignatureKeyTypeUmCAService: () => 4,
9798
9806
  DigitalSignatureKeyTypeWindowsCertStore: () => 3,
9799
- DigitalSignatureLibraryType: () => z,
9807
+ DigitalSignatureLibraryType: () => B,
9800
9808
  DigitalSignatureLibraryTypeJS: () => 0,
9801
9809
  DigitalSignatureLibraryTypeSW: () => 1,
9802
- DigitalSignatureSettings: () => M,
9810
+ DigitalSignatureSettings: () => N,
9803
9811
  EU_KSP_ClientIdType: () => -1,
9804
9812
  EU_KSP_DIIA: () => 7,
9805
9813
  EU_KSP_GRYADA: () => -1,
9806
9814
  EU_KSP_IIT: () => 4,
9807
9815
  EU_KSP_PB: () => 6,
9808
9816
  EU_KSP_VTOKEN: () => -2,
9809
- EndUserKSP: () => V,
9810
- EndUserKSPClientIdType: () => H,
9811
- FilePrivateKeyInfo: () => W,
9812
- HardwarePrivateKeyInfo: () => G,
9813
- KSPKeyMedia: () => ee,
9814
- KSPKeyMediasResponse: () => J,
9815
- KSPPrivateKeyAuthData: () => ne,
9816
- KSPUserAuthData: () => te,
9817
- KspPrivateKeyInfo: () => K,
9818
- LegacyCertificatesProvider: () => R,
9819
- LegacySettingsProvider: () => F,
9820
- PrivateKeyInfo: () => U,
9817
+ EndUserKSP: () => H,
9818
+ EndUserKSPClientIdType: () => U,
9819
+ FilePrivateKeyInfo: () => G,
9820
+ HardwarePrivateKeyInfo: () => K,
9821
+ KSPKeyMedia: () => te,
9822
+ KSPKeyMediasResponse: () => ee,
9823
+ KSPPrivateKeyAuthData: () => Y,
9824
+ KSPUserAuthData: () => ne,
9825
+ KspPrivateKeyInfo: () => q,
9826
+ LegacyCertificatesProvider: () => z,
9827
+ LegacySettingsProvider: () => I,
9828
+ PrivateKeyInfo: () => W,
9821
9829
  ProtectTaxReportParams: () => re,
9822
- WebserviceSettingProvider: () => P,
9823
- getDefaultKSPs: () => q
9824
- }), M = class {
9830
+ WebserviceSettingProvider: () => F,
9831
+ getDefaultKSPs: () => J
9832
+ }), N = class {
9825
9833
  constructor(e, t, n, r, i) {
9826
9834
  this.language = e || "en", this.userId = t, this.httpProxyServiceURL = n, this.certificatesProvider = r, this.libraryUrl = i;
9827
9835
  }
9828
- }, N = class {
9836
+ }, P = class {
9829
9837
  constructor(e, t, n, r) {
9830
9838
  if (typeof n != "string") throw {
9831
9839
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
@@ -9834,17 +9842,17 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9834
9842
  n.endsWith("/") && (n = n.substring(0, n.length - 1)), this.language = e, this.userId = t, this.apiPath = n, this.workerPath = r;
9835
9843
  }
9836
9844
  async getGlSign() {
9837
- return new A(await p(this.apiPath + "/files?name=glsign", "string"));
9845
+ return new j(await p(this.apiPath + "/files?name=glsign", "string"));
9838
9846
  }
9839
9847
  async getSettings() {
9840
- return this._settings ||= new M(this.language, this.userId, this.apiPath + "/ProxyHandler", new L(this.apiPath + "/files?name=CAs.json", this.apiPath + "/files?name=CACertificates.p7b"), this.workerPath || "/euscp.worker.js"), this._settings;
9848
+ return this._settings ||= new N(this.language, this.userId, this.apiPath + "/ProxyHandler", new R(this.apiPath + "/files?name=CAs.json", this.apiPath + "/files?name=CACertificates.p7b"), this.workerPath || "/euscp.worker.js"), this._settings;
9841
9849
  }
9842
- }, P = class {
9850
+ }, F = class {
9843
9851
  constructor(e, t, n, r) {
9844
9852
  this.language = e, this.userId = t, this.apiPath = n, this.workerPath = r;
9845
9853
  }
9846
9854
  async getGlSign() {
9847
- return new A(await p(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`, void 0, void 0, {
9855
+ return new j(await p(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`, void 0, void 0, {
9848
9856
  calcId: "GETGLSIGNBEFORELOGIN",
9849
9857
  args: "",
9850
9858
  ticket: ""
@@ -9857,9 +9865,9 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9857
9865
  args: "",
9858
9866
  ticket: ""
9859
9867
  });
9860
- return this._settings = new M(this.language, this.userId, `${this.apiPath}/ProxyHandler`, new L(`${this.apiPath}/GetFile.ashx?file=${e.FILECAS}`, `${this.apiPath}/GetFile.ashx?file=${e.FILECERT}`), this.workerPath || "/euscp.worker.js"), this._settings;
9868
+ return this._settings = new N(this.language, this.userId, `${this.apiPath}/ProxyHandler`, new R(`${this.apiPath}/GetFile.ashx?file=${e.FILECAS}`, `${this.apiPath}/GetFile.ashx?file=${e.FILECERT}`), this.workerPath || "/euscp.worker.js"), this._settings;
9861
9869
  }
9862
- }, F = class {
9870
+ }, I = class {
9863
9871
  constructor(e, t, n, r, i) {
9864
9872
  if (typeof n != "string") throw {
9865
9873
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
@@ -9868,12 +9876,12 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9868
9876
  n.endsWith("/") && (n = n.substring(0, n.length - 1)), this.language = e, this.userId = t, this.basePath = n, this.glsign = r, this.workerPath = i;
9869
9877
  }
9870
9878
  getGlSign() {
9871
- return typeof this.glsign == "string" ? new A(this.glsign) : this.glsign;
9879
+ return typeof this.glsign == "string" ? new j(this.glsign) : this.glsign;
9872
9880
  }
9873
9881
  getSettings(e) {
9874
- return new M(this.language, this.userId, this.basePath + "/ProxyHandler.ashx", new R(e, this.basePath + "/Data/version.txt", this.basePath + (e ? "/Data/CAs.test.json" : "/Data/CAs.json"), this.basePath + (e ? "/Data/CACertificates.test.p7b" : "/Data/CACertificates.p7b")), this.workerPath || "/euscp.worker.js");
9882
+ return new N(this.language, this.userId, this.basePath + "/ProxyHandler.ashx", new z(e, this.basePath + "/Data/version.txt", this.basePath + (e ? "/Data/CAs.test.json" : "/Data/CAs.json"), this.basePath + (e ? "/Data/CACertificates.test.p7b" : "/Data/CACertificates.p7b")), this.workerPath || "/euscp.worker.js");
9875
9883
  }
9876
- }, I = class {
9884
+ }, L = class {
9877
9885
  constructor(e) {
9878
9886
  this.testMode = e;
9879
9887
  }
@@ -9895,7 +9903,7 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9895
9903
  _removeItem(e) {
9896
9904
  localStorage.removeItem(this._storagePrefix + e);
9897
9905
  }
9898
- }, L = class extends I {
9906
+ }, R = class extends L {
9899
9907
  constructor(e, t) {
9900
9908
  super(!1), this.CAsUri = e, this.CACertificatesUri = t;
9901
9909
  }
@@ -9913,7 +9921,7 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9913
9921
  };
9914
9922
  }
9915
9923
  }
9916
- }, R = class extends I {
9924
+ }, z = class extends L {
9917
9925
  constructor(e, t, n, r) {
9918
9926
  super(e), this.versionUri = t, this.CAsUri = n, this.CACertificatesUri = r;
9919
9927
  }
@@ -9942,28 +9950,28 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
9942
9950
  };
9943
9951
  }
9944
9952
  }
9945
- }, z = {
9953
+ }, B = {
9946
9954
  JS: 0,
9947
9955
  SW: 1
9948
- }, B = {
9956
+ }, V = {
9949
9957
  File: 0,
9950
9958
  Token: 1,
9951
9959
  KSP: 2,
9952
9960
  WindowsCertStore: 3,
9953
9961
  UmCAService: 4
9954
- }, V = {
9962
+ }, H = {
9955
9963
  IIT: 4,
9956
9964
  PB: 6,
9957
9965
  DIIA: 7,
9958
9966
  GRYADA: -1,
9959
9967
  VTOKEN: -2
9960
- }, H = {
9968
+ }, U = {
9961
9969
  Default: f.EndUserConstants.EndUserKSPClientIdType.Default,
9962
9970
  Name: f.EndUserConstants.EndUserKSPClientIdType.Name,
9963
9971
  Phone: f.EndUserConstants.EndUserKSPClientIdType.Phone,
9964
9972
  Email: f.EndUserConstants.EndUserKSPClientIdType.Email,
9965
9973
  NamePassword: -1
9966
- }, U = class {
9974
+ }, W = class {
9967
9975
  constructor(e, t, n, r, i) {
9968
9976
  this.keyType = e, this.ownerInfo = t, this.certificates = n, this.visibleName = r, this.id = i;
9969
9977
  }
@@ -10009,20 +10017,20 @@ var k = () => Date.now() >= new Date(2026, 6, 1), A = class {
10009
10017
  }
10010
10018
  return C(this.getSignAlgo());
10011
10019
  }
10012
- }, W = class extends U {
10020
+ }, G = class extends W {
10013
10021
  constructor(e, t, n, r, i) {
10014
10022
  super(e, t, n, n[0].infoEx.subjCN, n[0].infoEx.serial), this.privateKey = r, this.password = i;
10015
10023
  }
10016
- }, G = class extends U {
10024
+ }, K = class extends W {
10017
10025
  constructor(e, t, n, r) {
10018
10026
  super(e, t, n, n[0].infoEx.subjCN, n[0].infoEx.serial), this.keyMedia = r;
10019
10027
  }
10020
- }, K = class extends U {
10028
+ }, q = class extends W {
10021
10029
  constructor(e, t, n, r, i, a) {
10022
10030
  super(e, t, n, r, r), this.userId = r, this.ksp = i, this.keyId = a;
10023
10031
  }
10024
10032
  };
10025
- function q(e) {
10033
+ function J(e) {
10026
10034
  let t = new f.KSPSettings();
10027
10035
  t.id = "DEPOSITSIGN", t.name = "DepositSign", t.ksp = f.EndUserConstants.EU_KSP_PB, t.address = "https://depositsign.com/api/v1/it-enterprise/sign-server", t.clientIdPrefix = "", t.directAccess = !0, t.needQRCode = !1;
10028
10036
  let n = new f.KSPSettings();
@@ -10038,25 +10046,25 @@ function q(e) {
10038
10046
  let s = new f.KSPSettings();
10039
10047
  s.id = "ESIGN", s.name = "ESign - хмарний підпис", s.ksp = f.EndUserConstants.EU_KSP_PB, s.address = "https://cabinet.e-life.com.ua/api/EDG/Sign", s.clientIdPrefix = "", s.directAccess = !0, s.needQRCode = !1;
10040
10048
  let c = new f.KSPSettings();
10041
- c.id = "SMARTSIGNTAX", c.name = "ДПС - хмарний підпис", c.ksp = f.EndUserConstants.EU_KSP_PB, c.address = "https://smart-sign.tax.gov.ua/", c.port = "443", c.directAccess = !0, c.clientIdType = H.Name, c.needQRCode = !1;
10049
+ c.id = "SMARTSIGNTAX", c.name = "ДПС - хмарний підпис", c.ksp = f.EndUserConstants.EU_KSP_PB, c.address = "https://smart-sign.tax.gov.ua/", c.port = "443", c.directAccess = !0, c.clientIdType = U.Name, c.needQRCode = !1;
10042
10050
  let l = new f.KSPSettings();
10043
10051
  l.id = "PUMB", l.name = "ПУМБ - хмарний підпис", l.ksp = f.EndUserConstants.EU_KSP_PB, l.address = "https://apiext.pumb.ua/hogsmeade/striga/v1", l.directAccess = !1, l.clientIdPrefix = "SMARTTENDER_", l.confirmationURL = "https://www.pumb.ua/qes", l.mobileAppName = "", l.needQRCode = !0;
10044
10052
  let u = new f.KSPSettings();
10045
- u.id = "UGB", u.name = "Укргазбанк - хмарний підпис «EcoSign»", u.ksp = V.VTOKEN, u.address = "https://vtms-api-qca.ukrgasbank.com/vtco/api/v1", u.systemId = "cihsmVtcoServiceClientSmartTender", u.directAccess = !0, u.clientIdType = H.NamePassword, u.needQRCode = !1;
10053
+ u.id = "UGB", u.name = "Укргазбанк - хмарний підпис «EcoSign»", u.ksp = H.VTOKEN, u.address = "https://vtms-api-qca.ukrgasbank.com/vtco/api/v1", u.systemId = "cihsmVtcoServiceClientSmartTender", u.directAccess = !0, u.clientIdType = U.NamePassword, u.needQRCode = !1;
10046
10054
  let d = new f.KSPSettings();
10047
- d.id = "ALLIANCE", d.name = "Банк Альянс - хмарний підпис", d.ksp = V.VTOKEN, d.address = "https://cihsm-api.bankalliance.ua/vtco/api/v1", d.systemId = "cihsmVtcoServiceClientSmartTender", d.directAccess = !0, d.clientIdType = H.NamePassword, d.needQRCode = !1;
10055
+ d.id = "ALLIANCE", d.name = "Банк Альянс - хмарний підпис", d.ksp = H.VTOKEN, d.address = "https://cihsm-api.bankalliance.ua/vtco/api/v1", d.systemId = "cihsmVtcoServiceClientSmartTender", d.directAccess = !0, d.clientIdType = U.NamePassword, d.needQRCode = !1;
10048
10056
  let p = new f.KSPSettings();
10049
- p.id = "VTOKEN", p.name = "Хмарний сервіс Шифр-vToken (тестовий)", p.ksp = V.VTOKEN, p.address = "https://cihsm-dev-api.cipher.com.ua/vtco/api/v1", p.systemId = "cipherVTokenIntegrationClient", p.directAccess = !0, p.clientIdType = H.NamePassword, p.needQRCode = !1;
10057
+ p.id = "VTOKEN", p.name = "Хмарний сервіс Шифр-vToken (тестовий)", p.ksp = H.VTOKEN, p.address = "https://cihsm-dev-api.cipher.com.ua/vtco/api/v1", p.systemId = "cipherVTokenIntegrationClient", p.directAccess = !0, p.clientIdType = U.NamePassword, p.needQRCode = !1;
10050
10058
  let m = new f.KSPSettings();
10051
- m.id = "AMOKEY", m.name = "АМО ФІНТЕХ – хмарний підпис AMOKEY", m.ksp = V.PB, m.address = "https://sserver.amokey.com", m.port = "443", m.clientIdPrefix = "", m.directAccess = !0, m.clientIdType = H.Name, m.needQRCode = !1;
10059
+ m.id = "AMOKEY", m.name = "АМО ФІНТЕХ – хмарний підпис AMOKEY", m.ksp = H.PB, m.address = "https://sserver.amokey.com", m.port = "443", m.clientIdPrefix = "", m.directAccess = !0, m.clientIdType = U.Name, m.needQRCode = !1;
10052
10060
  let h = new f.KSPSettings();
10053
- h.id = "TASCOMBANK", h.name = "Сервер підпису КНЕДП АТ \"ТАСКОМБАНК\"", h.ksp = V.PB, h.address = "https://smartsign.tascombank.ua", h.port = "443", h.clientIdPrefix = "", h.directAccess = !0, h.clientIdType = H.Name, h.needQRCode = !1;
10061
+ h.id = "TASCOMBANK", h.name = "Сервер підпису КНЕДП АТ \"ТАСКОМБАНК\"", h.ksp = H.PB, h.address = "https://smartsign.tascombank.ua", h.port = "443", h.clientIdPrefix = "", h.directAccess = !0, h.clientIdType = U.Name, h.needQRCode = !1;
10054
10062
  let g = new f.KSPSettings();
10055
- g.id = "EDINQR", g.name = "EDIN ID - хмарний підпис (QR)", g.ksp = V.PB, g.address = "https://id.edin.ua/api/ess/v1/", g.confirmationURL = "https://id.edin.ua/mobile/sign", g.port = "", g.clientIdPrefix = "EDIN_", g.directAccess = !0, g.mobileAppName = "edinid", g.needQRCode = !0;
10063
+ g.id = "EDINQR", g.name = "EDIN ID - хмарний підпис (QR)", g.ksp = H.PB, g.address = "https://id.edin.ua/api/ess/v1/", g.confirmationURL = "https://id.edin.ua/mobile/sign", g.port = "", g.clientIdPrefix = "EDIN_", g.directAccess = !0, g.mobileAppName = "edinid", g.needQRCode = !0;
10056
10064
  let _ = new f.KSPSettings();
10057
- _.id = "EDIN", _.name = "EDIN ID - хмарний підпис", _.ksp = V.PB, _.address = "https://id.edin.ua/api/ess/v1/", _.port = "", _.clientIdPrefix = "", _.directAccess = !0, _.clientIdType = H.Name, _.needQRCode = !1;
10065
+ _.id = "EDIN", _.name = "EDIN ID - хмарний підпис", _.ksp = H.PB, _.address = "https://id.edin.ua/api/ess/v1/", _.port = "", _.clientIdPrefix = "", _.directAccess = !0, _.clientIdType = U.Name, _.needQRCode = !1;
10058
10066
  let v = new f.KSPSettings();
10059
- v.id = "UKRSIBBANK", v.name = "УКРСИББАНК - хмарний підпис", v.ksp = V.PB, v.address = "https://business.ukrsibbank.com/morpheus/smart-sign/", v.confirmationURL = "https://business.ukrsibbank.com/smartsign", v.port = "", v.clientIdPrefix = "USB_", v.directAccess = !0, v.mobileAppName = "UKRSIB business", v.needQRCode = !0;
10067
+ v.id = "UKRSIBBANK", v.name = "УКРСИББАНК - хмарний підпис", v.ksp = H.PB, v.address = "https://business.ukrsibbank.com/morpheus/smart-sign/", v.confirmationURL = "https://business.ukrsibbank.com/smartsign", v.port = "", v.clientIdPrefix = "USB_", v.directAccess = !0, v.mobileAppName = "UKRSIB business", v.needQRCode = !0;
10060
10068
  let y = [
10061
10069
  t,
10062
10070
  n,
@@ -10077,19 +10085,19 @@ function q(e) {
10077
10085
  ];
10078
10086
  return e && y.push(p), y;
10079
10087
  }
10080
- var J = class {
10088
+ var ee = class {
10081
10089
  constructor(e, t, n) {
10082
10090
  this.token = e, this.isTwoFactor = t, this.keys = n;
10083
10091
  }
10084
- }, ee = class {
10092
+ }, te = class {
10085
10093
  constructor(e, t, n, r, i) {
10086
10094
  this.keyId = e, this.visibleName = t, this.subject = n, this.issuer = r, this.isStamp = i;
10087
10095
  }
10088
- }, te = class {
10096
+ }, ne = class {
10089
10097
  constructor(e, t) {
10090
10098
  this.userName = e, this.password = t;
10091
10099
  }
10092
- }, ne = class {
10100
+ }, Y = class {
10093
10101
  constructor(e, t, n) {
10094
10102
  this.pin = e, this.token = t, this.twoFactorCode = n;
10095
10103
  }
@@ -10132,13 +10140,13 @@ var J = class {
10132
10140
  let i;
10133
10141
  n.type === f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES ? i = "pdf-attached" : (i = n.signLevel >= f.EndUserConstants.EU_SIGN_TYPE_CADES_C ? "cades-x-ts-signtime-ocsp-stdua" : "cms-ts-signtime", n.subType === f.EndUserConstants.EU_CADES_TYPE_ENVELOPED && (i += "-attached"));
10134
10142
  let a = !0;
10135
- Array.isArray(data) ? data = [...data] : (a = !1, data = [data]);
10136
- for (let e = 0; e < data.length; e++) {
10137
- let t = data[e];
10138
- t.val ? data[e] = {
10139
- name: t.name,
10140
- val: Y(t.val, !0)
10141
- } : data[e] = Y(t, !0);
10143
+ Array.isArray(t) ? t = [...t] : (a = !1, t = [t]);
10144
+ for (let e = 0; e < t.length; e++) {
10145
+ let n = t[e];
10146
+ n.val ? t[e] = {
10147
+ name: n.name,
10148
+ val: X(n.val, !0)
10149
+ } : t[e] = X(n, !0);
10142
10150
  }
10143
10151
  let o = [];
10144
10152
  for (let n of t) {
@@ -10172,12 +10180,12 @@ var J = class {
10172
10180
  let t = o[e];
10173
10181
  t.val ? o[e] = {
10174
10182
  name: t.name,
10175
- val: Y(t.val, !r)
10176
- } : o[e] = Y(t, !r);
10183
+ val: X(t.val, !r)
10184
+ } : o[e] = X(t, !r);
10177
10185
  }
10178
10186
  return a ? o : o[0];
10179
10187
  }
10180
- }, Y = (e, t) => t && typeof e != "string" ? _(e) : !t && typeof e == "string" ? v(e) : e, X = {
10188
+ }, X = (e, t) => t && typeof e != "string" ? _(e) : !t && typeof e == "string" ? v(e) : e, Z = {
10181
10189
  uk: {
10182
10190
  LibraryNotSupported: "Бібліотека web-підпису не підтримується в вашому браузері або ОС.",
10183
10191
  LibraryNeedsInstall: "Бібліотека web-підпису не запущена або потребує встановлення. Будь ласка, запустіть або встановіть бібліотеку за посиланням та оновіть сторінку.",
@@ -10253,7 +10261,7 @@ var J = class {
10253
10261
  UmCAServiceConnectError: "Unable to connect to UmCAService. Check if the service is running. If using a non-standard port, specify it in the global parameter GlSign.",
10254
10262
  UmCAServiceWrongPassword: "Wrong password"
10255
10263
  }
10256
- }, Z = "PKType", Q = "PKInfo", $ = class {
10264
+ }, Q = "PKType", $ = "PKInfo", ae = class {
10257
10265
  constructor(e) {
10258
10266
  this._settingsProvider = e, this._glSign = null, this._settings = null, this._euSignFile, this._euSignKeyMedia, this._euSign = null, this._selectedCA = null, this._KSPs = [], this._readedKey = null;
10259
10267
  }
@@ -10268,11 +10276,11 @@ var J = class {
10268
10276
  }
10269
10277
  async setLibraryType(e) {
10270
10278
  switch (e) {
10271
- case B.Token:
10279
+ case V.Token:
10272
10280
  if (this._euSign === this._euSignKeyMedia && await this._euSign.IsInitialized()) return;
10273
10281
  this._euSign = this._euSignKeyMedia;
10274
10282
  break;
10275
- case B.UmCAService:
10283
+ case V.UmCAService:
10276
10284
  this._euSign = this._euSignFile;
10277
10285
  break;
10278
10286
  default:
@@ -10282,7 +10290,7 @@ var J = class {
10282
10290
  e != null && e != null && (this._preferredKeyType = e), await this.initialise(), this.keyType = e;
10283
10291
  }
10284
10292
  async initialise() {
10285
- if (this._glSign ||= await Promise.resolve(this._settingsProvider.getGlSign()), this._settings ||= await Promise.resolve(this._settingsProvider.getSettings(this._glSign.AllowTestKeys)), this._euSignFile ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.JS, this._glSign.WebClientFileSize), this._euSignKeyMedia ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.SW, this._glSign.WebClientFileSize), this._euSign || (this._euSign = this._glSign.PreferHarware ? this._euSignKeyMedia : this._euSignFile, this.keyType = this._glSign.PreferHarware ? B.Token : this._preferredKeyType), this.keyType === B.UmCAService && (this.UmCAService ||= new ie(this.glSign.UmcaservicePort), !await this.UmCAService.tryConnect())) throw {
10293
+ if (this._glSign ||= await Promise.resolve(this._settingsProvider.getGlSign()), this._settings ||= await Promise.resolve(this._settingsProvider.getSettings(this._glSign.AllowTestKeys)), this._euSignFile ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.JS, this._glSign.WebClientFileSize), this._euSignKeyMedia ||= new f.EndUser(this._settings.libraryUrl, f.EndUserConstants.EndUserLibraryType.SW, this._glSign.WebClientFileSize), this._euSign || (this._euSign = this._glSign.PreferHarware ? this._euSignKeyMedia : this._euSignFile, this.keyType = this._glSign.PreferHarware ? V.Token : this._preferredKeyType), this.keyType === V.UmCAService && (this.UmCAService ||= new ie(this.glSign.UmcaservicePort), !await this.UmCAService.tryConnect())) throw {
10286
10294
  code: f.EndUserError.EU_ERROR_LIBRARY_LOAD,
10287
10295
  message: this._resourses.UmCAServiceConnectError
10288
10296
  };
@@ -10383,12 +10391,12 @@ var J = class {
10383
10391
  await this._euSignFile.SetLanguage(e), await this._euSignKeyMedia.IsInitialized() && await this._euSignKeyMedia.SetLanguage(e);
10384
10392
  }
10385
10393
  async parseCertificate(e) {
10386
- await this.setLibraryType(B.File), typeof e == "string" && (e = v(e));
10394
+ await this.setLibraryType(V.File), typeof e == "string" && (e = v(e));
10387
10395
  let t = new f.EndUserCertificate();
10388
10396
  return t.data = e, t.infoEx = await this._euSign.m_library.m_worker.postMessage("ParseCertificateEx", [e]), t;
10389
10397
  }
10390
10398
  async getKeyMedias() {
10391
- return await this.setLibraryType(B.Token), this._euSignKeyMedia.GetKeyMedias();
10399
+ return await this.setLibraryType(V.Token), this._euSignKeyMedia.GetKeyMedias();
10392
10400
  }
10393
10401
  async readPrivateKeyByInfo(e) {
10394
10402
  if (!e) throw {
@@ -10396,14 +10404,16 @@ var J = class {
10396
10404
  message: this._resourses.BadParameter + " keyInfo"
10397
10405
  };
10398
10406
  switch (await this.setLibraryType(e.keyType), e.keyType) {
10399
- case B.File: return await this.readFileKey(e.privateKey, e.password, e.certificates);
10400
- case B.Token: return await this.readHardwareKey(e.keyMedia, e.certificates);
10401
- case B.KSP: return await this.readPrivateKeyKSP(e.ksp, e.kspUserId, !1);
10407
+ case V.File: return await this.readFileKey(e.privateKey, e.password, e.certificates);
10408
+ case V.Token: return await this.readHardwareKey(e.keyMedia, e.certificates);
10409
+ case V.KSP: return await this.readPrivateKeyKSP(e.ksp, e.kspUserId, !1);
10410
+ case V.UmCAService: return await this.readPrivateKeyUmCAService(e.keyMedia);
10411
+ case V.WindowsCertStore: return await this.readWindowsCertStorePrivateKey();
10402
10412
  default: return null;
10403
10413
  }
10404
10414
  }
10405
10415
  async readHardwareKey(e, t) {
10406
- if (await this.setLibraryType(B.Token), !e) throw {
10416
+ if (await this.setLibraryType(V.Token), !e) throw {
10407
10417
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10408
10418
  message: this._resourses.BadParameter + " keyMedia"
10409
10419
  };
@@ -10414,7 +10424,7 @@ var J = class {
10414
10424
  t = Array.isArray(t) && t.length > 0 ? await Promise.all(t.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10415
10425
  try {
10416
10426
  let n = await this._euSign.ReadPrivateKey(e, t, this._selectedIssuerCN);
10417
- return this._readedKey = new G(B.Token, n, await this._euSign.GetOwnCertificates(), e), this._readedKey._glSign = this._glSign, this._readedKey;
10427
+ return this._readedKey = new K(V.Token, n, await this._euSign.GetOwnCertificates(), e), this._readedKey._glSign = this._glSign, this._readedKey;
10418
10428
  } catch (e) {
10419
10429
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
10420
10430
  if (!this._selectedIssuerCN) throw {
@@ -10433,7 +10443,7 @@ var J = class {
10433
10443
  }
10434
10444
  }
10435
10445
  async readFileKey(e, t, n) {
10436
- if (await this.setLibraryType(B.File), !e) throw {
10446
+ if (await this.setLibraryType(V.File), !e) throw {
10437
10447
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10438
10448
  message: this._resourses.BadParameter + " keyMedia"
10439
10449
  };
@@ -10444,7 +10454,7 @@ var J = class {
10444
10454
  (e instanceof File || e instanceof Blob) && (e = await g(e)), n = Array.isArray(n) && n.length > 0 ? await Promise.all(n.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10445
10455
  try {
10446
10456
  let r = await this._euSign.ReadPrivateKeyBinary(e, t, n, this._selectedIssuerCN);
10447
- return this._readedKey = new W(B.File, r, await this._euSign.GetOwnCertificates(), e, t), this._readedKey._glSign = this._glSign, this._readedKey;
10457
+ return this._readedKey = new G(V.File, r, await this._euSign.GetOwnCertificates(), e, t), this._readedKey._glSign = this._glSign, this._readedKey;
10448
10458
  } catch (e) {
10449
10459
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
10450
10460
  if (!this._selectedIssuerCN) throw {
@@ -10463,7 +10473,7 @@ var J = class {
10463
10473
  }
10464
10474
  }
10465
10475
  async getJKSPrivateKeys(e) {
10466
- return await this.setLibraryType(B.File), (e instanceof File || e instanceof Blob) && (e = await g(e)), await this._euSign.GetJKSPrivateKeys(e);
10476
+ return await this.setLibraryType(V.File), (e instanceof File || e instanceof Blob) && (e = await g(e)), await this._euSign.GetJKSPrivateKeys(e);
10467
10477
  }
10468
10478
  isJKSContainer(e) {
10469
10479
  return e.name.endsWith(".jks");
@@ -10477,19 +10487,19 @@ var J = class {
10477
10487
  return await this.readPrivateKeyKSP(t, null, e);
10478
10488
  }
10479
10489
  async readPrivateKeyKSP(e, t, n = !1, r, i) {
10480
- await this.setLibraryType(B.KSP), e.ksp === f.EndUserConstants.EU_KSP_DIIA && await this._diiaCheckAccess(e);
10490
+ await this.setLibraryType(V.KSP), e.ksp === f.EndUserConstants.EU_KSP_DIIA && await this._diiaCheckAccess(e);
10481
10491
  let a = await this._euSign.ReadPrivateKeyKSP(t, e.name, n, r, null, i);
10482
10492
  if (n && !a) throw {
10483
10493
  code: f.EndUserError.EU_ERROR_KEY_MEDIAS_READ_FAILED,
10484
10494
  message: this._resourses.PrivateKeyNotReaded
10485
10495
  };
10486
- return this._readedKey = new K(B.KSP, a, n ? await this._euSign.GetOwnCertificates() : [], t, e, r), this._readedKey._glSign = this._glSign, this._readedKey;
10496
+ return this._readedKey = new q(V.KSP, a, n ? await this._euSign.GetOwnCertificates() : [], t, e, r), this._readedKey._glSign = this._glSign, this._readedKey;
10487
10497
  }
10488
10498
  async getKeyMediasKSP(e, t) {
10489
- return await this.setLibraryType(B.KSP), this._euSign.m_library.m_worker.postMessage("GetKeyMediasKSP", [e, t]);
10499
+ return await this.setLibraryType(V.KSP), this._euSign.m_library.m_worker.postMessage("GetKeyMediasKSP", [e, t]);
10490
10500
  }
10491
10501
  async setTwoFactorCodeKSP(e) {
10492
- return await this.setLibraryType(B.KSP), this._euSign.m_library.m_worker.postMessage("SetTwoFactorCodeKSP", [e]);
10502
+ return await this.setLibraryType(V.KSP), this._euSign.m_library.m_worker.postMessage("SetTwoFactorCodeKSP", [e]);
10493
10503
  }
10494
10504
  async addConfirmKSPOperationEventListener(e) {
10495
10505
  await this._euSignFile.AddEventListener(f.EndUserConstants.EndUserEventType.ConfirmKSPOperation, function(t) {
@@ -10497,7 +10507,7 @@ var J = class {
10497
10507
  });
10498
10508
  }
10499
10509
  async readPrivateKeyUmCAService(e) {
10500
- await this.setLibraryType(B.UmCAService);
10510
+ await this.setLibraryType(V.UmCAService);
10501
10511
  let t = [];
10502
10512
  for (let n of e.certificates) {
10503
10513
  let e = await this.parseCertificate(n);
@@ -10507,7 +10517,7 @@ var J = class {
10507
10517
  let n = new f.EndUserSignContainerInfo();
10508
10518
  n.type = f.EndUserConstants.EndUserSignContainerType.CAdES, n.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, n.signLevel = f.EndUserConstants.EndUserSignType.CAdES_BES;
10509
10519
  let r = await this.UmCAService.signData(e, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=", n), i = await this._euSignFile.VerifyDataInternal(r);
10510
- return this._readedKey = new U(B.UmCAService, i[0].ownerInfo, t, e.visibleName, e.alias), this._readedKey.glSign = this.glSign, this._readedKey.keyMedia = e, this._readedKey;
10520
+ return this._readedKey = new W(V.UmCAService, i[0].ownerInfo, t, e.visibleName, e.alias), this._readedKey.glSign = this.glSign, this._readedKey.keyMedia = e, this._readedKey;
10511
10521
  } catch (e) {
10512
10522
  throw e.message && e.message == "KeyStoreException: KSE_INVALID_PASSWORD" ? {
10513
10523
  code: f.EndUserError.EU_ERROR_BAD_PRIVATE_KEY,
@@ -10516,10 +10526,10 @@ var J = class {
10516
10526
  }
10517
10527
  }
10518
10528
  async getKeyMediasUmCAService() {
10519
- return await this.setLibraryType(B.UmCAService), this.UmCAService.getKeys();
10529
+ return await this.setLibraryType(V.UmCAService), this.UmCAService.getKeys();
10520
10530
  }
10521
10531
  async readWindowsCertStorePrivateKey() {
10522
- await this.setLibraryType(B.File);
10532
+ await this.setLibraryType(V.File);
10523
10533
  let e;
10524
10534
  try {
10525
10535
  e = await SignerDigital.getSelectedCertificate();
@@ -10531,14 +10541,14 @@ var J = class {
10531
10541
  }
10532
10542
  e = JSON.parse(e);
10533
10543
  let t = await this.parseCertificate(e.Cert);
10534
- return this._readedKey = new U(B.WindowsCertStore, t.infoEx, [t], t.infoEx.subjCN, e.CertThumbPrint), this._readedKey._glSign = this._glSign, this._readedKey;
10544
+ return this._readedKey = new W(V.WindowsCertStore, t.infoEx, [t], t.infoEx.subjCN, e.CertThumbPrint), this._readedKey._glSign = this._glSign, this._readedKey;
10535
10545
  }
10536
10546
  get KSPs() {
10537
10547
  return this._glSign.KSPs;
10538
10548
  }
10539
10549
  async isPrivateKeyReaded() {
10540
10550
  if (!this._readedKey) return !1;
10541
- if (this._readedKey.keyType === B.WindowsCertStore || this._readedKey.keyType === B.UmCAService) return !0;
10551
+ if (this._readedKey.keyType === V.WindowsCertStore || this._readedKey.keyType === V.UmCAService) return !0;
10542
10552
  try {
10543
10553
  return await this._euSign.IsPrivateKeyReaded();
10544
10554
  } catch {
@@ -10561,17 +10571,17 @@ var J = class {
10561
10571
  return this._selectedCA && !this._selectedCA.cmpAddress;
10562
10572
  }
10563
10573
  async signData(e, t, n) {
10564
- if (t === !0 ? (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long) : O(t) && (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Detached, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long), typeof n != "boolean" && (n = !1), this.readedKey.keyType === B.KSP) {
10574
+ if (t === !0 ? (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long) : O(t) && (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Detached, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long), typeof n != "boolean" && (n = !1), this.readedKey.keyType === V.KSP) {
10565
10575
  if (t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES && t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES) throw {
10566
10576
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10567
10577
  message: this._resourses.KSPSignFormatError
10568
10578
  };
10569
- if (t.type === f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES && (typeof this.readedKey.ksp == "object" ? this.readedKey.ksp.ksp : this.readedKey.ksp) != V.GRYADA) throw {
10579
+ if (t.type === f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES && (typeof this.readedKey.ksp == "object" ? this.readedKey.ksp.ksp : this.readedKey.ksp) != H.GRYADA) throw {
10570
10580
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10571
10581
  message: this._resourses.KSPSignPAdESError
10572
10582
  };
10573
10583
  }
10574
- if (this.readedKey.keyType === B.WindowsCertStore) {
10584
+ if (this.readedKey.keyType === V.WindowsCertStore) {
10575
10585
  if (t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES) throw {
10576
10586
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10577
10587
  message: this._resourses.KSPSignFormatError
@@ -10583,7 +10593,7 @@ var J = class {
10583
10593
  !n
10584
10594
  ]);
10585
10595
  }
10586
- if (this.readedKey.keyType === B.UmCAService) {
10596
+ if (this.readedKey.keyType === V.UmCAService) {
10587
10597
  if (t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES && t.type !== f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES) throw {
10588
10598
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10589
10599
  message: this._resourses.KSPSignFormatError
@@ -10629,8 +10639,8 @@ var J = class {
10629
10639
  return await D(e, async (e) => await this.signData(e, t, n));
10630
10640
  }
10631
10641
  async signHash(e, t) {
10632
- if (typeof t != "boolean" && (t = !1), this._readedKey.keyType == B.WindowsCertStore) return this._signHashWindowsCertificateStore(e, !1, t);
10633
- if (this._readedKey.keyType == B.UmCAService) throw {
10642
+ if (typeof t != "boolean" && (t = !1), this._readedKey.keyType == V.WindowsCertStore) return this._signHashWindowsCertificateStore(e, !1, t);
10643
+ if (this._readedKey.keyType == V.UmCAService) throw {
10634
10644
  code: f.EndUserError.EU_ERROR_NOT_SUPPORTED,
10635
10645
  message: this._resourses.KSPSignFormatError
10636
10646
  };
@@ -10645,20 +10655,17 @@ var J = class {
10645
10655
  async verifyData(e, t, n) {
10646
10656
  Number.isInteger(n) || (n = -1);
10647
10657
  let r = await this._euSign.GetSignContainerInfo(t.val || t);
10648
- if (r.type === f.EndUserConstants.EndUserSignContainerType.ASiC) return await this._euSign.ASiCVerifyData(t, n);
10649
- if (r.type === f.EndUserConstants.EndUserSignContainerType.PAdES) return await this._euSign.PDFVerifyData(t, n);
10658
+ if (r.type === f.EndUserConstants.EndUserSignContainerType.ASiC) return await this._euSign.ASiCVerifyData(t.val || t, n);
10659
+ if (r.type === f.EndUserConstants.EndUserSignContainerType.PAdES) return await this._euSign.PDFVerifyData(t.val || t, n);
10650
10660
  if (r.type === f.EndUserConstants.EndUserSignContainerType.XAdES) return await this._euSign.XAdESVerifyData(e, t.val || t, n);
10651
- if (r.type === f.EndUserConstants.EndUserSignContainerType.CAdES) {
10652
- if (r.subType === f.EndUserConstants.EndUserCAdESType.Detached) {
10653
- if (!e) throw {
10654
- code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10655
- message: this._resourses.BadParameter + " data"
10656
- };
10657
- return await this._euSign.VerifyData(e.val || e, t.val || t, n);
10658
- }
10661
+ if (r.type === f.EndUserConstants.EndUserSignContainerType.CAdES && !e) {
10662
+ if (r.subType === f.EndUserConstants.EndUserCAdESType.Detached) throw {
10663
+ code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10664
+ message: this._resourses.BadParameter + " data"
10665
+ };
10659
10666
  return await this._euSign.VerifyDataInternal(t.val || t, n);
10660
10667
  }
10661
- return await this._euSign.VerifyData(e, t, n);
10668
+ return await this._euSign.VerifyData(e.val || e, t.val || t, n);
10662
10669
  }
10663
10670
  async verifyFile(e, t, n) {
10664
10671
  let [r, i] = await Promise.all([p(e, "binary"), p(t, "binary")]);
@@ -10682,36 +10689,10 @@ var J = class {
10682
10689
  let n = await this.signData(e, t);
10683
10690
  if (Array.isArray(e)) {
10684
10691
  let t = [];
10685
- for (let r = 0; r < n.length; r++) {
10686
- let i = n[r], a = await this.verifyData(e[r].val || e[r], i.val || i);
10687
- Array.isArray(a) && (a = a[a.length - 1]);
10688
- let o = this._readedKey.certificates[0];
10689
- o && (a.ownerInfo.certBeginTime = o.infoEx.certBeginTime, a.ownerInfo.certEndTime = o.infoEx.certEndTime), t[r] = {
10690
- Success: !0,
10691
- Sign: i.val || i,
10692
- SignatureInfo: {
10693
- Success: !0,
10694
- DateTimeStr: a.timeInfo.time,
10695
- Signer: a.ownerInfo.subjCN,
10696
- OwnerInfo: a.ownerInfo
10697
- }
10698
- };
10699
- }
10692
+ for (let r = 0; r < n.length; r++) t[r] = await this._formatSignInfo(e[r], n[r], !1);
10700
10693
  return t;
10701
10694
  }
10702
- {
10703
- let t = await this.verifyData(e.val || e, n.val || n);
10704
- return Array.isArray(t) && (t = t[t.length - 1]), {
10705
- Success: !0,
10706
- Sign: n.val || n,
10707
- SignatureInfo: {
10708
- Success: !0,
10709
- DateTimeStr: t.timeInfo.time,
10710
- Signer: t.ownerInfo.subjCN,
10711
- OwnerInfo: t.ownerInfo
10712
- }
10713
- };
10714
- }
10695
+ return await this._formatSignInfo(e, n);
10715
10696
  }
10716
10697
  async signFileEx(e, t) {
10717
10698
  return await D(e, async (e) => await this.signDataEx(e, t));
@@ -10720,34 +10701,62 @@ var J = class {
10720
10701
  let t = await this.signHash(e);
10721
10702
  if (Array.isArray(e)) {
10722
10703
  let n = [];
10723
- for (let r = 0; r < t.length; r++) {
10724
- let i = t[r], a = await this.verifyHash(e[r].val || e[r], i.val || i);
10725
- Array.isArray(a) && (a = a[a.length - 1]), n[r] = {
10726
- Success: !0,
10727
- Sign: i.val || i,
10728
- SignatureInfo: {
10729
- Success: !0,
10730
- DateTimeStr: a.timeInfo.time,
10731
- Signer: a.ownerInfo.subjCN,
10732
- OwnerInfo: a.ownerInfo
10733
- }
10734
- };
10735
- }
10704
+ for (let r = 0; r < t.length; r++) n[r] = await this._formatSignInfo(e[r], t[r], !0);
10736
10705
  return n;
10737
10706
  }
10738
- {
10739
- let n = await this.verifyHash(e.val || e, t.val || t);
10740
- return Array.isArray(n) && (n = n[n.length - 1]), {
10707
+ return await this._formatSignInfo(e, t, !0);
10708
+ }
10709
+ async _formatSignInfo(e, t, n) {
10710
+ let r = this;
10711
+ return await i(e.val || e, t.val || t);
10712
+ async function i(e, t) {
10713
+ let i;
10714
+ i = n ? await r.verifyHash(e, t) : await r.verifyData(e, t), Array.isArray(i) && (i = i.pop());
10715
+ let o = await a(t);
10716
+ i.ownerInfo.certBeginTime = A(o.certBeginTime), i.ownerInfo.certEndTime = A(o.certEndTime), i.ownerInfo.publicKeyType = o.publicKeyType, i.ownerInfo.keyUsageType = o.keyUsageType, i.ownerInfo.certHashType = r._readedKey.getHashAlgo();
10717
+ let s = i.timeInfo, c = A(s.isSignTimeStampAvail ? s.signTimeStamp : s.time);
10718
+ switch ((s.isSignTimeStampAvail || s.isTimeStamp) && (i.ownerInfo.timestamp = A(s.isSignTimeStampAvail ? s.signTimeStamp : s.time)), r._readedKey.keyType) {
10719
+ case V.File:
10720
+ i.ownerInfo.privateKeyType = "FileKey";
10721
+ break;
10722
+ case V.Token:
10723
+ i.ownerInfo.privateKeyType = "HardwareKey";
10724
+ break;
10725
+ case V.UmCAService:
10726
+ i.ownerInfo.privateKeyType = "UmCAService";
10727
+ break;
10728
+ case V.WindowsCertStore:
10729
+ i.ownerInfo.privateKeyType = "WindowsCertStore";
10730
+ break;
10731
+ case V.KSP: i.ownerInfo.privateKeyType = r._readedKey.ksp.ksp == H.GRYADA ? "GRYADA" : r._readedKey.ksp.id;
10732
+ }
10733
+ return {
10741
10734
  Success: !0,
10742
- Sign: t.val || t,
10735
+ Sign: t,
10743
10736
  SignatureInfo: {
10744
10737
  Success: !0,
10745
- DateTimeStr: n.timeInfo.time,
10746
- Signer: n.ownerInfo.subjCN,
10747
- OwnerInfo: n.ownerInfo
10738
+ DateTimeStr: c,
10739
+ Signer: i.ownerInfo.subjCN,
10740
+ OwnerInfo: i.ownerInfo
10748
10741
  }
10749
10742
  };
10750
10743
  }
10744
+ async function a(e) {
10745
+ let t = await r._euSign.GetSignContainerInfo(e), n;
10746
+ switch (t.type) {
10747
+ case f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES:
10748
+ n = await r._euSign.GetSigner(e);
10749
+ break;
10750
+ case f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_XADES:
10751
+ n = await r._euSign.XAdESGetSigner(e);
10752
+ break;
10753
+ case f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES:
10754
+ n = await r._euSign.PDFGetSigner(e);
10755
+ break;
10756
+ case f.EndUserConstants.EU_SIGN_CONTAINER_TYPE_ASIC: n = await r._euSign.ASiCGetSigner(e);
10757
+ }
10758
+ return Array.isArray(n) && (n = n.pop()), n.infoEx;
10759
+ }
10751
10760
  }
10752
10761
  async _signHashWindowsCertificateStore(e, t, n) {
10753
10762
  if (typeof n != "boolean" && (n = !1), t === !0 ? (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Enveloped, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long) : O(t) && (t = new f.EndUserSignContainerInfo(), t.type = f.EndUserConstants.EndUserSignContainerType.CAdES, t.subType = f.EndUserConstants.EndUserCAdESType.Detached, t.signLevel = f.EndUserConstants.EndUserSignType.CAdES_X_Long), t.type != f.EndUserConstants.EndUserSignContainerType.CAdES) throw {
@@ -10823,7 +10832,7 @@ var J = class {
10823
10832
  return await this._euSign.ProtectTaxReports(e.accountantPrivateKeyContext?.keyContext, Array.isArray(e.directorPrivateKeyContext) ? e.directorPrivateKeyContext.map((e) => e.keyContext) : e.directorPrivateKeyContext?.keyContext, Array.isArray(e.stampPrivateKeyContext) ? e.stampPrivateKeyContext.map((e) => e.keyContext) : e.stampPrivateKeyContext?.keyContext, e.senderEMail, e.recipientCertificate, e.reports, e.returnIntermediateSign);
10824
10833
  }
10825
10834
  async ctxReadHardwareKey(e, t) {
10826
- if (await this.setLibraryType(B.Token), !e) throw {
10835
+ if (await this.setLibraryType(V.Token), !e) throw {
10827
10836
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10828
10837
  message: this._resourses.BadParameter + " keyMedia"
10829
10838
  };
@@ -10833,7 +10842,7 @@ var J = class {
10833
10842
  };
10834
10843
  Array.isArray(t) && t.length > 0 && (t = await Promise.all(t.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)));
10835
10844
  try {
10836
- let n = await this._euSign.CtxCreate(), r = await this._euSign.CtxReadPrivateKey(n, e, t, this._selectedIssuerCN), i = new G(B.Token, r.ownerInfo, await this._euSign.CtxGetOwnCertificates(r), e);
10845
+ let n = await this._euSign.CtxCreate(), r = await this._euSign.CtxReadPrivateKey(n, e, t, this._selectedIssuerCN), i = new K(V.Token, r.ownerInfo, await this._euSign.CtxGetOwnCertificates(r), e);
10837
10846
  return i.context = n, i.keyContext = r, i._glSign = this._glSign, i;
10838
10847
  } catch (e) {
10839
10848
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
@@ -10853,7 +10862,7 @@ var J = class {
10853
10862
  }
10854
10863
  }
10855
10864
  async ctxReadFileKey(e, t, n) {
10856
- if (await this.setLibraryType(B.File), !e) throw {
10865
+ if (await this.setLibraryType(V.File), !e) throw {
10857
10866
  code: f.EndUserError.EU_ERROR_BAD_PARAMETER,
10858
10867
  message: this._resourses.BadParameter + " keyMedia"
10859
10868
  };
@@ -10863,7 +10872,7 @@ var J = class {
10863
10872
  };
10864
10873
  (e instanceof File || e instanceof Blob) && (e = await g(e)), Array.isArray(n) && n.length > 0 && (n = await Promise.all(n.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)));
10865
10874
  try {
10866
- let r = await this._euSign.CtxCreate(), i = await this._euSign.CtxReadPrivateKeyBinary(r, e, t, n, this._selectedIssuerCN), a = new W(B.File, i.ownerInfo, await this._euSign.CtxGetOwnCertificates(i), e, t);
10875
+ let r = await this._euSign.CtxCreate(), i = await this._euSign.CtxReadPrivateKeyBinary(r, e, t, n, this._selectedIssuerCN), a = new G(V.File, i.ownerInfo, await this._euSign.CtxGetOwnCertificates(i), e, t);
10867
10876
  return a.context = r, a.keyContext = i, a._glSign = this._glSign, a;
10868
10877
  } catch (e) {
10869
10878
  if (e && e.code === f.EndUserError.EU_ERROR_CERT_NOT_FOUND) {
@@ -10883,10 +10892,10 @@ var J = class {
10883
10892
  }
10884
10893
  }
10885
10894
  async ctxFreePrivateKey(e) {
10886
- e.keyType === B.Token ? await this.setLibraryType(B.Token) : await this.setLibraryType(B.File), await this._euSign.CtxFreePrivateKey(e.keyContext), await this._euSign.CtxFree(e.context);
10895
+ e.keyType === V.Token ? await this.setLibraryType(V.Token) : await this.setLibraryType(V.File), await this._euSign.CtxFreePrivateKey(e.keyContext), await this._euSign.CtxFree(e.context);
10887
10896
  }
10888
10897
  async getPrivateKeyInfoFromStorage(e, t) {
10889
- let n = (e ? localStorage : sessionStorage)[this._userId + Q], r, i = [];
10898
+ let n = (e ? localStorage : sessionStorage)[this._userId + $], r, i = [];
10890
10899
  if (!n) return i;
10891
10900
  let a = await this._euSignFile.UnprotectDataByPassword(n, "", !0);
10892
10901
  try {
@@ -10896,12 +10905,18 @@ var J = class {
10896
10905
  }
10897
10906
  return r.forEach((e) => {
10898
10907
  let t = e.password;
10899
- e.keyType == B.File ? (e.privateKey = new Uint8Array(Object.assign([], e.privateKey)), e = new W(e.keyType, e.ownerInfo, e.certificates, e.privateKey, e.password)) : e.keyType == B.Token ? e = new G(e.keyType, e.ownerInfo, e.certificates, e.keyMedia) : e.keyType == B.KSP && (e = new K(e.keyType, e.ownerInfo, e.certificates, e.userId, e.ksp, e.keyId));
10908
+ if (e.keyType == V.File) e.privateKey = new Uint8Array(Object.assign([], e.privateKey)), e = new G(e.keyType, e.ownerInfo, e.certificates, e.privateKey, e.password);
10909
+ else if (e.keyType == V.Token) e = new K(e.keyType, e.ownerInfo, e.certificates, e.keyMedia);
10910
+ else if (e.keyType == V.KSP) e = new q(e.keyType, e.ownerInfo, e.certificates, e.userId, e.ksp, e.keyId);
10911
+ else if (e.keyType == V.UmCAService) {
10912
+ let t = e.keyMedia;
10913
+ e = new W(e.keyType, e.ownerInfo, e.certificates, e.visibleName, e.id), e.keyMedia = t;
10914
+ } else e.keyType == V.WindowsCertStore && (e = new W(e.keyType, e.ownerInfo, e.certificates, e.visibleName, e.id));
10900
10915
  let n = [];
10901
10916
  e.certificates.forEach((e) => {
10902
10917
  let t = Object.assign(new f.EndUserCertificate(), e);
10903
10918
  t.data = new Uint8Array(Object.assign([], e.data)), n.push(t);
10904
- }), e.certificates = n, e.password = t, i.push(e);
10919
+ }), e.certificates = n, e.password = t, e._glSign = this._glSign, i.push(e);
10905
10920
  }), i;
10906
10921
  }
10907
10922
  async storePrivateKeyInfo(e, t) {
@@ -10911,7 +10926,7 @@ var J = class {
10911
10926
  let r = await this.getPrivateKeyInfoFromStorage(t);
10912
10927
  r.push(e);
10913
10928
  let i = await this._euSignFile.ProtectDataByPassword(JSON.stringify(r), "", !0);
10914
- n[this._userId + Q] = i;
10929
+ n[this._userId + $] = i;
10915
10930
  }
10916
10931
  }
10917
10932
  async getStoredPrivateKeyInfo(e) {
@@ -10919,25 +10934,25 @@ var J = class {
10919
10934
  return t.concat(n);
10920
10935
  }
10921
10936
  async removeStoredPrivateKeyInfo(e) {
10922
- if (e === void 0) localStorage.removeItem(this._userId + Q), sessionStorage.removeItem(this._userId + Q);
10937
+ if (e === void 0) localStorage.removeItem(this._userId + $), sessionStorage.removeItem(this._userId + $);
10923
10938
  else {
10924
10939
  let t = await this.getPrivateKeyInfoFromStorage(!0), n = await this.getPrivateKeyInfoFromStorage(!1), r = t.filter((t) => t.id == e).length > 0 ? localStorage : sessionStorage, i = r == localStorage ? t : n, a = i.findIndex((t) => t.id == e);
10925
10940
  if (a > -1) {
10926
10941
  i.splice(a, 1);
10927
10942
  let e = await this._euSignFile.ProtectDataByPassword(JSON.stringify(i), "", !0);
10928
- r[this._userId + Q] = e;
10943
+ r[this._userId + $] = e;
10929
10944
  }
10930
10945
  }
10931
10946
  }
10932
10947
  get _preferredKeyType() {
10933
- let e = parseInt(localStorage[this._userId + Z]);
10934
- return typeof e == "number" && e > -1 ? e : (localStorage[this._userId + Z] = B.File, B.File);
10948
+ let e = parseInt(localStorage[this._userId + Q]);
10949
+ return typeof e == "number" && e > -1 ? e : (localStorage[this._userId + Q] = V.File, V.File);
10935
10950
  }
10936
10951
  set _preferredKeyType(e) {
10937
- typeof e == "number" && e > -1 && (localStorage[this._userId + Z] = e);
10952
+ typeof e == "number" && e > -1 && (localStorage[this._userId + Q] = e);
10938
10953
  }
10939
10954
  get _resourses() {
10940
- return X[this._language];
10955
+ return Z[this._language];
10941
10956
  }
10942
10957
  get _userId() {
10943
10958
  return typeof this._settingsProvider.userId == "function" ? this._settingsProvider.userId() : this._settingsProvider.userId;
@@ -10969,6 +10984,6 @@ var J = class {
10969
10984
  }
10970
10985
  };
10971
10986
  //#endregion
10972
- export { $ as DigitalSignature, f as EUSignCP, A as GlSign, j as Models, d as Utils };
10987
+ export { ae as DigitalSignature, f as EUSignCP, j as GlSign, M as Models, d as Utils };
10973
10988
 
10974
10989
  //# sourceMappingURL=it-digital-signature.mjs.map