для bower сборка добавлена под версионный контроль для возможности устанавливать пакет напрямую с github

This commit is contained in:
vgoma 2020-03-29 10:05:07 +03:00
parent a3df6e77a8
commit 6d96ca5182
71 changed files with 5554 additions and 2 deletions

2
.gitignore vendored
View File

@ -1,6 +1,4 @@
.idea .idea
node_modules/ node_modules/
lib/
dist/
package/ package/
coverage/ coverage/

22
dist/api/certificate/certificate.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
import { TagTranslation } from '../../helpers/_parseCertInfo';
import { ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';
export declare type CadesCertificate = any;
export declare class Certificate {
_cadesCertificate: CadesCertificate;
name: string;
issuerName: string;
subjectName: string;
thumbprint: string;
validFrom: string;
validTo: string;
constructor(_cadesCertificate: CadesCertificate, name: string, issuerName: string, subjectName: string, thumbprint: string, validFrom: string, validTo: string);
getOwnerInfo(): Promise<TagTranslation[]>;
getIssuerInfo(): Promise<TagTranslation[]>;
getExtendedKeyUsage(): Promise<string[]>;
getDecodedExtendedKeyUsage(): Promise<ExtendedKeysTranslations>;
getAlgorithm(): Promise<string>;
getCadesProp(propName: any): Promise<any>;
isValid(): Promise<boolean>;
exportBase64(): Promise<string>;
hasExtendedKeyUsage(oids: any): Promise<boolean>;
}

View File

@ -0,0 +1,6 @@
/**
* Экспортирует сертификат в формате base64
*
* @returns сертификат в формате base64
*/
export declare const exportBase64: () => Promise<string>;

11
dist/api/certificate/getAlgorithm.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
interface AlgorithmInfo {
algorithm: string;
oid: string;
}
/**
* Возвращает информацию об алгоритме сертификата
*
* @returns информацию об алгоритме и его OID'е
*/
export declare const getAlgorithm: () => Promise<AlgorithmInfo>;
export {};

View File

@ -0,0 +1,7 @@
/**
* Возвращает указанное внутренее свойство у сертификата в формате Cades
*
* @param propName = наименование свойства
* @returns значение запрошенного свойства
*/
export declare const getCadesProp: (propName: string) => Promise<any>;

View File

@ -0,0 +1,9 @@
export interface ExtendedKeysTranslations {
[key: string]: string | null;
}
/**
* Возвращает расшифрованные ОИД'ы сертификата
*
* @returns словарь расшифрованных ОИД'ов
*/
export declare const getDecodedExtendedKeyUsage: () => Promise<ExtendedKeysTranslations>;

View File

@ -0,0 +1,6 @@
/**
* Возвращает ОИД'ы сертификата
*
* @returns список ОИД'ов
*/
export declare const getExtendedKeyUsage: () => Promise<string[]>;

10
dist/api/certificate/getInfo.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import { TagsTranslations } from '../../constants/tags-translations';
import { TagTranslation } from '../../helpers/_parseCertInfo';
/**
* Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам
*
* @param tags = словарь
* @param entitiesPath = путь к разбираемой сущности
* @returns расшифрованная информация по отдельным тэгам
*/
export declare const getInfo: (tags: TagsTranslations[], entitiesPath: string) => Promise<TagTranslation[]>;

View File

@ -0,0 +1,7 @@
/**
* Проверяет наличие ОИД'а (ОИД'ов) у сертификата
*
* @param oids - ОИД'ы для проверки
* @returns флаг наличия ОИД'ов у сертификата
*/
export declare const hasExtendedKeyUsage: (oids: string | string[]) => Promise<boolean>;

1
dist/api/certificate/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './certificate';

6
dist/api/certificate/isValid.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Проверяет действительность сертификата
*
* @returns флаг валидности
*/
export declare const isValid: () => Promise<boolean>;

9
dist/api/createSignature.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/**
* Создает подпись base64 строки по отпечатку сертификата
*
* @param thumbprint - отпечаток сертификата
* @param dataBase64 - строковые данные в формате base64
* @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)
* @returns подпись
*/
export declare const createSignature: (thumbprint: string, dataBase64: string, detachedSignature?: boolean) => Promise<string>;

8
dist/api/getCertificate.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import { Certificate } from './certificate';
/**
* Возвращает сертификат по отпечатку
*
* @param thumbprint - отпечаток сертификата
* @returns сертификат
*/
export declare const getCertificate: (thumbprint: string) => Promise<Certificate>;

10
dist/api/getSystemInfo.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export interface SystemInfo {
cadesVersion: string;
cspVersion: string;
}
/**
* Предоставляет информацию о системе
*
* @returns информацию о CSP и плагине
*/
export declare const getSystemInfo: () => Promise<SystemInfo>;

8
dist/api/getUserCertificates.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import { Certificate } from './certificate';
/**
* Возвращает список сертификатов, доступных пользователю в системе
*
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
* @returns список сертификатов
*/
export declare const getUserCertificates: (resetCache?: boolean) => Promise<Certificate[]>;

6
dist/api/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export * from './getCertificate';
export * from './getUserCertificates';
export * from './getSystemInfo';
export * from './isValidSystemSetup';
export * from './createSignature';
export * from './certificate';

6
dist/api/isValidSystemSetup.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Проверяет корректность настроек ЭП на машине
*
* @returns флаг корректности настроек
*/
export declare const isValidSystemSetup: () => Promise<boolean>;

149
dist/constants/cades-constants.d.ts vendored Normal file
View File

@ -0,0 +1,149 @@
export declare const CADESCOM_ATTRIBUTE_OTHER = -1;
export declare const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;
export declare const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
export declare const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
export declare const CADESCOM_AllowNoOutstandingRequest = 1;
export declare const CADESCOM_AllowNone = 0;
export declare const CADESCOM_AllowUntrustedCertificate = 2;
export declare const CADESCOM_AllowUntrustedRoot = 4;
export declare const CADESCOM_BASE64_TO_BINARY = 1;
export declare const CADESCOM_CADES_BES = 1;
export declare const CADESCOM_CADES_DEFAULT = 0;
export declare const CADESCOM_CADES_T = 5;
export declare const CADESCOM_CADES_X_LONG_TYPE_1 = 93;
export declare const CADESCOM_CONTAINER_STORE = 100;
export declare const CADESCOM_CURRENT_USER_STORE = 2;
export declare const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;
export declare const CADESCOM_DISPLAY_DATA_CONTENT = 1;
export declare const CADESCOM_DISPLAY_DATA_NONE = 0;
export declare const CADESCOM_ENCODE_ANY = -1;
export declare const CADESCOM_ENCODE_BASE64 = 0;
export declare const CADESCOM_ENCODE_BINARY = 1;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;
export declare const CADESCOM_HASH_ALGORITHM_MD2 = 1;
export declare const CADESCOM_HASH_ALGORITHM_MD4 = 2;
export declare const CADESCOM_HASH_ALGORITHM_MD5 = 3;
export declare const CADESCOM_HASH_ALGORITHM_SHA1 = 0;
export declare const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;
export declare const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;
export declare const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;
export declare const CADESCOM_LOCAL_MACHINE_STORE = 1;
export declare const CADESCOM_PKCS7_TYPE = 65535;
export declare const CADESCOM_STRING_TO_UCS2LE = 0;
export declare const CADESCOM_SkipInstallToStore = 268435456;
export declare const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;
export declare const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;
export declare const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;
export declare const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;
export declare const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;
export declare const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
export declare const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
export declare const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;
export declare const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;
export declare const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;
export declare const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;
export declare const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;
export declare const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;
export declare const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;
export declare const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;
export declare const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;
export declare const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;
export declare const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;
export declare const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;
export declare const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;
export declare const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;
export declare const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;
export declare const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;
export declare const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;
export declare const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;
export declare const CAPICOM_CURRENT_USER_STORE = 2;
export declare const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;
export declare const CAPICOM_EKU_CLIENT_AUTH = 2;
export declare const CAPICOM_EKU_OTHER = 0;
export declare const CAPICOM_EKU_SMARTCARD_LOGON = 5;
export declare const CAPICOM_LOCAL_MACHINE_STORE = 1;
export declare const CAPICOM_MEMORY_STORE = 0;
export declare const CAPICOM_MY_STORE = "My";
export declare const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;
export declare const CAPICOM_OID_OTHER = 0;
export declare const CAPICOM_PROPID_ACCESS_STATE = 14;
export declare const CAPICOM_PROPID_ARCHIVED = 19;
export declare const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;
export declare const CAPICOM_PROPID_AUTO_ENROLL = 21;
export declare const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;
export declare const CAPICOM_PROPID_CTL_USAGE = 9;
export declare const CAPICOM_PROPID_DATE_STAMP = 27;
export declare const CAPICOM_PROPID_DESCRIPTION = 13;
export declare const CAPICOM_PROPID_EFS = 17;
export declare const CAPICOM_PROPID_ENHKEY_USAGE = 9;
export declare const CAPICOM_PROPID_ENROLLMENT = 26;
export declare const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;
export declare const CAPICOM_PROPID_FIRST_RESERVED = 66;
export declare const CAPICOM_PROPID_FIRST_USER = 32768;
export declare const CAPICOM_PROPID_FORTEZZA_DATA = 18;
export declare const CAPICOM_PROPID_FRIENDLY_NAME = 11;
export declare const CAPICOM_PROPID_HASH_PROP = 3;
export declare const CAPICOM_PROPID_IE30_RESERVED = 7;
export declare const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;
export declare const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;
export declare const CAPICOM_PROPID_KEY_CONTEXT = 5;
export declare const CAPICOM_PROPID_KEY_IDENTIFIER = 20;
export declare const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;
export declare const CAPICOM_PROPID_KEY_PROV_INFO = 2;
export declare const CAPICOM_PROPID_KEY_SPEC = 6;
export declare const CAPICOM_PROPID_LAST_RESERVED = 32767;
export declare const CAPICOM_PROPID_LAST_USER = 65535;
export declare const CAPICOM_PROPID_MD5_HASH = 4;
export declare const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;
export declare const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;
export declare const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;
export declare const CAPICOM_PROPID_PVK_FILE = 12;
export declare const CAPICOM_PROPID_RENEWAL = 64;
export declare const CAPICOM_PROPID_SHA1_HASH = 3;
export declare const CAPICOM_PROPID_SIGNATURE_HASH = 15;
export declare const CAPICOM_PROPID_SMART_CARD_DATA = 16;
export declare const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;
export declare const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;
export declare const CAPICOM_PROPID_UNKNOWN = 0;
export declare const CAPICOM_SMART_CARD_USER_STORE = 4;
export declare const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;
export declare const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;
export declare const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;
export declare const CAPICOM_STORE_OPEN_READ_ONLY = 0;
export declare const CAPICOM_STORE_OPEN_READ_WRITE = 1;
export declare const CHECK_NONE = 0;
export declare const CHECK_OFFLINE_REVOCATION_STATUS = 16;
export declare const CHECK_ONLINE_REVOCATION_STATUS = 8;
export declare const CHECK_SIGNATURE_VALIDITY = 4;
export declare const CHECK_TIME_VALIDITY = 2;
export declare const CHECK_TRUSTED_ROOT = 1;
export declare const LOG_LEVEL_DEBUG = 4;
export declare const LOG_LEVEL_ERROR = 1;
export declare const LOG_LEVEL_INFO = 2;
export declare const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;
export declare const TRUST_CTL_IS_NOT_TIME_VALID = 131072;
export declare const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;
export declare const TRUST_IS_CYCLIC = 128;
export declare const TRUST_IS_NOT_SIGNATURE_VALID = 8;
export declare const TRUST_IS_NOT_TIME_NESTED = 2;
export declare const TRUST_IS_NOT_TIME_VALID = 1;
export declare const TRUST_IS_NOT_VALID_FOR_USAGE = 16;
export declare const TRUST_IS_PARTIAL_CHAIN = 65536;
export declare const TRUST_IS_REVOKED = 4;
export declare const TRUST_IS_UNTRUSTED_ROOT = 32;
export declare const TRUST_REVOCATION_STATUS_UNKNOWN = 64;
export declare const XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411";
export declare const XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
export declare const XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411";
export declare const XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411";

4
dist/constants/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export * from './cades-constants';
export * from './issuer-tags-translations';
export * from './oids-dictionary';
export * from './subject-tags-translations';

View File

@ -0,0 +1,2 @@
import { TagsTranslations } from './tags-translations';
export declare const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[];

44
dist/constants/oids-dictionary.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
export declare const OIDS_DICTIONARY: {
'1.2.643.2.2.34.6': string;
'1.2.643.2.39.1.1': string;
'1.2.643.3.131.1.1': string;
'1.2.643.3.141.1.1': string;
'1.2.643.3.141.1.2': string;
'1.2.643.3.2.100.65.13.11': string;
'1.2.643.3.8.100.1': string;
'1.2.643.3.8.100.1.1': string;
'1.2.643.3.8.100.1.10': string;
'1.2.643.3.8.100.1.11': string;
'1.2.643.3.8.100.1.12': string;
'1.2.643.3.8.100.1.13': string;
'1.2.643.3.8.100.1.14': string;
'1.2.643.3.8.100.1.2': string;
'1.2.643.3.8.100.1.3': string;
'1.2.643.3.8.100.1.4': string;
'1.2.643.3.8.100.1.5': string;
'1.2.643.3.8.100.1.6': string;
'1.2.643.3.8.100.1.7': string;
'1.2.643.3.8.100.1.8': string;
'1.2.643.3.8.100.1.9': string;
'1.2.643.5.1.24.2.1.3': string;
'1.2.643.5.1.24.2.1.3.1': string;
'1.2.643.5.1.24.2.2.2': string;
'1.2.643.5.1.24.2.2.3': string;
'1.2.643.6.2.1.7.1': string;
'1.2.643.6.2.1.7.2': string;
'1.2.643.6.3': string;
'1.2.643.6.3.1.1': string;
'1.2.643.6.3.1.2.1': string;
'1.2.643.6.3.1.2.2': string;
'1.2.643.6.3.1.2.3': string;
'1.2.643.6.3.1.3.1': string;
'1.2.643.6.3.1.4.1': string;
'1.2.643.6.3.1.4.2': string;
'1.2.643.6.3.1.4.3': string;
'1.2.840.113549.1.9.2': string;
'1.3.6.1.4.1.24138.1.1.8.1': string;
'1.3.6.1.4.1.29919.21': string;
'1.3.6.1.5.5.7.3.2': string;
'1.3.6.1.5.5.7.3.4': string;
'1.3.643.3.8.100.15': string;
};

View File

@ -0,0 +1,2 @@
import { TagsTranslations } from './tags-translations';
export declare const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[];

4
dist/constants/tags-translations.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export interface TagsTranslations {
possibleNames: string[];
translation: string;
}

7
dist/crypto-pro.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
// Type definitions for crypto-pro 2.0.0
// Project: crypto-pro
// Definitions by: Vitalii Goma https://github.com/vgoma
export as namespace cryptoPro;
export * from './api';

2530
dist/crypto-pro.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
dist/crypto-pro.js.map vendored Normal file

File diff suppressed because one or more lines are too long

2
dist/crypto-pro.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/crypto-pro.min.js.map vendored Normal file

File diff suppressed because one or more lines are too long

3
dist/helpers/_afterPluginsLoaded.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare type Unpromisify<T> = T extends Promise<infer R> ? R : T;
export declare const _afterPluginsLoaded: <T extends (...args: any[]) => any>(fn: T) => (...args: Parameters<T>) => Promise<Unpromisify<ReturnType<T>>>;
export {};

1
dist/helpers/_extractCommonName.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare const _extractCommonName: (subjectName: string) => string;

View File

@ -0,0 +1 @@
export declare const _extractMeaningfulErrorMessage: (error: Error) => string;

3
dist/helpers/_generateCadesFn.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare const __cadesAsyncToken__: {};
export declare const __createCadesPluginObject__: (...args: any[]) => any;
export declare const _generateCadesFn: (callback: Function) => string;

7
dist/helpers/_getCadesCert.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
/**
* Возвращает сертификат в формате Cades по отпечатку
*
* @param thumbprint - отпечаток сертификата
* @returns сертификат в формате Cades
*/
export declare const _getCadesCert: (thumbprint: string) => Promise<any>;

7
dist/helpers/_getDateObj.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
/**
* Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.
*
* В IE необходимо использовать специфичный формат "VT_DATE"
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate
*/
export declare const _getDateObj: (dateObj: any) => Date;

View File

@ -0,0 +1 @@
export declare const _isSupportedCSPVersion: (version: string) => boolean;

View File

@ -0,0 +1 @@
export declare const _isSupportedCadesVersion: (version: string) => boolean;

14
dist/helpers/_parseCertInfo.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import { TagsTranslations } from '../constants/tags-translations';
export interface TagTranslation {
description: string;
title: string;
isTranslated: boolean;
}
/**
* Парсит информацию из строки с информацией о сертификате
*
* @param tagsTranslations - словарь с расшифровками тэгов
* @param rawInfo - данные для парсинга
* @returns расшифрованная информация по отдельным тэгам
*/
export declare const _parseCertInfo: (tagsTranslations: TagsTranslations[], rawInfo: string) => TagTranslation[];

22
lib/api/certificate/certificate.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
import { TagTranslation } from '../../helpers/_parseCertInfo';
import { ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';
export declare type CadesCertificate = any;
export declare class Certificate {
_cadesCertificate: CadesCertificate;
name: string;
issuerName: string;
subjectName: string;
thumbprint: string;
validFrom: string;
validTo: string;
constructor(_cadesCertificate: CadesCertificate, name: string, issuerName: string, subjectName: string, thumbprint: string, validFrom: string, validTo: string);
getOwnerInfo(): Promise<TagTranslation[]>;
getIssuerInfo(): Promise<TagTranslation[]>;
getExtendedKeyUsage(): Promise<string[]>;
getDecodedExtendedKeyUsage(): Promise<ExtendedKeysTranslations>;
getAlgorithm(): Promise<string>;
getCadesProp(propName: any): Promise<any>;
isValid(): Promise<boolean>;
exportBase64(): Promise<string>;
hasExtendedKeyUsage(oids: any): Promise<boolean>;
}

6
lib/api/certificate/exportBase64.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Экспортирует сертификат в формате base64
*
* @returns сертификат в формате base64
*/
export declare const exportBase64: () => Promise<string>;

11
lib/api/certificate/getAlgorithm.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
interface AlgorithmInfo {
algorithm: string;
oid: string;
}
/**
* Возвращает информацию об алгоритме сертификата
*
* @returns информацию об алгоритме и его OID'е
*/
export declare const getAlgorithm: () => Promise<AlgorithmInfo>;
export {};

7
lib/api/certificate/getCadesProp.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
/**
* Возвращает указанное внутренее свойство у сертификата в формате Cades
*
* @param propName = наименование свойства
* @returns значение запрошенного свойства
*/
export declare const getCadesProp: (propName: string) => Promise<any>;

View File

@ -0,0 +1,9 @@
export interface ExtendedKeysTranslations {
[key: string]: string | null;
}
/**
* Возвращает расшифрованные ОИД'ы сертификата
*
* @returns словарь расшифрованных ОИД'ов
*/
export declare const getDecodedExtendedKeyUsage: () => Promise<ExtendedKeysTranslations>;

View File

@ -0,0 +1,6 @@
/**
* Возвращает ОИД'ы сертификата
*
* @returns список ОИД'ов
*/
export declare const getExtendedKeyUsage: () => Promise<string[]>;

10
lib/api/certificate/getInfo.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
import { TagsTranslations } from '../../constants/tags-translations';
import { TagTranslation } from '../../helpers/_parseCertInfo';
/**
* Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам
*
* @param tags = словарь
* @param entitiesPath = путь к разбираемой сущности
* @returns расшифрованная информация по отдельным тэгам
*/
export declare const getInfo: (tags: TagsTranslations[], entitiesPath: string) => Promise<TagTranslation[]>;

View File

@ -0,0 +1,7 @@
/**
* Проверяет наличие ОИД'а (ОИД'ов) у сертификата
*
* @param oids - ОИД'ы для проверки
* @returns флаг наличия ОИД'ов у сертификата
*/
export declare const hasExtendedKeyUsage: (oids: string | string[]) => Promise<boolean>;

1
lib/api/certificate/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export * from './certificate';

6
lib/api/certificate/isValid.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Проверяет действительность сертификата
*
* @returns флаг валидности
*/
export declare const isValid: () => Promise<boolean>;

9
lib/api/createSignature.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/**
* Создает подпись base64 строки по отпечатку сертификата
*
* @param thumbprint - отпечаток сертификата
* @param dataBase64 - строковые данные в формате base64
* @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)
* @returns подпись
*/
export declare const createSignature: (thumbprint: string, dataBase64: string, detachedSignature?: boolean) => Promise<string>;

8
lib/api/getCertificate.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import { Certificate } from './certificate';
/**
* Возвращает сертификат по отпечатку
*
* @param thumbprint - отпечаток сертификата
* @returns сертификат
*/
export declare const getCertificate: (thumbprint: string) => Promise<Certificate>;

10
lib/api/getSystemInfo.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export interface SystemInfo {
cadesVersion: string;
cspVersion: string;
}
/**
* Предоставляет информацию о системе
*
* @returns информацию о CSP и плагине
*/
export declare const getSystemInfo: () => Promise<SystemInfo>;

8
lib/api/getUserCertificates.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import { Certificate } from './certificate';
/**
* Возвращает список сертификатов, доступных пользователю в системе
*
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
* @returns список сертификатов
*/
export declare const getUserCertificates: (resetCache?: boolean) => Promise<Certificate[]>;

6
lib/api/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export * from './getCertificate';
export * from './getUserCertificates';
export * from './getSystemInfo';
export * from './isValidSystemSetup';
export * from './createSignature';
export * from './certificate';

6
lib/api/isValidSystemSetup.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/**
* Проверяет корректность настроек ЭП на машине
*
* @returns флаг корректности настроек
*/
export declare const isValidSystemSetup: () => Promise<boolean>;

149
lib/constants/cades-constants.d.ts vendored Normal file
View File

@ -0,0 +1,149 @@
export declare const CADESCOM_ATTRIBUTE_OTHER = -1;
export declare const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;
export declare const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
export declare const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
export declare const CADESCOM_AllowNoOutstandingRequest = 1;
export declare const CADESCOM_AllowNone = 0;
export declare const CADESCOM_AllowUntrustedCertificate = 2;
export declare const CADESCOM_AllowUntrustedRoot = 4;
export declare const CADESCOM_BASE64_TO_BINARY = 1;
export declare const CADESCOM_CADES_BES = 1;
export declare const CADESCOM_CADES_DEFAULT = 0;
export declare const CADESCOM_CADES_T = 5;
export declare const CADESCOM_CADES_X_LONG_TYPE_1 = 93;
export declare const CADESCOM_CONTAINER_STORE = 100;
export declare const CADESCOM_CURRENT_USER_STORE = 2;
export declare const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;
export declare const CADESCOM_DISPLAY_DATA_CONTENT = 1;
export declare const CADESCOM_DISPLAY_DATA_NONE = 0;
export declare const CADESCOM_ENCODE_ANY = -1;
export declare const CADESCOM_ENCODE_BASE64 = 0;
export declare const CADESCOM_ENCODE_BINARY = 1;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;
export declare const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;
export declare const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;
export declare const CADESCOM_HASH_ALGORITHM_MD2 = 1;
export declare const CADESCOM_HASH_ALGORITHM_MD4 = 2;
export declare const CADESCOM_HASH_ALGORITHM_MD5 = 3;
export declare const CADESCOM_HASH_ALGORITHM_SHA1 = 0;
export declare const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;
export declare const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;
export declare const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;
export declare const CADESCOM_LOCAL_MACHINE_STORE = 1;
export declare const CADESCOM_PKCS7_TYPE = 65535;
export declare const CADESCOM_STRING_TO_UCS2LE = 0;
export declare const CADESCOM_SkipInstallToStore = 268435456;
export declare const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;
export declare const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;
export declare const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;
export declare const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;
export declare const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;
export declare const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
export declare const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
export declare const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;
export declare const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;
export declare const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;
export declare const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;
export declare const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;
export declare const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;
export declare const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;
export declare const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;
export declare const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;
export declare const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;
export declare const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;
export declare const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;
export declare const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;
export declare const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;
export declare const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;
export declare const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;
export declare const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;
export declare const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;
export declare const CAPICOM_CURRENT_USER_STORE = 2;
export declare const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;
export declare const CAPICOM_EKU_CLIENT_AUTH = 2;
export declare const CAPICOM_EKU_OTHER = 0;
export declare const CAPICOM_EKU_SMARTCARD_LOGON = 5;
export declare const CAPICOM_LOCAL_MACHINE_STORE = 1;
export declare const CAPICOM_MEMORY_STORE = 0;
export declare const CAPICOM_MY_STORE = "My";
export declare const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;
export declare const CAPICOM_OID_OTHER = 0;
export declare const CAPICOM_PROPID_ACCESS_STATE = 14;
export declare const CAPICOM_PROPID_ARCHIVED = 19;
export declare const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;
export declare const CAPICOM_PROPID_AUTO_ENROLL = 21;
export declare const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;
export declare const CAPICOM_PROPID_CTL_USAGE = 9;
export declare const CAPICOM_PROPID_DATE_STAMP = 27;
export declare const CAPICOM_PROPID_DESCRIPTION = 13;
export declare const CAPICOM_PROPID_EFS = 17;
export declare const CAPICOM_PROPID_ENHKEY_USAGE = 9;
export declare const CAPICOM_PROPID_ENROLLMENT = 26;
export declare const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;
export declare const CAPICOM_PROPID_FIRST_RESERVED = 66;
export declare const CAPICOM_PROPID_FIRST_USER = 32768;
export declare const CAPICOM_PROPID_FORTEZZA_DATA = 18;
export declare const CAPICOM_PROPID_FRIENDLY_NAME = 11;
export declare const CAPICOM_PROPID_HASH_PROP = 3;
export declare const CAPICOM_PROPID_IE30_RESERVED = 7;
export declare const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;
export declare const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;
export declare const CAPICOM_PROPID_KEY_CONTEXT = 5;
export declare const CAPICOM_PROPID_KEY_IDENTIFIER = 20;
export declare const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;
export declare const CAPICOM_PROPID_KEY_PROV_INFO = 2;
export declare const CAPICOM_PROPID_KEY_SPEC = 6;
export declare const CAPICOM_PROPID_LAST_RESERVED = 32767;
export declare const CAPICOM_PROPID_LAST_USER = 65535;
export declare const CAPICOM_PROPID_MD5_HASH = 4;
export declare const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;
export declare const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;
export declare const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;
export declare const CAPICOM_PROPID_PVK_FILE = 12;
export declare const CAPICOM_PROPID_RENEWAL = 64;
export declare const CAPICOM_PROPID_SHA1_HASH = 3;
export declare const CAPICOM_PROPID_SIGNATURE_HASH = 15;
export declare const CAPICOM_PROPID_SMART_CARD_DATA = 16;
export declare const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;
export declare const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;
export declare const CAPICOM_PROPID_UNKNOWN = 0;
export declare const CAPICOM_SMART_CARD_USER_STORE = 4;
export declare const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;
export declare const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;
export declare const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;
export declare const CAPICOM_STORE_OPEN_READ_ONLY = 0;
export declare const CAPICOM_STORE_OPEN_READ_WRITE = 1;
export declare const CHECK_NONE = 0;
export declare const CHECK_OFFLINE_REVOCATION_STATUS = 16;
export declare const CHECK_ONLINE_REVOCATION_STATUS = 8;
export declare const CHECK_SIGNATURE_VALIDITY = 4;
export declare const CHECK_TIME_VALIDITY = 2;
export declare const CHECK_TRUSTED_ROOT = 1;
export declare const LOG_LEVEL_DEBUG = 4;
export declare const LOG_LEVEL_ERROR = 1;
export declare const LOG_LEVEL_INFO = 2;
export declare const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;
export declare const TRUST_CTL_IS_NOT_TIME_VALID = 131072;
export declare const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;
export declare const TRUST_IS_CYCLIC = 128;
export declare const TRUST_IS_NOT_SIGNATURE_VALID = 8;
export declare const TRUST_IS_NOT_TIME_NESTED = 2;
export declare const TRUST_IS_NOT_TIME_VALID = 1;
export declare const TRUST_IS_NOT_VALID_FOR_USAGE = 16;
export declare const TRUST_IS_PARTIAL_CHAIN = 65536;
export declare const TRUST_IS_REVOKED = 4;
export declare const TRUST_IS_UNTRUSTED_ROOT = 32;
export declare const TRUST_REVOCATION_STATUS_UNKNOWN = 64;
export declare const XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411";
export declare const XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
export declare const XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411";
export declare const XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411";

4
lib/constants/index.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export * from './cades-constants';
export * from './issuer-tags-translations';
export * from './oids-dictionary';
export * from './subject-tags-translations';

View File

@ -0,0 +1,2 @@
import { TagsTranslations } from './tags-translations';
export declare const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[];

44
lib/constants/oids-dictionary.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
export declare const OIDS_DICTIONARY: {
'1.2.643.2.2.34.6': string;
'1.2.643.2.39.1.1': string;
'1.2.643.3.131.1.1': string;
'1.2.643.3.141.1.1': string;
'1.2.643.3.141.1.2': string;
'1.2.643.3.2.100.65.13.11': string;
'1.2.643.3.8.100.1': string;
'1.2.643.3.8.100.1.1': string;
'1.2.643.3.8.100.1.10': string;
'1.2.643.3.8.100.1.11': string;
'1.2.643.3.8.100.1.12': string;
'1.2.643.3.8.100.1.13': string;
'1.2.643.3.8.100.1.14': string;
'1.2.643.3.8.100.1.2': string;
'1.2.643.3.8.100.1.3': string;
'1.2.643.3.8.100.1.4': string;
'1.2.643.3.8.100.1.5': string;
'1.2.643.3.8.100.1.6': string;
'1.2.643.3.8.100.1.7': string;
'1.2.643.3.8.100.1.8': string;
'1.2.643.3.8.100.1.9': string;
'1.2.643.5.1.24.2.1.3': string;
'1.2.643.5.1.24.2.1.3.1': string;
'1.2.643.5.1.24.2.2.2': string;
'1.2.643.5.1.24.2.2.3': string;
'1.2.643.6.2.1.7.1': string;
'1.2.643.6.2.1.7.2': string;
'1.2.643.6.3': string;
'1.2.643.6.3.1.1': string;
'1.2.643.6.3.1.2.1': string;
'1.2.643.6.3.1.2.2': string;
'1.2.643.6.3.1.2.3': string;
'1.2.643.6.3.1.3.1': string;
'1.2.643.6.3.1.4.1': string;
'1.2.643.6.3.1.4.2': string;
'1.2.643.6.3.1.4.3': string;
'1.2.840.113549.1.9.2': string;
'1.3.6.1.4.1.24138.1.1.8.1': string;
'1.3.6.1.4.1.29919.21': string;
'1.3.6.1.5.5.7.3.2': string;
'1.3.6.1.5.5.7.3.4': string;
'1.3.643.3.8.100.15': string;
};

View File

@ -0,0 +1,2 @@
import { TagsTranslations } from './tags-translations';
export declare const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[];

4
lib/constants/tags-translations.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export interface TagsTranslations {
possibleNames: string[];
translation: string;
}

5
lib/crypto-pro.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
// Type definitions for crypto-pro 2.0.0
// Project: crypto-pro
// Definitions by: Vitalii Goma https://github.com/vgoma
export * from './api';

2257
lib/crypto-pro.js Normal file

File diff suppressed because it is too large Load Diff

1
lib/crypto-pro.js.map Normal file

File diff suppressed because one or more lines are too long

3
lib/helpers/_afterPluginsLoaded.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
declare type Unpromisify<T> = T extends Promise<infer R> ? R : T;
export declare const _afterPluginsLoaded: <T extends (...args: any[]) => any>(fn: T) => (...args: Parameters<T>) => Promise<Unpromisify<ReturnType<T>>>;
export {};

1
lib/helpers/_extractCommonName.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare const _extractCommonName: (subjectName: string) => string;

View File

@ -0,0 +1 @@
export declare const _extractMeaningfulErrorMessage: (error: Error) => string;

3
lib/helpers/_generateCadesFn.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare const __cadesAsyncToken__: {};
export declare const __createCadesPluginObject__: (...args: any[]) => any;
export declare const _generateCadesFn: (callback: Function) => string;

7
lib/helpers/_getCadesCert.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
/**
* Возвращает сертификат в формате Cades по отпечатку
*
* @param thumbprint - отпечаток сертификата
* @returns сертификат в формате Cades
*/
export declare const _getCadesCert: (thumbprint: string) => Promise<any>;

7
lib/helpers/_getDateObj.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
/**
* Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.
*
* В IE необходимо использовать специфичный формат "VT_DATE"
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate
*/
export declare const _getDateObj: (dateObj: any) => Date;

View File

@ -0,0 +1 @@
export declare const _isSupportedCSPVersion: (version: string) => boolean;

View File

@ -0,0 +1 @@
export declare const _isSupportedCadesVersion: (version: string) => boolean;

14
lib/helpers/_parseCertInfo.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import { TagsTranslations } from '../constants/tags-translations';
export interface TagTranslation {
description: string;
title: string;
isTranslated: boolean;
}
/**
* Парсит информацию из строки с информацией о сертификате
*
* @param tagsTranslations - словарь с расшифровками тэгов
* @param rawInfo - данные для парсинга
* @returns расшифрованная информация по отдельным тэгам
*/
export declare const _parseCertInfo: (tagsTranslations: TagsTranslations[], rawInfo: string) => TagTranslation[];