@it-enterprise/digital-signature 1.4.0 → 1.4.1

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.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "digital signature",
5
5
  "private": false,
6
6
  "main": "src/index.js",
package/src/GlSign.js CHANGED
@@ -104,7 +104,7 @@ export default class GlSign {
104
104
  }
105
105
 
106
106
  this.KSPs.forEach(element => {
107
- if (element.ksp === EndUserKSP.DIIA || element.ksp === EndUserKSP.IIT || element.ksp === EndUserKSP.PB) {
107
+ if (element.ksp === EndUserKSP.DIIA || element.ksp === EndUserKSP.IIT || element.ksp === EndUserKSP.PB || element.ksp === EndUserKSP.VTOKEN) {
108
108
  if (element.address.includes("cabinet.e-life.com.ua")
109
109
  || element.address.includes("sserver.amokey.com")
110
110
  || element.address.includes("smart-sign.dpsu.gov.ua")
package/src/Models.js CHANGED
@@ -370,6 +370,9 @@ export class PrivateKeyInfo {
370
370
  * Является ли ключ цифровой печаткой
371
371
  */
372
372
  isDigitalStamp() {
373
+ if (!Array.isArray(this.certificates) || this.certificates.length === 0) {
374
+ return false;
375
+ }
373
376
  const certificates = this.certificates;
374
377
  for (let certificate = 0; certificate < certificates.length; certificate++) {
375
378
  const infoEx = certificates[certificate].infoEx;
@@ -385,7 +388,7 @@ export class PrivateKeyInfo {
385
388
  * Ключ поддерживает электронную подпись
386
389
  */
387
390
  supportSigning() {
388
- if (this instanceof KspPrivateKeyInfo) {
391
+ if (this.keyType === DigitalSignatureKeyTypeKSP) {
389
392
  return true;
390
393
  }
391
394
 
@@ -403,6 +406,10 @@ export class PrivateKeyInfo {
403
406
  * Ключ поддерживает шифрование
404
407
  */
405
408
  supportEncryption() {
409
+ if (this.keyType === DigitalSignatureKeyTypeKSP) {
410
+ return false;
411
+ }
412
+
406
413
  const certificates = this.certificates;
407
414
  for (let certificate = 0; certificate < certificates.length; certificate++) {
408
415
  const infoEx = certificates[certificate].infoEx;
@@ -611,7 +618,7 @@ export function getDefaultKSPs(allowTest) {
611
618
  ugb.needQRCode = false;
612
619
 
613
620
  const alliance = new KSPSettings();
614
- alliance.id = "alliance";
621
+ alliance.id = "ALLIANCE";
615
622
  alliance.name = "Банк Альянс - хмарний підпис";
616
623
  alliance.ksp = EndUserKSP.VTOKEN;
617
624
  alliance.address = "https://cihsm-api.bankalliance.ua/vtco/api/v1";
@@ -621,7 +628,7 @@ export function getDefaultKSPs(allowTest) {
621
628
  alliance.needQRCode = false;
622
629
 
623
630
  const vtoken = new KSPSettings();
624
- vtoken.id = "vtoken";
631
+ vtoken.id = "VTOKEN";
625
632
  vtoken.name = "Хмарний сервіс Шифр-vToken (тестовий)";
626
633
  vtoken.ksp = EndUserKSP.VTOKEN;
627
634
  vtoken.address = "https://cihsm-dev-api.cipher.com.ua/vtco/api/v1";