@it-enterprise/digital-signature 1.2.3 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@it-enterprise/digital-signature",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "digital signature",
5
5
  "private": false,
6
6
  "main": "src/index.js",
@@ -18,4 +18,4 @@
18
18
  "@babel/eslint-parser": "^7.18.9",
19
19
  "eslint": "^7.18.0"
20
20
  }
21
- }
21
+ }
@@ -187,7 +187,7 @@ export default class DigitalSignature {
187
187
  language: this._language,
188
188
  encoding: "UTF-16LE",
189
189
  httpProxyServiceURL: this._settings.httpProxyServiceURL,
190
- directAccess: true,
190
+ directAccess: this._glSign.DirectAccess === true || (this._glSign.DirectAccess !== false && !this._glSign.ApplyProxySettings && !this._glSign.UseProxy),
191
191
  CAs: certificates.CAs,
192
192
  CACertificates: certificates.CACertificates,
193
193
  KSPs: this.KSPs,
@@ -469,7 +469,8 @@ export default class DigitalSignature {
469
469
  ownerInfo,
470
470
  getCerts ? await this._euSign.GetOwnCertificates() : [],
471
471
  userId,
472
- ksp
472
+ ksp,
473
+ keyId
473
474
  );
474
475
  return this._readedKey;
475
476
  }
@@ -958,7 +959,7 @@ export default class DigitalSignature {
958
959
  key = new HardwarePrivateKeyInfo(key.keyType, key.ownerInfo, key.certificates, key.keyMedia);
959
960
  }
960
961
  else if (key.keyType == DigitalSignatureKeyType.KSP) {
961
- key = new KspPrivateKeyInfo(key.keyType, key.ownerInfo, key.certificates, key.userId, key.ksp);
962
+ key = new KspPrivateKeyInfo(key.keyType, key.ownerInfo, key.certificates, key.userId, key.ksp, key.keyId);
962
963
  }
963
964
  const certs = [];
964
965
  key.certificates.forEach(cert => {
package/src/GlSign.js CHANGED
@@ -72,18 +72,25 @@ export default class GlSign {
72
72
  this.TestCAConnection = this._getZoneValue(settingArray, 22) === "+";
73
73
  this.DontSaveToRegistry = this._getZoneValue(settingArray, 23) === "+";
74
74
 
75
- var ksps = this._getZoneValue(settingArray, 24);
75
+ let ksps = this._getZoneValue(settingArray, 24);
76
76
  if (!ksps) {
77
77
  this.KSPs = getDefaultKSPs();
78
78
  } else {
79
- ksps = Buffer.from(ksps, "base64").toString();
80
- this.KSPs = JSON.parse(ksps);
81
- if (this.KSPs.length === 0)
79
+ try {
80
+ ksps = Buffer.from(ksps, "base64").toString();
81
+ this.KSPs = JSON.parse(ksps);
82
+ } catch (error) {
83
+ console.error("error parsing KSPs from GlSign");
84
+ console.error(error);
85
+ }
86
+
87
+ if (!this.KSPs || this.KSPs.length === 0)
82
88
  {
83
89
  this.KSPs = getDefaultKSPs();
84
90
  }
85
- console.log(Buffer.from(JSON.stringify(this.KSPs)).toString("base64"));
86
91
  }
92
+
93
+ this.DirectAccess = this._getSubZoneValue(settingArray, 25) === "+" ? true : this._getSubZoneValue(settingArray, 24) === "-" ? false : null;
87
94
  }
88
95
  _getZoneValue(zones, zone) {
89
96
  if (zones.length >= zone) {
package/src/Models.js CHANGED
@@ -423,10 +423,11 @@ export class KspPrivateKeyInfo extends PrivateKeyInfo {
423
423
  * @param {string} userId - Идентификатор пользователя
424
424
  * @param {EndUserKSP} ksp - Объект KSP
425
425
  */
426
- constructor(keyType, ownerInfo, certificates, userId, ksp) {
426
+ constructor(keyType, ownerInfo, certificates, userId, ksp, keyId) {
427
427
  super(keyType, ownerInfo, certificates, userId, userId);
428
428
  this.userId = userId;
429
429
  this.ksp = ksp;
430
+ this.keyId = keyId;
430
431
  }
431
432
  }
432
433