@it-enterprise/digital-signature 1.0.1 → 1.1.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/.eslintrc.js CHANGED
@@ -19,7 +19,7 @@ module.exports = {
19
19
  "no-loop-func": ["error"],
20
20
  "no-magic-numbers": ["error", {
21
21
  "ignoreArrayIndexes": true,
22
- "ignore": [0, 1],
22
+ "ignore": [0, 1, -1],
23
23
  "enforceConst": true,
24
24
  "detectObjects": true
25
25
  }],
@@ -30,9 +30,20 @@ module.exports = {
30
30
  "no-sequences": ["error"],
31
31
  "no-unmodified-loop-condition": ["warn"],
32
32
  "no-trailing-spaces": ["warn"],
33
- "block-spacing": ["warn"],
33
+ "block-spacing": ["warn", "always"],
34
34
  "eol-last": ["warn"],
35
35
  "no-var": ["error"],
36
- "no-unused-vars": ["off"]
36
+ "no-unused-vars": ["off"],
37
+ "prefer-const": ["error"],
38
+ "spaced-comment": ["warn"],
39
+ "no-irregular-whitespace": ["warn"],
40
+ "arrow-spacing": ["warn", {
41
+ "before": true,
42
+ "after": true
43
+ }],
44
+ "no-multi-spaces": ["warn"],
45
+ "no-multiple-empty-lines": ["warn"],
46
+ "no-whitespace-before-property": ["warn"],
47
+ "space-before-blocks": ["warn", "always"]
37
48
  }
38
49
  };
@@ -222,6 +222,56 @@ export declare enum EndUserHashAlgo {
222
222
  SHA224,
223
223
  SHA256
224
224
  }
225
+ export declare const EU_ASIC_TYPE_UNKNOWN = 0;
226
+ export declare const EU_ASIC_TYPE_S = 1;
227
+ export declare const EU_ASIC_TYPE_E = 2;
228
+ export declare enum EndUserASiCType {
229
+ Unknown,
230
+ S,
231
+ E
232
+ }
233
+ export declare const EU_ASIC_SIGN_TYPE_UNKNOWN = 0;
234
+ export declare const EU_ASIC_SIGN_TYPE_CADES = 1;
235
+ export declare const EU_ASIC_SIGN_TYPE_XADES = 2;
236
+ export declare enum EndUserASiCSignType {
237
+ Unknown,
238
+ CAdES,
239
+ XAdES
240
+ }
241
+ export declare const EU_ASIC_SIGN_LEVEL_BES = 1;
242
+ export declare const EU_ASIC_SIGN_LEVEL_T = 4;
243
+ export declare const EU_ASIC_SIGN_LEVEL_C = 8;
244
+ export declare const EU_ASIC_SIGN_LEVEL_X_LONG = 16;
245
+ export declare const EU_ASIC_SIGN_LEVEL_X_LONG_TRUSTED = 128;
246
+ export declare enum EndUserASiCSignLevel {
247
+ BES,
248
+ T,
249
+ C,
250
+ X_Long,
251
+ X_Long_Trusted
252
+ }
253
+ export declare const EU_XADES_TYPE_UNKNOWN = 0;
254
+ export declare const EU_XADES_TYPE_DETACHED = 1;
255
+ export declare const EU_XADES_TYPE_ENVELOPING = 2;
256
+ export declare const EU_XADES_TYPE_ENVELOPED = 3;
257
+ export declare enum EndUserXAdESType {
258
+ Unknown,
259
+ Detached,
260
+ Enveloping,
261
+ Enveloped
262
+ }
263
+ export declare const EU_XADES_SIGN_LEVEL_BES = 1;
264
+ export declare const EU_XADES_SIGN_LEVEL_T = 4;
265
+ export declare const EU_XADES_SIGN_LEVEL_C = 8;
266
+ export declare const EU_XADES_SIGN_LEVEL_X_LONG = 16;
267
+ export declare const EU_XADES_SIGN_LEVEL_X_LONG_TRUSTED = 128;
268
+ export declare enum EndUserXAdESSignLevel {
269
+ BES,
270
+ T,
271
+ C,
272
+ X_Long,
273
+ X_Long_Trusted
274
+ }
225
275
  export declare enum EndUserEventType {
226
276
  None = 0,
227
277
  All = 1,
package/euscp/euscp.d.ts CHANGED
@@ -7,7 +7,7 @@ import { EndUserCertificate } from "./EndUserCertificate";
7
7
  import { EndUserKeyMedia } from "./EndUserKeyMedia";
8
8
  import { EndUserJKSPrivateKeyInfo } from "./EndUserJKSPrivateKeyInfo";
9
9
  import { EndUserContext, EndUserPrivateKeyContext } from "./EndUserContexts";
10
- import { EndUserLibraryType, EndUserSignType, EndUserMobileOperatorID, EndUserKSP, EndUserCCSType, EndUserRevocationReason, EndUserKeysType, EndUserKeysLengthDSUA, EndUserKeysLengthKEPUA, EndUserKeysLengthDSRSA, EndUserSignAlgo, EndUserHashAlgo, EndUserEventType } from "./EndUserConstants";
10
+ import { EndUserLibraryType, EndUserSignType, EndUserMobileOperatorID, EndUserKSP, EndUserCCSType, EndUserRevocationReason, EndUserKeysType, EndUserKeysLengthDSUA, EndUserKeysLengthKEPUA, EndUserKeysLengthDSRSA, EndUserSignAlgo, EndUserHashAlgo, EndUserEventType, EndUserASiCType, EndUserASiCSignType, EndUserASiCSignLevel, EndUserXAdESType, EndUserXAdESSignLevel } from "./EndUserConstants";
11
11
  import * as EndUserConstants from "./EndUserConstants";
12
12
  import { EndUserTaxReport, EndUserTaxReceipt } from "./EndUserTaxReports";
13
13
  import { EndUserTimeInfo } from "./EndUserTimeInfo";
@@ -246,6 +246,19 @@ declare class EndUser {
246
246
  key: Uint8Array;
247
247
  requests: Array<EndUserRequestInfo>;
248
248
  }>;
249
+ /**
250
+ * Get key info from key media
251
+ * @param keyMedia The key media.
252
+ * @returns A Promise for the completion of which ever callback is executed.
253
+ */
254
+ GetKeyInfo(keyMedia: EndUserKeyMedia): Promise<Uint8Array>;
255
+ /**
256
+ * Get key info from binary private key
257
+ * @param privateKey The private key in array of bytes.
258
+ * @param password The private key password.
259
+ * @returns A Promise for the completion of which ever callback is executed.
260
+ */
261
+ GetKeyInfoBinary(privateKey: Uint8Array, password: string): Promise<Uint8Array>;
249
262
  /**
250
263
  * Hash data using specified hash algorithm
251
264
  * @param hashAlgo The hash algorithm.
@@ -529,5 +542,81 @@ declare class EndUser {
529
542
  * @returns A Promise for the completion of which ever callback is executed.
530
543
  */
531
544
  UnprotectTaxReceipts(directorOrStampPrivateKeyContext: EndUserPrivateKeyContext, receipts: Array<EndUserTaxReceipt>): Promise<Array<EndUserTaxReceipt>>;
545
+ /**
546
+ * Get signer certificate from ASiC (Associated Signature Container) without signature verification
547
+ * @param asicData The ASiC data value (ASiC data in string will be decoded from BASE64 string).
548
+ * @param signIndex The sign index to get signer certificate. For signIndex = -1, all signers certificates will be returned.
549
+ * @param resolveOIDs The boolean value that specifies whether to resolve OIDs in certificate information.
550
+ * @returns A Promise for the completion of which ever callback is executed.
551
+ */
552
+ ASiCGetSigner(asicData: Uint8Array | string, signIndex?: number, resolveOIDs?: boolean): Promise<EndUserCertificate | Array<EndUserCertificate>>;
553
+ /**
554
+ * Create ASiC (Associated Signature Container) using private key
555
+ * @param signAlgo The algorithm of the signature.
556
+ * @param asicType The ASiC type (ASiC-S or ASiC-E).
557
+ * @param signType The ASiC signature type (CAdES or XAdES).
558
+ * @param signLevel The ASiC signature level (-BES, -T, -C, -X-Long etc).
559
+ * @param references The references of file(s) to sign.
560
+ * @param asBase64String The boolean value that specifies whether to encode a signature into a BASE64 string.
561
+ * @returns A Promise for the completion of which ever callback is executed.
562
+ */
563
+ ASiCSignData(signAlgo: EndUserSignAlgo | number, asicType: EndUserASiCType | number, signType: EndUserASiCSignType | number, signLevel: EndUserASiCSignLevel | number, references: Array<NamedData>, asBase64String: boolean): Promise<NamedData>;
564
+ /**
565
+ * Verify ASiC (Associated Signature Container)
566
+ * @param asicData The ASiC to verify (ASiC in string will be decoded from BASE64 string).
567
+ * @param signIndex The sign index to verify. For signIndex = -1, all signatures will be verified.
568
+ * @returns A Promise for the completion of which ever callback is executed.
569
+ */
570
+ ASiCVerifyData(asicData: Uint8Array | string, signIndex?: number): Promise<EndUserSignInfo | Array<EndUserSignInfo>>;
571
+ /**
572
+ * Get signer certificate from PAdES (PDF Advanced Electronic Signature) without signature verification
573
+ * @param signedPDFData The signed PDF-file data (Data in string will be decoded from BASE64 string).
574
+ * @param signIndex The sign index to get signer certificate. For signIndex = -1, all signers certificates will be returned.
575
+ * @param resolveOIDs The boolean value that specifies whether to resolve OIDs in certificate information.
576
+ * @returns A Promise for the completion of which ever callback is executed.
577
+ */
578
+ PDFGetSigner(signedPDFData: Uint8Array | string, signIndex?: number, resolveOIDs?: boolean): Promise<EndUserCertificate | Array<EndUserCertificate>>;
579
+ /**
580
+ * Create PAdES (PDF Advanced Electronic Signature) using private key
581
+ * @param signAlgo The algorithm of the signature.
582
+ * @param pdfData The PDF-file data to sign.
583
+ * @param signType The signature type.
584
+ * @param asBase64String The boolean value that specifies whether to encode a signature into a BASE64 string.
585
+ * @returns A Promise for the completion of which ever callback is executed.
586
+ */
587
+ PDFSignData(signAlgo: EndUserSignAlgo | number, pdfData: Uint8Array | NamedData | Array<Uint8Array | NamedData>, signType: EndUserSignType | number, asBase64String: boolean): Promise<string | Uint8Array | NamedData | Array<string | Uint8Array | NamedData>>;
588
+ /**
589
+ * Verify PAdES (PDF Advanced Electronic Signature)
590
+ * @param signedPDFData The signed PDF-file data to verify (Data in string will be decoded from BASE64 string).
591
+ * @param signIndex The sign index to verify. For signIndex = -1, all signatures will be verified.
592
+ * @returns A Promise for the completion of which ever callback is executed.
593
+ */
594
+ PDFVerifyData(signedPDFData: Uint8Array | string, signIndex?: number): Promise<EndUserSignInfo | Array<EndUserSignInfo>>;
595
+ /**
596
+ * Get signer certificate from XAdES without signature verification
597
+ * @param xadesData The XAdES data value (XAdES data in string will be decoded from BASE64 string).
598
+ * @param signIndex The sign index to get signer certificate. For signIndex = -1, all signers certificates will be returned.
599
+ * @param resolveOIDs The boolean value that specifies whether to resolve OIDs in certificate information.
600
+ * @returns A Promise for the completion of which ever callback is executed.
601
+ */
602
+ XAdESGetSigner(xadesData: Uint8Array | string, signIndex?: number, resolveOIDs?: boolean): Promise<EndUserCertificate | Array<EndUserCertificate>>;
603
+ /**
604
+ * Create XAdES using private key
605
+ * @param signAlgo The algorithm of the signature.
606
+ * @param xadesType The XAdES type (Detached, Enveloped or Enveloping).
607
+ * @param signLevel The XAdES signature level (-BES, -T, -C, -X-Long etc).
608
+ * @param references The references of file(s) to sign.
609
+ * @param asBase64String The boolean value that specifies whether to encode a signature into a BASE64 string.
610
+ * @returns A Promise for the completion of which ever callback is executed.
611
+ */
612
+ XAdESSignData(signAlgo: EndUserSignAlgo | number, xadesType: EndUserXAdESType | number, signLevel: EndUserXAdESSignLevel | number, references: Array<NamedData>, asBase64String: boolean): Promise<NamedData>;
613
+ /**
614
+ * Verify XAdES
615
+ * @param references The references of file(s) to verify (used for detached signatures).
616
+ * @param xadesData The XAdES to verify (XAdES in string will be decoded from BASE64 string).
617
+ * @param signIndex The sign index to verify. For signIndex = -1, all signatures will be verified.
618
+ * @returns A Promise for the completion of which ever callback is executed.
619
+ */
620
+ XAdESVerifyData(references: Array<NamedData>, xadesData: Uint8Array | string, signIndex?: number): Promise<EndUserSignInfo | Array<EndUserSignInfo>>;
532
621
  }
533
622
  export { NamedData, CASettings, KSPSettings, EndUserError, EndUserConstants, EndUserEvents, EndUserLibraryInfoJS, EndUserLibraryInfoSW, EndUserSettings, EndUserProxySettings, EndUserOwnerInfo, EndUserCertificateInfoEx, EndUserCertificate, EndUserKeyMedia, EndUserJKSPrivateKeyInfo, EndUserContext, EndUserPrivateKeyContext, EndUserTimeInfo, EndUserSignInfo, EndUserSenderInfo, EndUserParams, EndUserInfo, EndUserRequestInfo, EndUserTaxReport, EndUserTaxReceipt, EndUser };