@it-enterprise/digital-signature 1.4.6 → 1.4.7

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.
@@ -10287,7 +10287,7 @@ var ee = class {
10287
10287
  if (this._euSign === this._euSignFile) return;
10288
10288
  this._euSign = this._euSignFile;
10289
10289
  }
10290
- e != null && e != null && (this._preferredKeyType = e), await this.initialise(), this.keyType = e;
10290
+ e != null && e != null && (this._preferredKeyType = e), this.keyType = e, await this.initialise();
10291
10291
  }
10292
10292
  async initialise() {
10293
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 {
@@ -10406,7 +10406,7 @@ var ee = class {
10406
10406
  switch (await this.setLibraryType(e.keyType), e.keyType) {
10407
10407
  case V.File: return await this.readFileKey(e.privateKey, e.password, e.certificates);
10408
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);
10409
+ case V.KSP: return await this.readPrivateKeyKSP(e.ksp, e.userId, !1, e.keyId);
10410
10410
  case V.UmCAService: return await this.readPrivateKeyUmCAService(e.keyMedia);
10411
10411
  case V.WindowsCertStore: return await this.readWindowsCertStorePrivateKey();
10412
10412
  default: return null;
@@ -10486,14 +10486,14 @@ var ee = class {
10486
10486
  let t = this.KSPs.find((e) => e.id === "DIIA-SIGN");
10487
10487
  return await this.readPrivateKeyKSP(t, null, e);
10488
10488
  }
10489
- async readPrivateKeyKSP(e, t, n = !1, r, i) {
10490
- await this.setLibraryType(V.KSP), e.ksp === f.EndUserConstants.EU_KSP_DIIA && await this._diiaCheckAccess(e);
10491
- let a = await this._euSign.ReadPrivateKeyKSP(t, e.name, n, r, null, i);
10492
- if (n && !a) throw {
10489
+ async readPrivateKeyKSP(e, t, n = !1, r, i, a) {
10490
+ await this.setLibraryType(V.KSP), e.ksp === f.EndUserConstants.EU_KSP_DIIA && await this._diiaCheckAccess(e), a = Array.isArray(a) && a.length > 0 ? await Promise.all(a.map((e) => e instanceof File || e instanceof Blob ? g(e) : e instanceof f.EndUserCertificate ? e.data : e)) : null;
10491
+ let o = await this._euSign.ReadPrivateKeyKSP(t, e.name, n, r, null, i, a);
10492
+ if ((n || a) && !o) throw {
10493
10493
  code: f.EndUserError.EU_ERROR_KEY_MEDIAS_READ_FAILED,
10494
10494
  message: this._resourses.PrivateKeyNotReaded
10495
10495
  };
10496
- return this._readedKey = new q(V.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, o, n || a ? await this._euSign.GetOwnCertificates() : [], t, e, r), this._readedKey._glSign = this._glSign, this._readedKey;
10497
10497
  }
10498
10498
  async getKeyMediasKSP(e, t) {
10499
10499
  return await this.setLibraryType(V.KSP), this._euSign.m_library.m_worker.postMessage("GetKeyMediasKSP", [e, t]);