mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2025-04-21 13:03:07 +03:00
Compare commits
No commits in common. "master" and "2.3.1" have entirely different histories.
46
.github/workflows/test.yml
vendored
46
.github/workflows/test.yml
vendored
@ -1,46 +0,0 @@
|
|||||||
name: CryptoPRO tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildAndTest:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node-version: [ 16 ]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Clean install, build, test
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm run build --if-present --openssl-legacy-provider
|
|
||||||
npm test
|
|
||||||
|
|
||||||
lint:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Use Node.js 16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
check-latest: true
|
|
||||||
|
|
||||||
- name: Clean install, lint
|
|
||||||
run: |
|
|
||||||
npm ci
|
|
||||||
npm run lint
|
|
3
.travis.yml
Normal file
3
.travis.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- lts/*
|
20
README.md
20
README.md
@ -1,8 +1,7 @@
|
|||||||
[![License][license-image]][license-url]
|
|
||||||
[![NPM version][npm-version-image]][npm-url]
|
[![NPM version][npm-version-image]][npm-url]
|
||||||
[![NPM downloads][npm-downloads-image]][downloads-url]
|
[![NPM downloads][npm-downloads-image]][downloads-url]
|
||||||
[![Build Status][actions-image]][actions-url]
|
[![Build Status][travis-image]][travis-url]
|
||||||
|
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||||
|
|
||||||
<a name="cryptopro"></a>
|
<a name="cryptopro"></a>
|
||||||
# cryptoPro
|
# cryptoPro
|
||||||
@ -96,9 +95,6 @@ import { getUserCertificates, Certificate } from 'crypto-pro-js';
|
|||||||
<a name="api-cryptopro"></a>
|
<a name="api-cryptopro"></a>
|
||||||
### Методы объекта cryptoPro
|
### Методы объекта cryptoPro
|
||||||
- [getUserCertificates](src/api/getUserCertificates.ts) - возвращает список [сертификатов](#api-certificate), доступных пользователю в системе
|
- [getUserCertificates](src/api/getUserCertificates.ts) - возвращает список [сертификатов](#api-certificate), доступных пользователю в системе
|
||||||
- [getAllUserCertificates](src/api/getAllUserCertificates.ts) - возвращает список [сертификатов](#api-certificate), доступных пользователю в системе, в том числе просроченные и без закрытого ключа
|
|
||||||
- [getContainerCertificates](src/api/getContainerCertificates.ts) - возвращает список [сертификатов](#api-certificate), из закрытых ключей и/или сертификаты не установленные всистеме*
|
|
||||||
- [getAllContainerCertificates](src/api/getAllContainerCertificates.ts) - возвращает список [сертификатов](#api-certificate), из закрытых ключей и/или сертификаты не установленные всистеме*, в том числе просроченные и без закрытого ключа
|
|
||||||
- [getCertificate](src/api/getCertificate.ts) - возвращает [сертификат](#api-certificate) по отпечатку
|
- [getCertificate](src/api/getCertificate.ts) - возвращает [сертификат](#api-certificate) по отпечатку
|
||||||
- [createAttachedSignature](src/api/createAttachedSignature.ts) - создает совмещенную (присоединенную) подпись сообщения
|
- [createAttachedSignature](src/api/createAttachedSignature.ts) - создает совмещенную (присоединенную) подпись сообщения
|
||||||
- [createDetachedSignature](src/api/createDetachedSignature.ts) - создает отсоединенную (открепленную) подпись сообщения
|
- [createDetachedSignature](src/api/createDetachedSignature.ts) - создает отсоединенную (открепленную) подпись сообщения
|
||||||
@ -109,8 +105,6 @@ import { getUserCertificates, Certificate } from 'crypto-pro-js';
|
|||||||
- [getSystemInfo](src/api/getSystemInfo.ts) - возвращает информацию о CSP и плагине
|
- [getSystemInfo](src/api/getSystemInfo.ts) - возвращает информацию о CSP и плагине
|
||||||
- [isValidSystemSetup](src/api/isValidSystemSetup.ts) - возвращает флаг корректности настроек ЭП на машине
|
- [isValidSystemSetup](src/api/isValidSystemSetup.ts) - возвращает флаг корректности настроек ЭП на машине
|
||||||
|
|
||||||
> *Методы `getContainerCertificates` и `getAllContainerCertificates` позволяют получить сертификаты из закрытых ключей, записанных на обыкновенную флэшку
|
|
||||||
|
|
||||||
<a name="api-certificate"></a>
|
<a name="api-certificate"></a>
|
||||||
### Методы объекта сертификата
|
### Методы объекта сертификата
|
||||||
[Сертификат](src/api/certificate/certificate.ts) предоставляет следущее API:
|
[Сертификат](src/api/certificate/certificate.ts) предоставляет следущее API:
|
||||||
@ -206,11 +200,11 @@ npm unlink
|
|||||||
# Лицензия
|
# Лицензия
|
||||||
[MIT](/LICENSE)
|
[MIT](/LICENSE)
|
||||||
|
|
||||||
[license-url]: /LICENSE
|
|
||||||
[license-image]: https://img.shields.io/github/license/webmasterskaya/crypto-pro-js
|
|
||||||
[npm-url]: https://npmjs.org/package/crypto-pro-js
|
[npm-url]: https://npmjs.org/package/crypto-pro-js
|
||||||
[npm-version-image]: https://img.shields.io/npm/v/crypto-pro-js.svg?style=flat
|
[npm-version-image]: https://img.shields.io/npm/v/crypto-pro-js.svg?style=flat
|
||||||
[npm-downloads-image]: https://img.shields.io/npm/dm/crypto-pro-js.svg?style=flat
|
[npm-downloads-image]: http://img.shields.io/npm/dm/crypto-pro-js.svg?style=flat
|
||||||
[downloads-url]: https://npmcharts.com/compare/crypto-pro-js?minimal=true
|
[downloads-url]: https://npmcharts.com/compare/crypto-pro-js?minimal=true
|
||||||
[actions-url]: https://github.com/webmasterskaya/crypto-pro-js/actions
|
[travis-url]: https://www.travis-ci.com/webmasterskaya/crypto-pro-js
|
||||||
[actions-image]: https://img.shields.io/github/workflow/status/webmasterskaya/crypto-pro-js/test?event=push
|
[travis-image]: http://img.shields.io/travis/webmasterskaya/crypto-pro-js/master.svg?style=flat
|
||||||
|
[coveralls-image]: https://coveralls.io/repos/github/webmasterskaya/crypto-pro-js/badge.svg?branch=master
|
||||||
|
[coveralls-url]: https://coveralls.io/github/webmasterskaya/crypto-pro-js?branch=master
|
||||||
|
8
dist/api/getAllCertificates.d.ts
vendored
8
dist/api/getAllCertificates.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю из пользовательского хранилища и закрытых ключей, не установленных в системе, без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getAllCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
9
dist/api/getAllContainerCertificates.d.ts
vendored
9
dist/api/getAllContainerCertificates.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Начиная с версии плагина 2.0.13292 есть возможность получить сертификаты из закрытых ключей
|
|
||||||
* Возвращает все сертификаты без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getAllContainerCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
3
dist/api/getCertificate.d.ts
vendored
3
dist/api/getCertificate.d.ts
vendored
@ -3,7 +3,6 @@ import { Certificate } from './certificate';
|
|||||||
* Возвращает сертификат по отпечатку
|
* Возвращает сертификат по отпечатку
|
||||||
*
|
*
|
||||||
* @param thumbprint - отпечаток сертификата
|
* @param thumbprint - отпечаток сертификата
|
||||||
* @param validOnly - проверять сертификаты по дате и наличию приватного ключа
|
|
||||||
* @returns сертификат
|
* @returns сертификат
|
||||||
*/
|
*/
|
||||||
export declare const getCertificate: (thumbprint: string, validOnly?: boolean) => Promise<Certificate>;
|
export declare const getCertificate: (thumbprint: string) => Promise<Certificate>;
|
||||||
|
8
dist/api/getCertificates.d.ts
vendored
8
dist/api/getCertificates.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю из пользовательского хранилища и закрытых ключей, не установленных в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
9
dist/api/getContainerCertificates.d.ts
vendored
9
dist/api/getContainerCertificates.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Начиная с версии плагина 2.0.13292 есть возможность получить сертификаты из закрытых ключей
|
|
||||||
* Возвращает список сертификатов, доступных пользователю в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getContainerCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
4
dist/api/index.d.ts
vendored
4
dist/api/index.d.ts
vendored
@ -1,10 +1,6 @@
|
|||||||
export * from './getCertificate';
|
export * from './getCertificate';
|
||||||
export * from './getUserCertificates';
|
export * from './getUserCertificates';
|
||||||
export * from './getAllUserCertificates';
|
export * from './getAllUserCertificates';
|
||||||
export * from './getContainerCertificates';
|
|
||||||
export * from './getAllContainerCertificates';
|
|
||||||
export * from './getCertificates';
|
|
||||||
export * from './getAllCertificates';
|
|
||||||
export * from './getSystemInfo';
|
export * from './getSystemInfo';
|
||||||
export * from './isValidSystemSetup';
|
export * from './isValidSystemSetup';
|
||||||
export * from './createXMLSignature';
|
export * from './createXMLSignature';
|
||||||
|
4
dist/constants/oids-dictionary.d.ts
vendored
4
dist/constants/oids-dictionary.d.ts
vendored
@ -2,10 +2,6 @@ export declare const OIDS_DICTIONARY: {
|
|||||||
'1.2.643.2.2.34.6': string;
|
'1.2.643.2.2.34.6': string;
|
||||||
'1.2.643.2.39.1.1': string;
|
'1.2.643.2.39.1.1': string;
|
||||||
'1.2.643.3.131.1.1': string;
|
'1.2.643.3.131.1.1': string;
|
||||||
'1.2.643.100.4': string;
|
|
||||||
'1.2.643.100.1': string;
|
|
||||||
'1.2.643.100.5': string;
|
|
||||||
'1.2.643.100.3': string;
|
|
||||||
'1.2.643.3.141.1.1': string;
|
'1.2.643.3.141.1.1': string;
|
||||||
'1.2.643.3.141.1.2': string;
|
'1.2.643.3.141.1.2': string;
|
||||||
'1.2.643.3.2.100.65.13.11': string;
|
'1.2.643.3.2.100.65.13.11': string;
|
||||||
|
2
dist/crypto-pro-js.d.ts
vendored
2
dist/crypto-pro-js.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
// Type definitions for crypto-pro-js 2.3.3
|
// Type definitions for crypto-pro-js 2.3.1
|
||||||
// Project: crypto-pro-js
|
// Project: crypto-pro-js
|
||||||
// Definitions by: Artem Vasilev https://github.com/kernusr
|
// Definitions by: Artem Vasilev https://github.com/kernusr
|
||||||
|
|
||||||
|
841
dist/crypto-pro-js.js
vendored
841
dist/crypto-pro-js.js
vendored
File diff suppressed because one or more lines are too long
2
dist/crypto-pro-js.js.map
vendored
2
dist/crypto-pro-js.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/crypto-pro-js.min.js
vendored
6
dist/crypto-pro-js.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/crypto-pro-js.min.js.map
vendored
2
dist/crypto-pro-js.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/helpers/_extractCommonName.d.ts
vendored
2
dist/helpers/_extractCommonName.d.ts
vendored
@ -1 +1 @@
|
|||||||
export declare const _extractCommonName: (subjectName: string) => string | undefined;
|
export declare const _extractCommonName: (subjectName: string) => string;
|
||||||
|
@ -1 +1 @@
|
|||||||
export declare const _extractMeaningfulErrorMessage: (error: Error) => string | null;
|
export declare const _extractMeaningfulErrorMessage: (error: Error) => string;
|
||||||
|
7
dist/helpers/_getCadesContainerCert.d.ts
vendored
7
dist/helpers/_getCadesContainerCert.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку из хранилища закрытого ключа
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export declare const _getCadesContainerCert: (thumbprint: string) => Promise<any>;
|
|
7
dist/helpers/_getCadesUserCert.d.ts
vendored
7
dist/helpers/_getCadesUserCert.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку из хранилища пользователя
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export declare const _getCadesUserCert: (thumbprint: string) => Promise<any>;
|
|
33
examples/script-tag/package-lock.json
generated
33
examples/script-tag/package-lock.json
generated
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "crypto-pro-example-es5-script-tag",
|
"name": "crypto-pro-example-es5-script-tag",
|
||||||
"version": "2.3.3",
|
"version": "0.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "crypto-pro-example-es5-script-tag",
|
"name": "crypto-pro-example-es5-script-tag",
|
||||||
"version": "2.3.3",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"crypto-pro-js": "^2.3.3"
|
"crypto-pro-js": "^2.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"node-static": "0.7.11",
|
"node-static": "0.7.11",
|
||||||
@ -59,12 +59,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/crypto-pro-js": {
|
"node_modules/crypto-pro-js": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/crypto-pro-js/-/crypto-pro-js-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/crypto-pro-js/-/crypto-pro-js-2.3.0.tgz",
|
||||||
"integrity": "sha512-ge6PXRw6pu2kXeaqwEpHvmQEuSRQWJcVfQfPfF5gGONIi+jUHFsvkeS5ojFcKKBDqFHnYUQXFZ1aMKDGdoVRqg==",
|
"integrity": "sha512-pJ9vaQDdInhz2NhIE9NRj3mH6W7PsY+UQCwz7ZHrjgpVlTNWrg2Rk/ooorNfVuQUjOk3tbLYaLnMqkPkRgbmlA=="
|
||||||
"engines": {
|
|
||||||
"node": "~16"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/fs.realpath": {
|
"node_modules/fs.realpath": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -145,9 +142,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.1.2",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
@ -314,9 +311,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"crypto-pro-js": {
|
"crypto-pro-js": {
|
||||||
"version": "2.3.3",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/crypto-pro-js/-/crypto-pro-js-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/crypto-pro-js/-/crypto-pro-js-2.3.0.tgz",
|
||||||
"integrity": "sha512-ge6PXRw6pu2kXeaqwEpHvmQEuSRQWJcVfQfPfF5gGONIi+jUHFsvkeS5ojFcKKBDqFHnYUQXFZ1aMKDGdoVRqg=="
|
"integrity": "sha512-pJ9vaQDdInhz2NhIE9NRj3mH6W7PsY+UQCwz7ZHrjgpVlTNWrg2Rk/ooorNfVuQUjOk3tbLYaLnMqkPkRgbmlA=="
|
||||||
},
|
},
|
||||||
"fs.realpath": {
|
"fs.realpath": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -382,9 +379,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.1.2",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "crypto-pro-example-es5-script-tag",
|
"name": "crypto-pro-example-es5-script-tag",
|
||||||
"version": "2.3.3",
|
"version": "0.0.0",
|
||||||
"description": "Пример использования пакета crypto-pro через тэг script",
|
"description": "Пример использования пакета crypto-pro через тэг script",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -13,6 +13,6 @@
|
|||||||
"symlink-dir": "3.1.2"
|
"symlink-dir": "3.1.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"crypto-pro-js": "^2.3.3"
|
"crypto-pro-js": "^2.3.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
$certificateDetails.style.display = thumbprint ? 'block' : 'none';
|
$certificateDetails.style.display = thumbprint ? 'block' : 'none';
|
||||||
});
|
});
|
||||||
|
|
||||||
window.cryptoPro.getCertificates().then(function (certificateList) {
|
window.cryptoPro.getUserCertificates().then(function (certificateList) {
|
||||||
certificateList.forEach(function (certificate) {
|
certificateList.forEach(function (certificate) {
|
||||||
var $certOption = document.createElement('option');
|
var $certOption = document.createElement('option');
|
||||||
|
|
||||||
|
8
lib/api/addAttachedSignature.d.ts
vendored
8
lib/api/addAttachedSignature.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Добавляет присоединенную подпись к подписанному сообщению по отпечатку сертификата
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @param signedMessage - подписанное сообщение
|
|
||||||
* @returns подпись в формате PKCS#7
|
|
||||||
*/
|
|
||||||
export declare const addAttachedSignature: (thumbprint: string, signedMessage: string | ArrayBuffer) => Promise<string>;
|
|
9
lib/api/addDetachedSignature.d.ts
vendored
9
lib/api/addDetachedSignature.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
/**
|
|
||||||
* Добавляет отсоединенную подпись хеша к подписанному сообщению по отпечатку сертификата
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @param signedMessage - подписанное сообщение
|
|
||||||
* @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит
|
|
||||||
* @returns подпись в формате PKCS#7
|
|
||||||
*/
|
|
||||||
export declare const addDetachedSignature: (thumbprint: string, signedMessage: string | ArrayBuffer, messageHash: string) => Promise<string>;
|
|
22
lib/api/certificate/certificate.d.ts
vendored
22
lib/api/certificate/certificate.d.ts
vendored
@ -1,22 +0,0 @@
|
|||||||
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
6
lib/api/certificate/exportBase64.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Экспортирует сертификат в формате base64
|
|
||||||
*
|
|
||||||
* @returns сертификат в формате base64
|
|
||||||
*/
|
|
||||||
export declare const exportBase64: () => Promise<string>;
|
|
11
lib/api/certificate/getAlgorithm.d.ts
vendored
11
lib/api/certificate/getAlgorithm.d.ts
vendored
@ -1,11 +0,0 @@
|
|||||||
interface AlgorithmInfo {
|
|
||||||
algorithm: string;
|
|
||||||
oid: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Возвращает информацию об алгоритме сертификата
|
|
||||||
*
|
|
||||||
* @returns информацию об алгоритме и его OID'е
|
|
||||||
*/
|
|
||||||
export declare const getAlgorithm: () => Promise<AlgorithmInfo>;
|
|
||||||
export {};
|
|
7
lib/api/certificate/getCadesProp.d.ts
vendored
7
lib/api/certificate/getCadesProp.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает указанное внутренее свойство у сертификата в формате Cades
|
|
||||||
*
|
|
||||||
* @param propName = наименование свойства
|
|
||||||
* @returns значение запрошенного свойства
|
|
||||||
*/
|
|
||||||
export declare const getCadesProp: (propName: string) => Promise<any>;
|
|
@ -1,9 +0,0 @@
|
|||||||
export interface ExtendedKeysTranslations {
|
|
||||||
[key: string]: string | null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Возвращает расшифрованные ОИД'ы сертификата
|
|
||||||
*
|
|
||||||
* @returns словарь расшифрованных ОИД'ов
|
|
||||||
*/
|
|
||||||
export declare const getDecodedExtendedKeyUsage: () => Promise<ExtendedKeysTranslations>;
|
|
6
lib/api/certificate/getExtendedKeyUsage.d.ts
vendored
6
lib/api/certificate/getExtendedKeyUsage.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает ОИД'ы сертификата
|
|
||||||
*
|
|
||||||
* @returns список ОИД'ов
|
|
||||||
*/
|
|
||||||
export declare const getExtendedKeyUsage: () => Promise<string[]>;
|
|
10
lib/api/certificate/getInfo.d.ts
vendored
10
lib/api/certificate/getInfo.d.ts
vendored
@ -1,10 +0,0 @@
|
|||||||
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[]>;
|
|
7
lib/api/certificate/hasExtendedKeyUsage.d.ts
vendored
7
lib/api/certificate/hasExtendedKeyUsage.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Проверяет наличие ОИД'а (ОИД'ов) у сертификата
|
|
||||||
*
|
|
||||||
* @param oids - ОИД'ы для проверки
|
|
||||||
* @returns флаг наличия ОИД'ов у сертификата
|
|
||||||
*/
|
|
||||||
export declare const hasExtendedKeyUsage: (oids: string | string[]) => Promise<boolean>;
|
|
1
lib/api/certificate/index.d.ts
vendored
1
lib/api/certificate/index.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export * from './certificate';
|
|
6
lib/api/certificate/isValid.d.ts
vendored
6
lib/api/certificate/isValid.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Проверяет действительность сертификата
|
|
||||||
*
|
|
||||||
* @returns флаг валидности
|
|
||||||
*/
|
|
||||||
export declare const isValid: () => Promise<boolean>;
|
|
8
lib/api/createAttachedSignature.d.ts
vendored
8
lib/api/createAttachedSignature.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Создает присоединенную подпись сообщения по отпечатку сертификата
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @param message - подписываемое сообщение
|
|
||||||
* @returns подпись в формате PKCS#7
|
|
||||||
*/
|
|
||||||
export declare const createAttachedSignature: (thumbprint: string, unencryptedMessage: string | ArrayBuffer) => Promise<string>;
|
|
8
lib/api/createDetachedSignature.d.ts
vendored
8
lib/api/createDetachedSignature.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Создает отсоединенную подпись хеша по отпечатку сертификата
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит
|
|
||||||
* @returns подпись в формате PKCS#7
|
|
||||||
*/
|
|
||||||
export declare const createDetachedSignature: (thumbprint: string, messageHash: string) => Promise<string>;
|
|
9
lib/api/createHash.d.ts
vendored
9
lib/api/createHash.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
/**
|
|
||||||
* Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит
|
|
||||||
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
|
|
||||||
*
|
|
||||||
* @param unencryptedMessage - сообщение для хеширования
|
|
||||||
*
|
|
||||||
* @returns хеш
|
|
||||||
*/
|
|
||||||
export declare const createHash: (unencryptedMessage: string | ArrayBuffer) => Promise<string>;
|
|
8
lib/api/createXMLSignature.d.ts
vendored
8
lib/api/createXMLSignature.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Создает XML подпись для документа в формате XML
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @param unencryptedMessage - подписываемое сообщение в формате XML
|
|
||||||
* @returns подпись
|
|
||||||
*/
|
|
||||||
export declare const createXMLSignature: (thumbprint: string, unencryptedMessage: string) => Promise<string>;
|
|
8
lib/api/getAllCertificates.d.ts
vendored
8
lib/api/getAllCertificates.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю из пользовательского хранилища и закрытых ключей, не установленных в системе, без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getAllCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
9
lib/api/getAllContainerCertificates.d.ts
vendored
9
lib/api/getAllContainerCertificates.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Начиная с версии плагина 2.0.13292 есть возможность получить сертификаты из закрытых ключей
|
|
||||||
* Возвращает все сертификаты без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getAllContainerCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
8
lib/api/getAllUserCertificates.d.ts
vendored
8
lib/api/getAllUserCertificates.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает все сертификаты без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getAllUserCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
9
lib/api/getCertificate.d.ts
vendored
9
lib/api/getCertificate.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает сертификат по отпечатку
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @param validOnly - проверять сертификаты по дате и наличию приватного ключа
|
|
||||||
* @returns сертификат
|
|
||||||
*/
|
|
||||||
export declare const getCertificate: (thumbprint: string, validOnly?: boolean) => Promise<Certificate>;
|
|
8
lib/api/getCertificates.d.ts
vendored
8
lib/api/getCertificates.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю из пользовательского хранилища и закрытых ключей, не установленных в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
9
lib/api/getContainerCertificates.d.ts
vendored
9
lib/api/getContainerCertificates.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Начиная с версии плагина 2.0.13292 есть возможность получить сертификаты из закрытых ключей
|
|
||||||
* Возвращает список сертификатов, доступных пользователю в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getContainerCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
6
lib/api/getCspVersion.d.ts
vendored
6
lib/api/getCspVersion.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Предоставляет информацию о системе
|
|
||||||
*
|
|
||||||
* @returns информацию о CSP
|
|
||||||
*/
|
|
||||||
export declare const getCspVersion: () => Promise<string>;
|
|
6
lib/api/getPluginVersion.d.ts
vendored
6
lib/api/getPluginVersion.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Предоставляет информацию о системе
|
|
||||||
*
|
|
||||||
* @returns информацию о плагине
|
|
||||||
*/
|
|
||||||
export declare const getPluginVersion: () => Promise<string>;
|
|
10
lib/api/getSystemInfo.d.ts
vendored
10
lib/api/getSystemInfo.d.ts
vendored
@ -1,10 +0,0 @@
|
|||||||
export interface SystemInfo {
|
|
||||||
cadesVersion: string;
|
|
||||||
cspVersion: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Предоставляет информацию о системе
|
|
||||||
*
|
|
||||||
* @returns информацию о CSP и плагине
|
|
||||||
*/
|
|
||||||
export declare const getSystemInfo: () => Promise<SystemInfo>;
|
|
8
lib/api/getUserCertificates.d.ts
vendored
8
lib/api/getUserCertificates.d.ts
vendored
@ -1,8 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export declare const getUserCertificates: (resetCache?: boolean) => Promise<Certificate[]>;
|
|
18
lib/api/index.d.ts
vendored
18
lib/api/index.d.ts
vendored
@ -1,18 +0,0 @@
|
|||||||
export * from './getCertificate';
|
|
||||||
export * from './getUserCertificates';
|
|
||||||
export * from './getAllUserCertificates';
|
|
||||||
export * from './getContainerCertificates';
|
|
||||||
export * from './getAllContainerCertificates';
|
|
||||||
export * from './getCertificates';
|
|
||||||
export * from './getAllCertificates';
|
|
||||||
export * from './getSystemInfo';
|
|
||||||
export * from './isValidSystemSetup';
|
|
||||||
export * from './createXMLSignature';
|
|
||||||
export * from './createDetachedSignature';
|
|
||||||
export * from './addDetachedSignature';
|
|
||||||
export * from './createAttachedSignature';
|
|
||||||
export * from './addAttachedSignature';
|
|
||||||
export * from './createHash';
|
|
||||||
export * from './certificate';
|
|
||||||
export * from './getCspVersion';
|
|
||||||
export * from './getPluginVersion';
|
|
6
lib/api/isValidSystemSetup.d.ts
vendored
6
lib/api/isValidSystemSetup.d.ts
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Проверяет корректность настроек ЭП на машине
|
|
||||||
*
|
|
||||||
* @returns флаг корректности настроек
|
|
||||||
*/
|
|
||||||
export declare const isValidSystemSetup: () => Promise<boolean>;
|
|
149
lib/constants/cades-constants.d.ts
vendored
149
lib/constants/cades-constants.d.ts
vendored
@ -1,149 +0,0 @@
|
|||||||
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
4
lib/constants/index.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
export * from './cades-constants';
|
|
||||||
export * from './issuer-tags-translations';
|
|
||||||
export * from './oids-dictionary';
|
|
||||||
export * from './subject-tags-translations';
|
|
2
lib/constants/issuer-tags-translations.d.ts
vendored
2
lib/constants/issuer-tags-translations.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
import { TagsTranslations } from './tags-translations';
|
|
||||||
export declare const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[];
|
|
48
lib/constants/oids-dictionary.d.ts
vendored
48
lib/constants/oids-dictionary.d.ts
vendored
@ -1,48 +0,0 @@
|
|||||||
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.100.4': string;
|
|
||||||
'1.2.643.100.1': string;
|
|
||||||
'1.2.643.100.5': string;
|
|
||||||
'1.2.643.100.3': 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;
|
|
||||||
};
|
|
2
lib/constants/subject-tags-translations.d.ts
vendored
2
lib/constants/subject-tags-translations.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
import { TagsTranslations } from './tags-translations';
|
|
||||||
export declare const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[];
|
|
4
lib/constants/tags-translations.d.ts
vendored
4
lib/constants/tags-translations.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
export interface TagsTranslations {
|
|
||||||
possibleNames: string[];
|
|
||||||
translation: string;
|
|
||||||
}
|
|
5
lib/crypto-pro-js.d.ts
vendored
5
lib/crypto-pro-js.d.ts
vendored
@ -1,5 +0,0 @@
|
|||||||
// Type definitions for crypto-pro-js 2.3.3
|
|
||||||
// Project: crypto-pro-js
|
|
||||||
// Definitions by: Artem Vasilev https://github.com/kernusr
|
|
||||||
|
|
||||||
export * from './api';
|
|
5497
lib/crypto-pro-js.js
5497
lib/crypto-pro-js.js
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
lib/helpers/_afterPluginsLoaded.d.ts
vendored
3
lib/helpers/_afterPluginsLoaded.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
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
1
lib/helpers/_extractCommonName.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export declare const _extractCommonName: (subjectName: string) => string | undefined;
|
|
@ -1 +0,0 @@
|
|||||||
export declare const _extractMeaningfulErrorMessage: (error: Error) => string | null;
|
|
3
lib/helpers/_generateCadesFn.d.ts
vendored
3
lib/helpers/_generateCadesFn.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
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
7
lib/helpers/_getCadesCert.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export declare const _getCadesCert: (thumbprint: string) => Promise<any>;
|
|
7
lib/helpers/_getCadesContainerCert.d.ts
vendored
7
lib/helpers/_getCadesContainerCert.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку из хранилища закрытого ключа
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export declare const _getCadesContainerCert: (thumbprint: string) => Promise<any>;
|
|
7
lib/helpers/_getCadesUserCert.d.ts
vendored
7
lib/helpers/_getCadesUserCert.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку из хранилища пользователя
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export declare const _getCadesUserCert: (thumbprint: string) => Promise<any>;
|
|
7
lib/helpers/_getDateObj.d.ts
vendored
7
lib/helpers/_getDateObj.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
/**
|
|
||||||
* Возвращает объект даты, совместимый с 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;
|
|
1
lib/helpers/_isSupportedCSPVersion.d.ts
vendored
1
lib/helpers/_isSupportedCSPVersion.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export declare const _isSupportedCSPVersion: (version: string) => boolean;
|
|
1
lib/helpers/_isSupportedCadesVersion.d.ts
vendored
1
lib/helpers/_isSupportedCadesVersion.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
export declare const _isSupportedCadesVersion: (version: string) => boolean;
|
|
14
lib/helpers/_parseCertInfo.d.ts
vendored
14
lib/helpers/_parseCertInfo.d.ts
vendored
@ -1,14 +0,0 @@
|
|||||||
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[];
|
|
39735
package-lock.json
generated
39735
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
173
package.json
173
package.json
@ -1,90 +1,87 @@
|
|||||||
{
|
{
|
||||||
"name": "crypto-pro-js",
|
"name": "crypto-pro-js",
|
||||||
"version": "2.3.3",
|
"version": "2.3.1",
|
||||||
"description": "Асинхронный JavaScript API для работы с КриптоПРО ЭЦП Browser Plug-In. Forked from https://github.com/vgoma/crypto-pro",
|
"description": "Асинхронный JavaScript API для работы с КриптоПРО ЭЦП Browser Plug-In. Forked from https://github.com/vgoma/crypto-pro",
|
||||||
"main": "./lib/crypto-pro-js.js",
|
"main": "./lib/crypto-pro-js.js",
|
||||||
"types": "./lib/crypto-pro-js.d.ts",
|
"types": "./lib/crypto-pro-js.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"lib/**/*",
|
"lib/**/*",
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"bower.json"
|
"bower.json"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist lib package coverage",
|
"clean": "rimraf dist lib package coverage",
|
||||||
"start": "cross-env TS_CONFIG=tsconfig-es5.json webpack --watch",
|
"start": "cross-env TS_CONFIG=tsconfig-es5.json webpack --watch",
|
||||||
"build:uncompressed:es5": "cross-env TS_CONFIG=tsconfig-es5.json webpack",
|
"build:uncompressed:es5": "cross-env TS_CONFIG=tsconfig-es5.json webpack",
|
||||||
"build:compressed:es5": "cross-env TS_CONFIG=tsconfig-es5.json NODE_ENV=production webpack",
|
"build:compressed:es5": "cross-env TS_CONFIG=tsconfig-es5.json NODE_ENV=production webpack",
|
||||||
"build:definition-header:es5": "cross-env TS_CONFIG=tsconfig-es5.json node definition-header.js",
|
"build:definition-header:es5": "cross-env TS_CONFIG=tsconfig-es5.json node definition-header.js",
|
||||||
"build:es5": "npm run build:uncompressed:es5 && npm run build:compressed:es5 && npm run build:definition-header:es5",
|
"build:es5": "npm run build:uncompressed:es5 && npm run build:compressed:es5 && npm run build:definition-header:es5",
|
||||||
"build:uncompressed:esm": "cross-env TS_CONFIG=tsconfig-esm.json webpack",
|
"build:uncompressed:esm": "cross-env TS_CONFIG=tsconfig-esm.json webpack",
|
||||||
"build:definition-header:esm": "cross-env TS_CONFIG=tsconfig-esm.json node definition-header.js",
|
"build:definition-header:esm": "cross-env TS_CONFIG=tsconfig-esm.json node definition-header.js",
|
||||||
"build:esm": "npm run build:uncompressed:esm && npm run build:definition-header:esm",
|
"build:esm": "npm run build:uncompressed:esm && npm run build:definition-header:esm",
|
||||||
"build": "npm run clean && npm run build:es5 && npm run build:esm",
|
"build": "npm run clean && npm run build:es5 && npm run build:esm",
|
||||||
"pack:clean": "cross-env rimraf %npm_package_name%-%npm_package_version%.tgz",
|
"pack:clean": "cross-env rimraf %npm_package_name%-%npm_package_version%.tgz",
|
||||||
"pack:uncompress": "cross-env tar xopf %npm_package_name%-%npm_package_version%.tgz",
|
"pack:uncompress": "cross-env tar xopf %npm_package_name%-%npm_package_version%.tgz",
|
||||||
"test": "jest --coverage",
|
"test": "jest --coverage && coveralls < coverage/lcov.info",
|
||||||
"lint": "eslint --config .eslintrc.js --ext .ts --ext .js src",
|
"lint": "eslint --config .eslintrc.js --ext .ts --ext .js src",
|
||||||
"lint:fix": "eslint --fix --config .eslintrc.js --ext .ts --ext .js src",
|
"lint:fix": "eslint --fix --config .eslintrc.js --ext .ts --ext .js src",
|
||||||
"examples-update": "npm run examples-update:script-tag",
|
"examples-update": "npm run examples-update:script-tag",
|
||||||
"examples-update:script-tag": "npm --prefix ./examples/script-tag r crypto-pro-js && npm --prefix ./examples/script-tag i crypto-pro-js",
|
"examples-update:script-tag": "npm --prefix ./examples/script-tag r crypto-pro-js && npm --prefix ./examples/script-tag i crypto-pro-js",
|
||||||
"prepack": "npm run build",
|
"prepack": "npm run build",
|
||||||
"prepublishOnly": "npm run lint && jest && npm run build",
|
"prepublishOnly": "npm run lint && jest && npm run build",
|
||||||
"postpublish": "npm run examples-update"
|
"postpublish": "npm run examples-update"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/webmasterskaya/crypto-pro-js"
|
"url": "https://github.com/webmasterskaya/crypto-pro-js"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Artem Vasilev",
|
"name": "Artem Vasilev",
|
||||||
"email": "kern.usr@gmail.com",
|
"email": "kern.usr@gmail.com",
|
||||||
"url": "https://github.com/kernusr"
|
"url": "https://github.com/kernusr"
|
||||||
},
|
},
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"name": "Vitalii Goma",
|
"name": "Vitalii Goma",
|
||||||
"email": "vgoma@yandex.ru",
|
"email": "vgoma@yandex.ru",
|
||||||
"url": "https://github.com/vgoma"
|
"url": "https://github.com/vgoma"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "German Arutyunov",
|
"name": "German Arutyunov",
|
||||||
"email": "germanarutyunov@gmail.com",
|
"email": "germanarutyunov@gmail.com",
|
||||||
"url": "https://github.com/gaarutyunov"
|
"url": "https://github.com/gaarutyunov"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"crypto",
|
"crypto",
|
||||||
"cryptopro",
|
"cryptopro",
|
||||||
"crypto-pro",
|
"crypto-pro",
|
||||||
"crypto-pro-js",
|
"crypto-pro-js",
|
||||||
"cades",
|
"cades",
|
||||||
"КриптоПро",
|
"КриптоПро",
|
||||||
"Крипто ПРО"
|
"Крипто ПРО"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "25.1.4",
|
"@types/jest": "25.1.4",
|
||||||
"@types/lodash": "4.14.149",
|
"@types/lodash": "4.14.149",
|
||||||
"@types/node": "13.9.5",
|
"@types/node": "13.9.5",
|
||||||
"@typescript-eslint/eslint-plugin": "2.25.0",
|
"@typescript-eslint/eslint-plugin": "2.25.0",
|
||||||
"@typescript-eslint/parser": "2.25.0",
|
"@typescript-eslint/parser": "2.25.0",
|
||||||
"coveralls": "3.0.11",
|
"coveralls": "3.0.11",
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"eslint": "6.8.0",
|
"eslint": "6.8.0",
|
||||||
"eslint-config-prettier": "6.10.1",
|
"eslint-config-prettier": "6.10.1",
|
||||||
"eslint-plugin-prettier": "3.1.2",
|
"eslint-plugin-prettier": "3.1.2",
|
||||||
"jest": "^25.5.4",
|
"jest": "25.2.3",
|
||||||
"prettier": "2.0.2",
|
"prettier": "2.0.2",
|
||||||
"rimraf": "3.0.2",
|
"rimraf": "3.0.2",
|
||||||
"sinon": "9.0.1",
|
"sinon": "9.0.1",
|
||||||
"tar": "6.1.9",
|
"tar": "6.1.9",
|
||||||
"ts-jest": "^25.5.1",
|
"ts-jest": "^25.5.1",
|
||||||
"ts-loader": "^9.4.2",
|
"ts-loader": "6.2.2",
|
||||||
"typescript": "^3.9.10",
|
"typescript": "3.8.3",
|
||||||
"webpack": "^5.75.0",
|
"webpack": "4.42.1",
|
||||||
"webpack-cli": "^5.0.1"
|
"webpack-cli": "3.3.11"
|
||||||
},
|
}
|
||||||
"engines": {
|
|
||||||
"node": "~16"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';
|
|
||||||
import { getAllUserCertificates } from './getAllUserCertificates';
|
|
||||||
import { getAllContainerCertificates } from './getAllContainerCertificates';
|
|
||||||
|
|
||||||
let certificatesCache: Certificate[];
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю из пользовательского хранилища и закрытых ключей, не установленных в системе, без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export const getAllCertificates = _afterPluginsLoaded(
|
|
||||||
async (resetCache: boolean = false): Promise<Certificate[]> => {
|
|
||||||
if (!resetCache && certificatesCache) {
|
|
||||||
return certificatesCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
let availableCertificates: Certificate[];
|
|
||||||
|
|
||||||
try {
|
|
||||||
availableCertificates = await getAllUserCertificates(resetCache);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
availableCertificates = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const containerAllCertificates: Certificate[] = await getAllContainerCertificates(resetCache);
|
|
||||||
|
|
||||||
if (!availableCertificates) {
|
|
||||||
availableCertificates = containerAllCertificates;
|
|
||||||
} else {
|
|
||||||
let containerAllCertificatesCount = containerAllCertificates.length - 1;
|
|
||||||
let foundAvailableCertificate;
|
|
||||||
|
|
||||||
while (containerAllCertificatesCount) {
|
|
||||||
foundAvailableCertificate = availableCertificates.find(
|
|
||||||
(cert) => cert.thumbprint === containerAllCertificates[containerAllCertificatesCount].thumbprint,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!foundAvailableCertificate) {
|
|
||||||
availableCertificates.push(containerAllCertificates[containerAllCertificatesCount]);
|
|
||||||
}
|
|
||||||
|
|
||||||
containerAllCertificatesCount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!availableCertificates) {
|
|
||||||
throw new Error('Нет доступных сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
certificatesCache = availableCertificates;
|
|
||||||
|
|
||||||
return certificatesCache;
|
|
||||||
},
|
|
||||||
);
|
|
@ -1,60 +0,0 @@
|
|||||||
import 'cadesplugin';
|
|
||||||
import { rawCertificates, parsedCertificates } from '../__mocks__/certificates';
|
|
||||||
import { getAllContainerCertificates } from './getAllContainerCertificates';
|
|
||||||
|
|
||||||
const [rawCertificateMock] = rawCertificates;
|
|
||||||
const [parsedCertificateMock] = parsedCertificates;
|
|
||||||
|
|
||||||
const executionSteps = [
|
|
||||||
Symbol('step 0'),
|
|
||||||
Symbol('step 1'),
|
|
||||||
Symbol('step 2'),
|
|
||||||
Symbol('step 3'),
|
|
||||||
Symbol('step 4'),
|
|
||||||
Symbol('step 5'),
|
|
||||||
Symbol('step 6'),
|
|
||||||
Symbol('step 7'),
|
|
||||||
Symbol('step 8'),
|
|
||||||
];
|
|
||||||
|
|
||||||
const executionFlow = {
|
|
||||||
[executionSteps[0]]: {
|
|
||||||
Certificates: executionSteps[1],
|
|
||||||
Close: jest.fn(),
|
|
||||||
Open: jest.fn(),
|
|
||||||
},
|
|
||||||
[executionSteps[1]]: {
|
|
||||||
Count: executionSteps[2],
|
|
||||||
Item: jest.fn(() => executionSteps[3]),
|
|
||||||
},
|
|
||||||
[executionSteps[2]]: 1,
|
|
||||||
[executionSteps[3]]: {
|
|
||||||
IssuerName: executionSteps[6],
|
|
||||||
SubjectName: executionSteps[5],
|
|
||||||
Thumbprint: executionSteps[4],
|
|
||||||
ValidFromDate: executionSteps[7],
|
|
||||||
ValidToDate: executionSteps[8],
|
|
||||||
},
|
|
||||||
[executionSteps[6]]: rawCertificateMock.IssuerName,
|
|
||||||
[executionSteps[5]]: rawCertificateMock.SubjectName,
|
|
||||||
[executionSteps[4]]: rawCertificateMock.Thumbprint,
|
|
||||||
[executionSteps[7]]: rawCertificateMock.ValidFromDate,
|
|
||||||
[executionSteps[8]]: rawCertificateMock.ValidToDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
window.cadesplugin.__defineExecutionFlow(executionFlow);
|
|
||||||
window.cadesplugin.CreateObjectAsync.mockImplementation(() => executionSteps[0]);
|
|
||||||
|
|
||||||
describe('getUserCertificates', () => {
|
|
||||||
test('returns certificates list', async () => {
|
|
||||||
const certificates = await getAllContainerCertificates();
|
|
||||||
|
|
||||||
expect(certificates.length).toBeGreaterThan(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('returns certificates with correct fields', async () => {
|
|
||||||
const [certificate] = await getAllContainerCertificates();
|
|
||||||
|
|
||||||
expect(certificate).toMatchObject(parsedCertificateMock);
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,100 +0,0 @@
|
|||||||
import { CadesCertificate, Certificate } from './certificate';
|
|
||||||
import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';
|
|
||||||
import { _extractCommonName } from '../helpers/_extractCommonName';
|
|
||||||
import { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';
|
|
||||||
import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';
|
|
||||||
|
|
||||||
let certificatesCache: Certificate[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Начиная с версии плагина 2.0.13292 есть возможность получить сертификаты из закрытых ключей
|
|
||||||
* Возвращает все сертификаты без фильтрации по дате и наличию приватного ключа
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export const getAllContainerCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {
|
|
||||||
const { cadesplugin } = window;
|
|
||||||
|
|
||||||
if (!resetCache && certificatesCache) {
|
|
||||||
return certificatesCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eval(
|
|
||||||
_generateCadesFn(function getAllContainerCertificates(): Certificate[] {
|
|
||||||
let cadesStore;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
void (
|
|
||||||
__cadesAsyncToken__ +
|
|
||||||
cadesStore.Open(
|
|
||||||
cadesplugin.CADESCOM_CONTAINER_STORE,
|
|
||||||
cadesplugin.CAPICOM_MY_STORE,
|
|
||||||
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');
|
|
||||||
}
|
|
||||||
|
|
||||||
let cadesCertificates;
|
|
||||||
let cadesCertificatesCount;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;
|
|
||||||
cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cadesCertificatesCount) {
|
|
||||||
throw new Error('Нет доступных сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
const certificateList: Certificate[] = [];
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (cadesCertificatesCount) {
|
|
||||||
const cadesCertificate: CadesCertificate =
|
|
||||||
__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);
|
|
||||||
|
|
||||||
certificateList.push(
|
|
||||||
new Certificate(
|
|
||||||
cadesCertificate,
|
|
||||||
_extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.IssuerName,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.SubjectName,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.Thumbprint,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.ValidFromDate,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.ValidToDate,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
cadesCertificatesCount--;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
cadesStore.Close();
|
|
||||||
|
|
||||||
certificatesCache = certificateList;
|
|
||||||
|
|
||||||
return certificatesCache;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
});
|
|
@ -1,29 +1,20 @@
|
|||||||
import { Certificate } from './certificate';
|
import { Certificate } from './certificate';
|
||||||
import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';
|
import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';
|
||||||
import { getCertificates } from './getCertificates';
|
import { getUserCertificates } from './getUserCertificates';
|
||||||
import { getAllCertificates } from './getAllCertificates';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Возвращает сертификат по отпечатку
|
* Возвращает сертификат по отпечатку
|
||||||
*
|
*
|
||||||
* @param thumbprint - отпечаток сертификата
|
* @param thumbprint - отпечаток сертификата
|
||||||
* @param validOnly - проверять сертификаты по дате и наличию приватного ключа
|
|
||||||
* @returns сертификат
|
* @returns сертификат
|
||||||
*/
|
*/
|
||||||
export const getCertificate = _afterPluginsLoaded(
|
export const getCertificate = _afterPluginsLoaded(
|
||||||
async (thumbprint: string, validOnly: boolean = true): Promise<Certificate> => {
|
async (thumbprint: string): Promise<Certificate> => {
|
||||||
if (!thumbprint) {
|
if (!thumbprint) {
|
||||||
throw new Error('Отпечаток не указан');
|
throw new Error('Отпечаток не указан');
|
||||||
}
|
}
|
||||||
|
|
||||||
let availableCertificates: Certificate[];
|
const availableCertificates: Certificate[] = await getUserCertificates();
|
||||||
|
|
||||||
if (validOnly) {
|
|
||||||
availableCertificates = await getCertificates();
|
|
||||||
} else {
|
|
||||||
availableCertificates = await getAllCertificates();
|
|
||||||
}
|
|
||||||
|
|
||||||
const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);
|
const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);
|
||||||
|
|
||||||
if (!foundCertificate) {
|
if (!foundCertificate) {
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
import { Certificate } from './certificate';
|
|
||||||
import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';
|
|
||||||
import { getUserCertificates } from './getUserCertificates';
|
|
||||||
import { getContainerCertificates } from './getContainerCertificates';
|
|
||||||
import { getAllUserCertificates } from './getAllUserCertificates';
|
|
||||||
import { getAllContainerCertificates } from './getAllContainerCertificates';
|
|
||||||
|
|
||||||
let certificatesCache: Certificate[];
|
|
||||||
/**
|
|
||||||
* Возвращает список сертификатов, доступных пользователю из пользовательского хранилища и закрытых ключей, не установленных в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export const getCertificates = _afterPluginsLoaded(
|
|
||||||
async (resetCache: boolean = false): Promise<Certificate[]> => {
|
|
||||||
if (!resetCache && certificatesCache) {
|
|
||||||
return certificatesCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
let availableCertificates: Certificate[];
|
|
||||||
|
|
||||||
try {
|
|
||||||
availableCertificates = await getUserCertificates(resetCache);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
availableCertificates = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const containerCertificates: Certificate[] = await getContainerCertificates(resetCache);
|
|
||||||
|
|
||||||
if (!availableCertificates) {
|
|
||||||
availableCertificates = containerCertificates;
|
|
||||||
} else {
|
|
||||||
let containerCertificatesCount = containerCertificates.length - 1;
|
|
||||||
let foundAvailableCertificate;
|
|
||||||
|
|
||||||
while (containerCertificatesCount) {
|
|
||||||
foundAvailableCertificate = availableCertificates.find(
|
|
||||||
(cert) => cert.thumbprint === containerCertificates[containerCertificatesCount].thumbprint,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!foundAvailableCertificate) {
|
|
||||||
availableCertificates.push(containerCertificates[containerCertificatesCount]);
|
|
||||||
}
|
|
||||||
|
|
||||||
containerCertificatesCount--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!availableCertificates) {
|
|
||||||
throw new Error('Нет доступных сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
certificatesCache = availableCertificates;
|
|
||||||
|
|
||||||
return certificatesCache;
|
|
||||||
},
|
|
||||||
);
|
|
@ -1,68 +0,0 @@
|
|||||||
import 'cadesplugin';
|
|
||||||
import { rawCertificates, parsedCertificates } from '../__mocks__/certificates';
|
|
||||||
import { getContainerCertificates } from './getContainerCertificates';
|
|
||||||
|
|
||||||
const [rawCertificateMock] = rawCertificates;
|
|
||||||
const [parsedCertificateMock] = parsedCertificates;
|
|
||||||
|
|
||||||
const executionSteps = [
|
|
||||||
Symbol('step 0'),
|
|
||||||
Symbol('step 1'),
|
|
||||||
Symbol('step 2'),
|
|
||||||
Symbol('step 3'),
|
|
||||||
Symbol('step 4'),
|
|
||||||
Symbol('step 5'),
|
|
||||||
Symbol('step 6'),
|
|
||||||
Symbol('step 7'),
|
|
||||||
Symbol('step 8'),
|
|
||||||
Symbol('step 9'),
|
|
||||||
Symbol('step 10'),
|
|
||||||
];
|
|
||||||
|
|
||||||
const executionFlow = {
|
|
||||||
[executionSteps[0]]: {
|
|
||||||
Certificates: executionSteps[1],
|
|
||||||
Close: jest.fn(),
|
|
||||||
Open: jest.fn(),
|
|
||||||
},
|
|
||||||
[executionSteps[1]]: {
|
|
||||||
Find: jest.fn(() => executionSteps[2]),
|
|
||||||
},
|
|
||||||
[executionSteps[2]]: {
|
|
||||||
Find: jest.fn(() => executionSteps[3]),
|
|
||||||
},
|
|
||||||
[executionSteps[3]]: {
|
|
||||||
Count: executionSteps[4],
|
|
||||||
Item: jest.fn(() => executionSteps[5]),
|
|
||||||
},
|
|
||||||
[executionSteps[4]]: 1,
|
|
||||||
[executionSteps[5]]: {
|
|
||||||
IssuerName: executionSteps[8],
|
|
||||||
SubjectName: executionSteps[7],
|
|
||||||
Thumbprint: executionSteps[6],
|
|
||||||
ValidFromDate: executionSteps[9],
|
|
||||||
ValidToDate: executionSteps[10],
|
|
||||||
},
|
|
||||||
[executionSteps[8]]: rawCertificateMock.IssuerName,
|
|
||||||
[executionSteps[7]]: rawCertificateMock.SubjectName,
|
|
||||||
[executionSteps[6]]: rawCertificateMock.Thumbprint,
|
|
||||||
[executionSteps[9]]: rawCertificateMock.ValidFromDate,
|
|
||||||
[executionSteps[10]]: rawCertificateMock.ValidToDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
window.cadesplugin.__defineExecutionFlow(executionFlow);
|
|
||||||
window.cadesplugin.CreateObjectAsync.mockImplementation(() => executionSteps[0]);
|
|
||||||
|
|
||||||
describe('getContainerCertificates', () => {
|
|
||||||
test('returns certificates list', async () => {
|
|
||||||
const certificates = await getContainerCertificates();
|
|
||||||
|
|
||||||
expect(certificates.length).toBeGreaterThan(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('returns certificates with correct fields', async () => {
|
|
||||||
const [certificate] = await getContainerCertificates();
|
|
||||||
|
|
||||||
expect(certificate).toMatchObject(parsedCertificateMock);
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,118 +0,0 @@
|
|||||||
import { CadesCertificate, Certificate } from './certificate';
|
|
||||||
import { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';
|
|
||||||
import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';
|
|
||||||
import { _extractCommonName } from '../helpers/_extractCommonName';
|
|
||||||
import { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';
|
|
||||||
import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';
|
|
||||||
|
|
||||||
let certificatesCache: Certificate[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Начиная с версии плагина 2.0.13292 есть возможность получить сертификаты из закрытых ключей
|
|
||||||
* Возвращает список сертификатов, доступных пользователю в системе
|
|
||||||
*
|
|
||||||
* @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов
|
|
||||||
* @returns список сертификатов
|
|
||||||
*/
|
|
||||||
export const getContainerCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {
|
|
||||||
const { cadesplugin } = window;
|
|
||||||
|
|
||||||
if (!resetCache && certificatesCache) {
|
|
||||||
return certificatesCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
return eval(
|
|
||||||
_generateCadesFn(function getContainerCertificates(): Certificate[] {
|
|
||||||
let cadesStore;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
void (
|
|
||||||
__cadesAsyncToken__ +
|
|
||||||
cadesStore.Open(
|
|
||||||
cadesplugin.CADESCOM_CONTAINER_STORE,
|
|
||||||
cadesplugin.CAPICOM_MY_STORE,
|
|
||||||
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');
|
|
||||||
}
|
|
||||||
|
|
||||||
let cadesCertificates;
|
|
||||||
let cadesCertificatesCount;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;
|
|
||||||
|
|
||||||
if (cadesCertificates) {
|
|
||||||
cadesCertificates =
|
|
||||||
__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Не рассматриваются сертификаты, в которых отсутствует закрытый ключ
|
|
||||||
* или не действительны на данный момент
|
|
||||||
*/
|
|
||||||
cadesCertificates =
|
|
||||||
__cadesAsyncToken__ +
|
|
||||||
cadesCertificates.Find(
|
|
||||||
cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,
|
|
||||||
CAPICOM_PROPID_KEY_PROV_INFO,
|
|
||||||
);
|
|
||||||
|
|
||||||
cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cadesCertificatesCount) {
|
|
||||||
throw new Error('Нет доступных сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
const certificateList: Certificate[] = [];
|
|
||||||
|
|
||||||
try {
|
|
||||||
while (cadesCertificatesCount) {
|
|
||||||
const cadesCertificate: CadesCertificate =
|
|
||||||
__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);
|
|
||||||
|
|
||||||
certificateList.push(
|
|
||||||
new Certificate(
|
|
||||||
cadesCertificate,
|
|
||||||
_extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.IssuerName,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.SubjectName,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.Thumbprint,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.ValidFromDate,
|
|
||||||
__cadesAsyncToken__ + cadesCertificate.ValidToDate,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
cadesCertificatesCount--;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
cadesStore.Close();
|
|
||||||
|
|
||||||
certificatesCache = certificateList;
|
|
||||||
|
|
||||||
return certificatesCache;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
});
|
|
@ -1,10 +1,6 @@
|
|||||||
export * from './getCertificate';
|
export * from './getCertificate';
|
||||||
export * from './getUserCertificates';
|
export * from './getUserCertificates';
|
||||||
export * from './getAllUserCertificates';
|
export * from './getAllUserCertificates';
|
||||||
export * from './getContainerCertificates';
|
|
||||||
export * from './getAllContainerCertificates';
|
|
||||||
export * from './getCertificates';
|
|
||||||
export * from './getAllCertificates';
|
|
||||||
export * from './getSystemInfo';
|
export * from './getSystemInfo';
|
||||||
export * from './isValidSystemSetup';
|
export * from './isValidSystemSetup';
|
||||||
export * from './createXMLSignature';
|
export * from './createXMLSignature';
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
import { TagsTranslations } from './tags-translations';
|
import { TagsTranslations } from './tags-translations';
|
||||||
|
|
||||||
export const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [
|
export const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [
|
||||||
{ possibleNames: ['UN', 'UnstructuredName'], translation: 'Неструктурированное имя' },
|
{ possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },
|
||||||
{ possibleNames: ['CN', 'commonName'], translation: 'Удостоверяющий центр' },
|
{ possibleNames: ['CN'], translation: 'Удостоверяющий центр' },
|
||||||
{ possibleNames: ['C', 'countryName'], translation: 'Страна' },
|
{ possibleNames: ['C'], translation: 'Страна' },
|
||||||
{ possibleNames: ['S', 'ST', 'stateOrProvinceName'], translation: 'Регион' },
|
{ possibleNames: ['S'], translation: 'Регион' },
|
||||||
{ possibleNames: ['STREET', 'streetAddress'], translation: 'Адрес' },
|
{ possibleNames: ['STREET'], translation: 'Адрес' },
|
||||||
{ possibleNames: ['O', 'organizationName'], translation: 'Компания' },
|
{ possibleNames: ['O'], translation: 'Компания' },
|
||||||
{ possibleNames: ['OU', 'organizationalUnitName'], translation: 'Тип' },
|
{ possibleNames: ['OU'], translation: 'Тип' },
|
||||||
{ possibleNames: ['T', 'TITLE'], translation: 'Должность' },
|
{ possibleNames: ['T'], translation: 'Должность' },
|
||||||
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
|
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
|
||||||
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
|
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
|
||||||
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
|
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
|
||||||
{ possibleNames: ['ИНН', 'ИННФЛ', 'ИНН ФЛ', 'INN', 'ИНН физического лица'], translation: 'ИНН' },
|
{ possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
|
||||||
{ possibleNames: ['ИННЮЛ', 'ИНН ЮЛ', 'INN LE', 'INNLE', 'ИНН организации'], translation: 'ИНН организации' },
|
{ possibleNames: ['E'], translation: 'Email' },
|
||||||
{ possibleNames: ['E', 'email', 'emailAddress', 'pkcs9email'], translation: 'Email' },
|
{ possibleNames: ['L'], translation: 'Город' },
|
||||||
{ possibleNames: ['L', 'localityName'], translation: 'Город' },
|
|
||||||
];
|
];
|
||||||
|
@ -2,10 +2,6 @@ export const OIDS_DICTIONARY = {
|
|||||||
'1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',
|
'1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',
|
||||||
'1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"',
|
'1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"',
|
||||||
'1.2.643.3.131.1.1': 'ИНН',
|
'1.2.643.3.131.1.1': 'ИНН',
|
||||||
'1.2.643.100.4': 'ИНН организации',
|
|
||||||
'1.2.643.100.1': 'ОГРН',
|
|
||||||
'1.2.643.100.5': 'ОГРНИП',
|
|
||||||
'1.2.643.100.3': 'СНИЛС',
|
|
||||||
'1.2.643.3.141.1.1': 'РНС ФСС',
|
'1.2.643.3.141.1.1': 'РНС ФСС',
|
||||||
'1.2.643.3.141.1.2': 'КП ФСС',
|
'1.2.643.3.141.1.2': 'КП ФСС',
|
||||||
'1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.',
|
'1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.',
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
import { TagsTranslations } from './tags-translations';
|
import { TagsTranslations } from './tags-translations';
|
||||||
|
|
||||||
export const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [
|
export const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [
|
||||||
{ possibleNames: ['UN', 'UnstructuredName'], translation: 'Неструктурированное имя' },
|
{ possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },
|
||||||
{ possibleNames: ['CN', 'commonName'], translation: 'Владелец' },
|
{ possibleNames: ['CN'], translation: 'Владелец' },
|
||||||
{ possibleNames: ['SN', 'surname'], translation: 'Фамилия' },
|
{ possibleNames: ['SN'], translation: 'Фамилия' },
|
||||||
{ possibleNames: ['G', 'givenName', 'gn'], translation: 'Имя Отчество' },
|
{ possibleNames: ['G'], translation: 'Имя Отчество' },
|
||||||
{ possibleNames: ['C', 'countryName'], translation: 'Страна' },
|
{ possibleNames: ['C'], translation: 'Страна' },
|
||||||
{ possibleNames: ['S', 'ST', 'stateOrProvinceName'], translation: 'Регион' },
|
{ possibleNames: ['S'], translation: 'Регион' },
|
||||||
{ possibleNames: ['STREET', 'streetAddress'], translation: 'Адрес' },
|
{ possibleNames: ['STREET'], translation: 'Адрес' },
|
||||||
{ possibleNames: ['O', 'organizationName'], translation: 'Компания' },
|
{ possibleNames: ['O'], translation: 'Компания' },
|
||||||
{ possibleNames: ['OU', 'organizationalUnitName'], translation: 'Отдел/подразделение' },
|
{ possibleNames: ['OU'], translation: 'Отдел/подразделение' },
|
||||||
{ possibleNames: ['T', 'TITLE'], translation: 'Должность' },
|
{ possibleNames: ['T'], translation: 'Должность' },
|
||||||
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
|
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
|
||||||
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
|
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
|
||||||
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
|
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
|
||||||
{ possibleNames: ['ИНН', 'ИННФЛ', 'ИНН ФЛ', 'INN', 'ИНН физического лица'], translation: 'ИНН' },
|
{ possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
|
||||||
{ possibleNames: ['ИННЮЛ', 'ИНН ЮЛ', 'INN LE', 'INNLE', 'ИНН организации'], translation: 'ИНН организации' },
|
{ possibleNames: ['E'], translation: 'Email' },
|
||||||
{ possibleNames: ['E', 'email', 'emailAddress', 'pkcs9email'], translation: 'Email' },
|
{ possibleNames: ['L'], translation: 'Город' },
|
||||||
{ possibleNames: ['L', 'localityName'], translation: 'Город' },
|
|
||||||
];
|
];
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { CadesCertificate } from '../api/certificate';
|
import { CadesCertificate } from '../api/certificate';
|
||||||
import { _afterPluginsLoaded } from './_afterPluginsLoaded';
|
import { _afterPluginsLoaded } from './_afterPluginsLoaded';
|
||||||
import { _getCadesUserCert } from './_getCadesUserCert';
|
import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';
|
||||||
import { _getCadesContainerCert } from './_getCadesContainerCert';
|
import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Возвращает сертификат в формате Cades по отпечатку
|
* Возвращает сертификат в формате Cades по отпечатку
|
||||||
@ -10,17 +10,79 @@ import { _getCadesContainerCert } from './_getCadesContainerCert';
|
|||||||
* @returns сертификат в формате Cades
|
* @returns сертификат в формате Cades
|
||||||
*/
|
*/
|
||||||
export const _getCadesCert = _afterPluginsLoaded(
|
export const _getCadesCert = _afterPluginsLoaded(
|
||||||
async (thumbprint: string): Promise<CadesCertificate> => {
|
(thumbprint: string): CadesCertificate => {
|
||||||
let cadesCertificate: CadesCertificate;
|
const { cadesplugin } = window;
|
||||||
|
|
||||||
try {
|
return eval(
|
||||||
cadesCertificate = await _getCadesUserCert(thumbprint);
|
_generateCadesFn(function _getCadesCert() {
|
||||||
} catch (error) {
|
let cadesStore;
|
||||||
console.log(error);
|
|
||||||
|
|
||||||
cadesCertificate = await _getCadesContainerCert(thumbprint);
|
try {
|
||||||
}
|
cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
return cadesCertificate;
|
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cadesStore) {
|
||||||
|
throw new Error('Не удалось получить доступ к хранилищу сертификатов');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
void (
|
||||||
|
__cadesAsyncToken__ +
|
||||||
|
cadesStore.Open(
|
||||||
|
cadesplugin.CAPICOM_CURRENT_USER_STORE,
|
||||||
|
cadesplugin.CAPICOM_MY_STORE,
|
||||||
|
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
|
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');
|
||||||
|
}
|
||||||
|
|
||||||
|
let cadesCertificateList;
|
||||||
|
let certificatesCount;
|
||||||
|
|
||||||
|
try {
|
||||||
|
cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;
|
||||||
|
certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
|
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!certificatesCount) {
|
||||||
|
throw new Error('Нет доступных сертификатов');
|
||||||
|
}
|
||||||
|
|
||||||
|
let cadesCertificate: CadesCertificate;
|
||||||
|
|
||||||
|
try {
|
||||||
|
cadesCertificateList =
|
||||||
|
__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);
|
||||||
|
|
||||||
|
const count = __cadesAsyncToken__ + cadesCertificateList.Count;
|
||||||
|
|
||||||
|
if (!count) {
|
||||||
|
throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`);
|
||||||
|
}
|
||||||
|
|
||||||
|
cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
|
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');
|
||||||
|
}
|
||||||
|
|
||||||
|
cadesStore.Close();
|
||||||
|
|
||||||
|
return cadesCertificate;
|
||||||
|
}),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
import { CadesCertificate } from '../api/certificate';
|
|
||||||
import { _afterPluginsLoaded } from './_afterPluginsLoaded';
|
|
||||||
import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';
|
|
||||||
import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку из хранилища закрытого ключа
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export const _getCadesContainerCert = _afterPluginsLoaded(
|
|
||||||
(thumbprint: string): CadesCertificate => {
|
|
||||||
const { cadesplugin } = window;
|
|
||||||
|
|
||||||
return eval(
|
|
||||||
_generateCadesFn(function _getCadesCert() {
|
|
||||||
let cadesStore;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cadesStore) {
|
|
||||||
throw new Error('Не удалось получить доступ к хранилищу сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
void (
|
|
||||||
__cadesAsyncToken__ +
|
|
||||||
cadesStore.Open(
|
|
||||||
cadesplugin.CADESCOM_CONTAINER_STORE,
|
|
||||||
cadesplugin.CAPICOM_MY_STORE,
|
|
||||||
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища закрытого ключа');
|
|
||||||
}
|
|
||||||
|
|
||||||
let cadesCertificateList;
|
|
||||||
let certificatesCount;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;
|
|
||||||
certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
_extractMeaningfulErrorMessage(error) ||
|
|
||||||
'Ошибка получения списка сертификатов из хранилища закрытого ключа',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!certificatesCount) {
|
|
||||||
throw new Error('Нет доступных сертификатов в хранилище закрытого ключа');
|
|
||||||
}
|
|
||||||
|
|
||||||
let cadesCertificate: CadesCertificate;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesCertificateList =
|
|
||||||
__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);
|
|
||||||
|
|
||||||
const count = __cadesAsyncToken__ + cadesCertificateList.Count;
|
|
||||||
|
|
||||||
if (!count) {
|
|
||||||
throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден в хранилище закрытого ключа`);
|
|
||||||
}
|
|
||||||
|
|
||||||
cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата из хранилища закрытого ключа',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
cadesStore.Close();
|
|
||||||
|
|
||||||
return cadesCertificate;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
@ -1,92 +0,0 @@
|
|||||||
import { CadesCertificate } from '../api/certificate';
|
|
||||||
import { _afterPluginsLoaded } from './_afterPluginsLoaded';
|
|
||||||
import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';
|
|
||||||
import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Возвращает сертификат в формате Cades по отпечатку из хранилища пользователя
|
|
||||||
*
|
|
||||||
* @param thumbprint - отпечаток сертификата
|
|
||||||
* @returns сертификат в формате Cades
|
|
||||||
*/
|
|
||||||
export const _getCadesUserCert = _afterPluginsLoaded(
|
|
||||||
(thumbprint: string): CadesCertificate => {
|
|
||||||
const { cadesplugin } = window;
|
|
||||||
|
|
||||||
return eval(
|
|
||||||
_generateCadesFn(function _getCadesCert() {
|
|
||||||
let cadesStore;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cadesStore) {
|
|
||||||
throw new Error('Не удалось получить доступ к хранилищу сертификатов');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
void (
|
|
||||||
__cadesAsyncToken__ +
|
|
||||||
cadesStore.Open(
|
|
||||||
cadesplugin.CAPICOM_CURRENT_USER_STORE,
|
|
||||||
cadesplugin.CAPICOM_MY_STORE,
|
|
||||||
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища пользователя');
|
|
||||||
}
|
|
||||||
|
|
||||||
let cadesCertificateList;
|
|
||||||
let certificatesCount;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;
|
|
||||||
certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов из хранилища пользователя',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!certificatesCount) {
|
|
||||||
throw new Error('Нет доступных сертификатов в хранилище пользователя');
|
|
||||||
}
|
|
||||||
|
|
||||||
let cadesCertificate: CadesCertificate;
|
|
||||||
|
|
||||||
try {
|
|
||||||
cadesCertificateList =
|
|
||||||
__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);
|
|
||||||
|
|
||||||
const count = __cadesAsyncToken__ + cadesCertificateList.Count;
|
|
||||||
|
|
||||||
if (!count) {
|
|
||||||
throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден в хранилище пользователя`);
|
|
||||||
}
|
|
||||||
|
|
||||||
cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата из хранилища пользователя',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
cadesStore.Close();
|
|
||||||
|
|
||||||
return cadesCertificate;
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
@ -18,8 +18,8 @@ describe('_parseCertInfo', () => {
|
|||||||
'OID.1.2.643.6.3.1.4.1=Петров',
|
'OID.1.2.643.6.3.1.4.1=Петров',
|
||||||
'UNKNOWN=неизвестный тэг',
|
'UNKNOWN=неизвестный тэг',
|
||||||
'E=email@example.ru',
|
'E=email@example.ru',
|
||||||
'INN=997811514257',
|
'INN=007811514257',
|
||||||
'ИНН ЮЛ=007811514257',
|
'ИНН организации=007811514257',
|
||||||
'OGRN=1127847087885',
|
'OGRN=1127847087885',
|
||||||
'SNILS=11617693460',
|
'SNILS=11617693460',
|
||||||
].join(', ');
|
].join(', ');
|
||||||
@ -96,13 +96,13 @@ describe('_parseCertInfo', () => {
|
|||||||
isTranslated: true,
|
isTranslated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: '997811514257',
|
description: '007811514257',
|
||||||
title: 'ИНН',
|
title: 'ИНН',
|
||||||
isTranslated: true,
|
isTranslated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: '007811514257',
|
description: '007811514257',
|
||||||
title: 'ИНН организации',
|
title: 'ИНН',
|
||||||
isTranslated: true,
|
isTranslated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -128,8 +128,8 @@ describe('_parseCertInfo', () => {
|
|||||||
'L=Санкт-Петербург',
|
'L=Санкт-Петербург',
|
||||||
'S=78 Санкт-Петербург',
|
'S=78 Санкт-Петербург',
|
||||||
'C=RU',
|
'C=RU',
|
||||||
'INN=997813317783',
|
'INN=007813317783',
|
||||||
'INNLE=007813317783',
|
'ИНН организации=007813317783',
|
||||||
'OGRN=1057810150892',
|
'OGRN=1057810150892',
|
||||||
'E=uc@sampokey.ru',
|
'E=uc@sampokey.ru',
|
||||||
].join(', ');
|
].join(', ');
|
||||||
@ -176,13 +176,13 @@ describe('_parseCertInfo', () => {
|
|||||||
isTranslated: true,
|
isTranslated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: '997813317783',
|
description: '007813317783',
|
||||||
title: 'ИНН',
|
title: 'ИНН',
|
||||||
isTranslated: true,
|
isTranslated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: '007813317783',
|
description: '007813317783',
|
||||||
title: 'ИНН организации',
|
title: 'ИНН',
|
||||||
isTranslated: true,
|
isTranslated: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
23
src/vendor/cadesplugin_api.js
vendored
23
src/vendor/cadesplugin_api.js
vendored
@ -13,7 +13,6 @@
|
|||||||
var isYandex = 0;
|
var isYandex = 0;
|
||||||
var canPromise = !!window.Promise;
|
var canPromise = !!window.Promise;
|
||||||
var cadesplugin_loaded_event_recieved = false;
|
var cadesplugin_loaded_event_recieved = false;
|
||||||
var isFireFoxExtensionLoaded = false;
|
|
||||||
var cadesplugin;
|
var cadesplugin;
|
||||||
|
|
||||||
if(canPromise)
|
if(canPromise)
|
||||||
@ -237,14 +236,6 @@
|
|||||||
cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;
|
cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;
|
||||||
cadesplugin.AT_KEYEXCHANGE = 1;
|
cadesplugin.AT_KEYEXCHANGE = 1;
|
||||||
cadesplugin.AT_SIGNATURE = 2;
|
cadesplugin.AT_SIGNATURE = 2;
|
||||||
|
|
||||||
cadesplugin.CARRIER_FLAG_REMOVABLE = 1;
|
|
||||||
cadesplugin.CARRIER_FLAG_UNIQUE = 2;
|
|
||||||
cadesplugin.CARRIER_FLAG_PROTECTED = 4;
|
|
||||||
cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;
|
|
||||||
cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;
|
|
||||||
cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;
|
|
||||||
cadesplugin.CARRIER_FLAG_VIRTUAL = 128;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function async_spawn(generatorFunc) {
|
function async_spawn(generatorFunc) {
|
||||||
@ -491,17 +482,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function firefox_or_safari_nmcades_onload() {
|
function firefox_or_safari_nmcades_onload() {
|
||||||
if (window.cadesplugin_extension_loaded_callback)
|
|
||||||
window.cadesplugin_extension_loaded_callback();
|
|
||||||
isFireFoxExtensionLoaded = true;
|
|
||||||
cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);
|
cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nmcades_api_onload() {
|
function nmcades_api_onload () {
|
||||||
if (!isIE() && !isFireFox && !isSafari) {
|
|
||||||
if (window.cadesplugin_extension_loaded_callback)
|
|
||||||
window.cadesplugin_extension_loaded_callback();
|
|
||||||
}
|
|
||||||
window.postMessage("cadesplugin_echo_request", "*");
|
window.postMessage("cadesplugin_echo_request", "*");
|
||||||
window.addEventListener("message", function (event){
|
window.addEventListener("message", function (event){
|
||||||
if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded"))
|
if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded"))
|
||||||
@ -616,8 +600,7 @@
|
|||||||
return;
|
return;
|
||||||
if(isFireFox)
|
if(isFireFox)
|
||||||
{
|
{
|
||||||
if (!isFireFoxExtensionLoaded)
|
show_firefox_missing_extension_dialog();
|
||||||
show_firefox_missing_extension_dialog();
|
|
||||||
}
|
}
|
||||||
plugin_resolved = 1;
|
plugin_resolved = 1;
|
||||||
if(canPromise)
|
if(canPromise)
|
||||||
@ -709,7 +692,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Export
|
//Export
|
||||||
cadesplugin.JSModuleVersion = "2.3.2";
|
cadesplugin.JSModuleVersion = "2.3.1";
|
||||||
cadesplugin.async_spawn = async_spawn;
|
cadesplugin.async_spawn = async_spawn;
|
||||||
cadesplugin.set = set_pluginObject;
|
cadesplugin.set = set_pluginObject;
|
||||||
cadesplugin.set_log_level = set_log_level;
|
cadesplugin.set_log_level = set_log_level;
|
||||||
|
Loading…
Reference in New Issue
Block a user