mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2024-11-23 16:44:59 +03:00
v.2.3.1 Release (#21)
- Обновил cadesplugin_api до версии `2.3.1` - Обновления безопасности - Обновления зависимостей - Исправлена работа примера script-tag - Прекращена поддержка примеров на React и Angular - Исправления в Readme - Изменения в лицензии
This commit is contained in:
parent
d8f2ba6c23
commit
15a1b84e94
1
LICENSE
1
LICENSE
@ -1,6 +1,7 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 Vitalii Goma
|
Copyright (c) 2020 Vitalii Goma
|
||||||
|
Copyright (c) 2021 Artem Vasilev
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
94
README.md
94
README.md
@ -5,16 +5,18 @@
|
|||||||
|
|
||||||
<a name="cryptopro"></a>
|
<a name="cryptopro"></a>
|
||||||
# cryptoPro
|
# cryptoPro
|
||||||
Единое, асинхронное API для взаимодействия с КриптоПРО ЭЦП Browser Plug-In
|
Асинхронный JavaScript API для работы с КриптоПРО ЭЦП Browser Plug-In
|
||||||
|
|
||||||
> :warning: **Это форк проекта [vgoma/crypto-pro](https://github.com/vgoma/crypto-pro)**
|
> **Это форк проекта [vgoma/crypto-pro](https://github.com/vgoma/crypto-pro)**
|
||||||
>
|
>
|
||||||
> :warning: **API форка отличается от оригинала**: внимательно читайте README
|
> **API форка отличается от оригинала**: внимательно читайте README
|
||||||
|
|
||||||
| [![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/chrome/chrome_64x64.png)](https://www.chromium.org/getting-involved/download-chromium#TOC-Downloading-old-builds-of-Chrome-Chromium) | [![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/firefox/firefox_64x64.png)](https://ftp.mozilla.org/pub/firefox/releases/) | [![IE](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/archive/internet-explorer_9-11/internet-explorer_9-11_64x64.png)](https://www.microsoft.com/ru-ru/download/details.aspx?id=43374) | [![Opera](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/opera/opera_64x64.png)](http://get.opera.com/ftp/pub/opera/desktop/) |
|
| [![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/chrome/chrome_64x64.png)](https://www.chromium.org/getting-involved/download-chromium#TOC-Downloading-old-builds-of-Chrome-Chromium) | [![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/firefox/firefox_64x64.png)](https://ftp.mozilla.org/pub/firefox/releases/) | [![IE](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/archive/internet-explorer_9-11/internet-explorer_9-11_64x64.png)](https://www.microsoft.com/ru-ru/download/details.aspx?id=43374) | [![Opera](https://raw.githubusercontent.com/alrra/browser-logos/62.2.25/src/opera/opera_64x64.png)](http://get.opera.com/ftp/pub/opera/desktop/) |
|
||||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| __v45+__ с расширением [CryptoPro Extension for CAdES Browser Plug-in](https://chrome.google.com/webstore/detail/cryptopro-extension-for-c/iifchhfnnmpdbibifmljnfjhpififfog?utm_source=chrome-app-launcher-info-dialog) | __v43+__. Начиная с версии 52, с [расширением](https://www.cryptopro.ru/sites/default/files/products/cades/extensions/cryptopro_extension_for_cades_browser_plug_in-1.1.1-an+fx-windows.xpi) | __v9+__ с установленным [КриптоПро ЭЦП Browser plug-in](https://www.cryptopro.ru/products/cades/plugin) | __v40+__ с расширением [CryptoPro Extension for CAdES Browser Plug-in](https://addons.opera.com/en/extensions/details/cryptopro-extension-for-cades-browser-plug-in/) |
|
| __v45+__ с расширением [CryptoPro Extension for CAdES Browser Plug-in](https://chrome.google.com/webstore/detail/cryptopro-extension-for-c/iifchhfnnmpdbibifmljnfjhpififfog?utm_source=chrome-app-launcher-info-dialog) | __v43+__. Начиная с версии 52, с [расширением](https://www.cryptopro.ru/sites/default/files/products/cades/extensions/cryptopro_extension_for_cades_browser_plug_in-1.1.1-an+fx-windows.xpi) | __v9+__ с установленным [КриптоПро ЭЦП Browser plug-in](https://www.cryptopro.ru/products/cades/plugin) | __v40+__ с расширением [CryptoPro Extension for CAdES Browser Plug-in](https://addons.opera.com/en/extensions/details/cryptopro-extension-for-cades-browser-plug-in/) |
|
||||||
|
|
||||||
|
## Ошибка `Параметр задан неверно. (0x80070057)`
|
||||||
|
Если при попытке подписать сообщение с использованием PKCS#7 подписи падает такая ошибка, то читайте [этот issue](https://github.com/webmasterskaya/crypto-pro-js/issues/20)
|
||||||
|
|
||||||
- [cryptoPro](#cryptopro)
|
- [cryptoPro](#cryptopro)
|
||||||
- [Зачем мне этот пакет?](#why)
|
- [Зачем мне этот пакет?](#why)
|
||||||
@ -25,12 +27,9 @@
|
|||||||
- [Поддерживаемые СКЗИ](#supported-cist)
|
- [Поддерживаемые СКЗИ](#supported-cist)
|
||||||
- [Примеры](#examples)
|
- [Примеры](#examples)
|
||||||
- [Тэг script (UMD)](#example-script-tag)
|
- [Тэг script (UMD)](#example-script-tag)
|
||||||
- [Angular (ES Modules + Typescript)](#example-angular)
|
|
||||||
- [React (ES Modules + JavaScript)](#example-react)
|
|
||||||
- [Тем, кто хочет помочь](#developers)
|
- [Тем, кто хочет помочь](#developers)
|
||||||
- [Запуск режима разработки](#dev-mode)
|
- [Запуск режима разработки](#dev-mode)
|
||||||
- [Запуск тестов](#tests-execution)
|
- [Запуск тестов](#tests-execution)
|
||||||
- [Проверка работы примеров с React и Angular](#examples-testing)
|
|
||||||
- [Проверка пакета перед публикацией в NPM](#final-check)
|
- [Проверка пакета перед публикацией в NPM](#final-check)
|
||||||
- [Лицензия](#lisense)
|
- [Лицензия](#lisense)
|
||||||
|
|
||||||
@ -44,22 +43,22 @@
|
|||||||
## Установка
|
## Установка
|
||||||
Для NPM:
|
Для NPM:
|
||||||
```bash
|
```bash
|
||||||
npm install crypto-pro
|
npm install crypto-pro-js
|
||||||
```
|
```
|
||||||
|
|
||||||
Для Yarn:
|
Для Yarn:
|
||||||
```bash
|
```bash
|
||||||
yarn add crypto-pro
|
yarn add crypto-pro-js
|
||||||
```
|
```
|
||||||
|
|
||||||
Для Bower:
|
Для Bower:
|
||||||
```bash
|
```bash
|
||||||
bower install crypto-pro
|
bower install webmasterskaya/crypto-pro-js
|
||||||
```
|
```
|
||||||
|
|
||||||
Подключение пакета как UMD модуля через тэг script:
|
Подключение пакета как UMD модуля через тэг script:
|
||||||
```html
|
```html
|
||||||
<script src="crypto-pro/dist/crypto-pro.min.js"></script>
|
<script src="crypto-pro-js/dist/crypto-pro.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
window.cryptoPro.getUserCertificates()
|
window.cryptoPro.getUserCertificates()
|
||||||
.then(function (certificates) {
|
.then(function (certificates) {
|
||||||
@ -73,7 +72,7 @@ window.cryptoPro.getUserCertificates()
|
|||||||
|
|
||||||
Подключение пакета как ES модуля с Typescript или JavaScript:
|
Подключение пакета как ES модуля с Typescript или JavaScript:
|
||||||
```typescript
|
```typescript
|
||||||
import { getUserCertificates, Certificate } from 'crypto-pro';
|
import { getUserCertificates, Certificate } from 'crypto-pro-js';
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
let certificates: Certificate[];
|
let certificates: Certificate[];
|
||||||
@ -135,43 +134,6 @@ npm i
|
|||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="example-angular"></a>
|
|
||||||
### Angular (ES Modules + Typescript)
|
|
||||||
```bash
|
|
||||||
cd examples/angular
|
|
||||||
npm i
|
|
||||||
```
|
|
||||||
|
|
||||||
Запуск в режиме разработки:
|
|
||||||
```bash
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
Запуск в продакшн режиме:
|
|
||||||
```bash
|
|
||||||
npm run build
|
|
||||||
npm run serve
|
|
||||||
```
|
|
||||||
|
|
||||||
<a name="example-react"></a>
|
|
||||||
### React (ES Modules + JavaScript)
|
|
||||||
```bash
|
|
||||||
cd examples/react
|
|
||||||
npm i
|
|
||||||
```
|
|
||||||
|
|
||||||
Запуск в режиме разработки:
|
|
||||||
```bash
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
Запуск в продакшн режиме:
|
|
||||||
```bash
|
|
||||||
npm run build
|
|
||||||
npm run serve
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
<a name="developers"></a>
|
<a name="developers"></a>
|
||||||
# Тем, кто хочет помочь
|
# Тем, кто хочет помочь
|
||||||
Буду благодарен за расширение/улучшение/доработку API.
|
Буду благодарен за расширение/улучшение/доработку API.
|
||||||
@ -200,7 +162,7 @@ npm i
|
|||||||
npm link ../../
|
npm link ../../
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
> После выполнения `npm link ../../` в директории `examples/script-tag/node_modules` папка `crypto-pro` станет ярлыком,
|
> После выполнения `npm link ../../` в директории `examples/script-tag/node_modules` папка `crypto-pro-js` станет ярлыком,
|
||||||
> указывающим на папку содержащую локально собранный пакет.
|
> указывающим на папку содержащую локально собранный пакет.
|
||||||
|
|
||||||
<a name="tests-execution"></a>
|
<a name="tests-execution"></a>
|
||||||
@ -210,32 +172,6 @@ npm start
|
|||||||
npm test
|
npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="examples-testing"></a>
|
|
||||||
## Проверка работы примеров с React и Angular
|
|
||||||
React и Angular используют версию сборки пакета в формате ES модулей из директории `lib/`.
|
|
||||||
Для их запуска необходимо сначала собрать пакет выполнив:
|
|
||||||
```bash
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
После этого из папки `examples/angular` или `examples/react` залинковать пакет:
|
|
||||||
```bash
|
|
||||||
cd examples/angular
|
|
||||||
npm i
|
|
||||||
npm link ../../
|
|
||||||
```
|
|
||||||
|
|
||||||
И запустить пример в одном из двух режимов. В режиме разработки:
|
|
||||||
```bash
|
|
||||||
npm start
|
|
||||||
```
|
|
||||||
|
|
||||||
или в режиме продакшн:
|
|
||||||
```bash
|
|
||||||
npm run build
|
|
||||||
npm run serve
|
|
||||||
```
|
|
||||||
|
|
||||||
<a name="final-check"></a>
|
<a name="final-check"></a>
|
||||||
## Проверка пакета перед публикацией в NPM
|
## Проверка пакета перед публикацией в NPM
|
||||||
Необходимо протестировать работу в заявленных браузерах, сделав это на локально запакованной версии пакета.
|
Необходимо протестировать работу в заявленных браузерах, сделав это на локально запакованной версии пакета.
|
||||||
@ -268,7 +204,7 @@ npm unlink
|
|||||||
[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]: http://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
|
||||||
[travis-url]: https://www.travis-ci.com/kernusr/crypto-pro-js
|
[travis-url]: https://www.travis-ci.com/webmasterskaya/crypto-pro-js
|
||||||
[travis-image]: http://img.shields.io/travis/kernusr/crypto-pro-js/master.svg?style=flat
|
[travis-image]: http://img.shields.io/travis/webmasterskaya/crypto-pro-js/master.svg?style=flat
|
||||||
[coveralls-image]: https://coveralls.io/repos/github/kernusr/crypto-pro-js/badge.svg?branch=master
|
[coveralls-image]: https://coveralls.io/repos/github/webmasterskaya/crypto-pro-js/badge.svg?branch=master
|
||||||
[coveralls-url]: https://coveralls.io/github/kernusr/crypto-pro-js?branch=master
|
[coveralls-url]: https://coveralls.io/github/webmasterskaya/crypto-pro-js?branch=master
|
||||||
|
10
bower.json
10
bower.json
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "crypto-pro",
|
"name": "crypto-pro-js",
|
||||||
"description": "API для взаимодействия с КриптоПро",
|
"description": "Асинхронный JavaScript API для работы с КриптоПРО ЭЦП Browser Plug-In. Forked from https://github.com/vgoma/crypto-pro",
|
||||||
"main": "./lib/crypto-pro.js",
|
"main": "./lib/crypto-pro-js.js",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
"kern.usr <kern.usr@gmail.com>",
|
||||||
"vgoma <vgoma@yandex.ru>"
|
"vgoma <vgoma@yandex.ru>"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -10,11 +11,12 @@
|
|||||||
"crypto",
|
"crypto",
|
||||||
"cryptopro",
|
"cryptopro",
|
||||||
"crypto-pro",
|
"crypto-pro",
|
||||||
|
"crypto-pro-js",
|
||||||
"cades",
|
"cades",
|
||||||
"КриптоПро",
|
"КриптоПро",
|
||||||
"Крипто ПРО"
|
"Крипто ПРО"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/vgoma/crypto-pro",
|
"homepage": "https://github.com/webmasterskaya/crypto-pro-js",
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"**/.*",
|
"**/.*",
|
||||||
"/*.js",
|
"/*.js",
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# Editor configuration, see https://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
max_line_length = off
|
|
||||||
trim_trailing_whitespace = false
|
|
46
examples/angular/.gitignore
vendored
46
examples/angular/.gitignore
vendored
@ -1,46 +0,0 @@
|
|||||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# compiled output
|
|
||||||
/dist
|
|
||||||
/tmp
|
|
||||||
/out-tsc
|
|
||||||
# Only exists if Bazel was run
|
|
||||||
/bazel-out
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
|
|
||||||
# profiling files
|
|
||||||
chrome-profiler-events*.json
|
|
||||||
speed-measure-plugin*.json
|
|
||||||
|
|
||||||
# IDEs and editors
|
|
||||||
/.idea
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
.c9/
|
|
||||||
*.launch
|
|
||||||
.settings/
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# IDE - VSCode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
.history/*
|
|
||||||
|
|
||||||
# misc
|
|
||||||
/.sass-cache
|
|
||||||
/connect.lock
|
|
||||||
/coverage
|
|
||||||
/libpeerconnection.log
|
|
||||||
npm-debug.log
|
|
||||||
yarn-error.log
|
|
||||||
testem.log
|
|
||||||
/typings
|
|
||||||
|
|
||||||
# System Files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
@ -1,27 +0,0 @@
|
|||||||
# Angular
|
|
||||||
|
|
||||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.7.
|
|
||||||
|
|
||||||
## Development server
|
|
||||||
|
|
||||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
||||||
|
|
||||||
## Code scaffolding
|
|
||||||
|
|
||||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
|
|
||||||
|
|
||||||
## Running unit tests
|
|
||||||
|
|
||||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
||||||
|
|
||||||
## Running end-to-end tests
|
|
||||||
|
|
||||||
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
|
|
||||||
|
|
||||||
## Further help
|
|
||||||
|
|
||||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
|
|
@ -1,124 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
||||||
"version": 1,
|
|
||||||
"newProjectRoot": "projects",
|
|
||||||
"projects": {
|
|
||||||
"angular": {
|
|
||||||
"projectType": "application",
|
|
||||||
"schematics": {},
|
|
||||||
"root": "",
|
|
||||||
"sourceRoot": "src",
|
|
||||||
"prefix": "app",
|
|
||||||
"architect": {
|
|
||||||
"build": {
|
|
||||||
"builder": "@angular-devkit/build-angular:browser",
|
|
||||||
"options": {
|
|
||||||
"outputPath": "dist/angular",
|
|
||||||
"index": "src/index.html",
|
|
||||||
"main": "src/main.ts",
|
|
||||||
"polyfills": "src/polyfills.ts",
|
|
||||||
"tsConfig": "tsconfig.app.json",
|
|
||||||
"aot": true,
|
|
||||||
"assets": [
|
|
||||||
"src/favicon.ico",
|
|
||||||
"src/assets"
|
|
||||||
],
|
|
||||||
"styles": [
|
|
||||||
"src/styles.css"
|
|
||||||
],
|
|
||||||
"scripts": []
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"fileReplacements": [
|
|
||||||
{
|
|
||||||
"replace": "src/environments/environment.ts",
|
|
||||||
"with": "src/environments/environment.prod.ts"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"optimization": true,
|
|
||||||
"outputHashing": "all",
|
|
||||||
"sourceMap": false,
|
|
||||||
"extractCss": true,
|
|
||||||
"namedChunks": false,
|
|
||||||
"extractLicenses": true,
|
|
||||||
"vendorChunk": false,
|
|
||||||
"buildOptimizer": true,
|
|
||||||
"budgets": [
|
|
||||||
{
|
|
||||||
"type": "initial",
|
|
||||||
"maximumWarning": "2mb",
|
|
||||||
"maximumError": "5mb"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "anyComponentStyle",
|
|
||||||
"maximumWarning": "6kb",
|
|
||||||
"maximumError": "10kb"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"serve": {
|
|
||||||
"builder": "@angular-devkit/build-angular:dev-server",
|
|
||||||
"options": {
|
|
||||||
"browserTarget": "angular:build"
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"browserTarget": "angular:build:production"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"extract-i18n": {
|
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
||||||
"options": {
|
|
||||||
"browserTarget": "angular:build"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"test": {
|
|
||||||
"builder": "@angular-devkit/build-angular:karma",
|
|
||||||
"options": {
|
|
||||||
"main": "src/test.ts",
|
|
||||||
"polyfills": "src/polyfills.ts",
|
|
||||||
"tsConfig": "tsconfig.spec.json",
|
|
||||||
"karmaConfig": "karma.conf.js",
|
|
||||||
"assets": [
|
|
||||||
"src/favicon.ico",
|
|
||||||
"src/assets"
|
|
||||||
],
|
|
||||||
"styles": [
|
|
||||||
"src/styles.css"
|
|
||||||
],
|
|
||||||
"scripts": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"lint": {
|
|
||||||
"builder": "@angular-devkit/build-angular:tslint",
|
|
||||||
"options": {
|
|
||||||
"tsConfig": [
|
|
||||||
"tsconfig.app.json",
|
|
||||||
"tsconfig.spec.json",
|
|
||||||
"e2e/tsconfig.json"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/node_modules/**"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"e2e": {
|
|
||||||
"builder": "@angular-devkit/build-angular:protractor",
|
|
||||||
"options": {
|
|
||||||
"protractorConfig": "e2e/protractor.conf.js",
|
|
||||||
"devServerTarget": "angular:serve"
|
|
||||||
},
|
|
||||||
"configurations": {
|
|
||||||
"production": {
|
|
||||||
"devServerTarget": "angular:serve:production"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
"defaultProject": "angular"
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/node_modules/browserslist/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/node_modules/browserslist/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
@ -1,32 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Protractor configuration file, see link for more information
|
|
||||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
|
||||||
|
|
||||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type { import("protractor").Config }
|
|
||||||
*/
|
|
||||||
exports.config = {
|
|
||||||
allScriptsTimeout: 11000,
|
|
||||||
specs: [
|
|
||||||
'./src/**/*.e2e-spec.ts'
|
|
||||||
],
|
|
||||||
capabilities: {
|
|
||||||
browserName: 'chrome'
|
|
||||||
},
|
|
||||||
directConnect: true,
|
|
||||||
baseUrl: 'http://localhost:4200/',
|
|
||||||
framework: 'jasmine',
|
|
||||||
jasmineNodeOpts: {
|
|
||||||
showColors: true,
|
|
||||||
defaultTimeoutInterval: 30000,
|
|
||||||
print: function() {}
|
|
||||||
},
|
|
||||||
onPrepare() {
|
|
||||||
require('ts-node').register({
|
|
||||||
project: require('path').join(__dirname, './tsconfig.json')
|
|
||||||
});
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,23 +0,0 @@
|
|||||||
import { AppPage } from './app.po';
|
|
||||||
import { browser, logging } from 'protractor';
|
|
||||||
|
|
||||||
describe('workspace-project App', () => {
|
|
||||||
let page: AppPage;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
page = new AppPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should display welcome message', () => {
|
|
||||||
page.navigateTo();
|
|
||||||
expect(page.getTitleText()).toEqual('angular app is running!');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async () => {
|
|
||||||
// Assert that there are no errors emitted from the browser
|
|
||||||
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
|
|
||||||
expect(logs).not.toContain(jasmine.objectContaining({
|
|
||||||
level: logging.Level.SEVERE,
|
|
||||||
} as logging.Entry));
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,11 +0,0 @@
|
|||||||
import { browser, by, element } from 'protractor';
|
|
||||||
|
|
||||||
export class AppPage {
|
|
||||||
navigateTo(): Promise<unknown> {
|
|
||||||
return browser.get(browser.baseUrl) as Promise<unknown>;
|
|
||||||
}
|
|
||||||
|
|
||||||
getTitleText(): Promise<string> {
|
|
||||||
return element(by.css('app-root .content span')).getText() as Promise<string>;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "../out-tsc/e2e",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"types": [
|
|
||||||
"jasmine",
|
|
||||||
"jasminewd2",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
// Karma configuration file, see link for more information
|
|
||||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
|
||||||
config.set({
|
|
||||||
basePath: '',
|
|
||||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
||||||
plugins: [
|
|
||||||
require('karma-jasmine'),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-jasmine-html-reporter'),
|
|
||||||
require('karma-coverage-istanbul-reporter'),
|
|
||||||
require('@angular-devkit/build-angular/plugins/karma')
|
|
||||||
],
|
|
||||||
client: {
|
|
||||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
||||||
},
|
|
||||||
coverageIstanbulReporter: {
|
|
||||||
dir: require('path').join(__dirname, './coverage/angular'),
|
|
||||||
reports: ['html', 'lcovonly', 'text-summary'],
|
|
||||||
fixWebpackSourcePaths: true
|
|
||||||
},
|
|
||||||
reporters: ['progress', 'kjhtml'],
|
|
||||||
port: 9876,
|
|
||||||
colors: true,
|
|
||||||
logLevel: config.LOG_INFO,
|
|
||||||
autoWatch: true,
|
|
||||||
browsers: ['Chrome'],
|
|
||||||
singleRun: false,
|
|
||||||
restartOnFileChange: true
|
|
||||||
});
|
|
||||||
};
|
|
@ -1,51 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "crypto-pro-example-angular",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"description": "Пример использования пакета crypto-pro в typescript проекте с angular",
|
|
||||||
"scripts": {
|
|
||||||
"serve": "static --host-address localhost --port 8082 dist/angular",
|
|
||||||
"ng": "ng",
|
|
||||||
"start": "ng serve",
|
|
||||||
"build": "ng build",
|
|
||||||
"test": "ng test",
|
|
||||||
"lint": "ng lint",
|
|
||||||
"e2e": "ng e2e"
|
|
||||||
},
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@angular/animations": "~9.0.7",
|
|
||||||
"@angular/common": "~9.0.7",
|
|
||||||
"@angular/compiler": "~9.0.7",
|
|
||||||
"@angular/core": "~9.0.7",
|
|
||||||
"@angular/forms": "~9.0.7",
|
|
||||||
"@angular/platform-browser": "~9.0.7",
|
|
||||||
"@angular/platform-browser-dynamic": "~9.0.7",
|
|
||||||
"@angular/router": "~9.0.7",
|
|
||||||
"crypto-pro-js": "^2.3.0",
|
|
||||||
"rxjs": "~6.5.4",
|
|
||||||
"tslib": "^1.10.0",
|
|
||||||
"zone.js": "~0.10.2"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@angular-devkit/build-angular": "~0.900.7",
|
|
||||||
"@angular/cli": "~9.0.7",
|
|
||||||
"@angular/compiler-cli": "~9.0.7",
|
|
||||||
"@angular/language-service": "~9.0.7",
|
|
||||||
"@types/jasmine": "~3.5.0",
|
|
||||||
"@types/jasminewd2": "~2.0.3",
|
|
||||||
"@types/node": "^12.11.1",
|
|
||||||
"codelyzer": "^5.1.2",
|
|
||||||
"jasmine-core": "~3.5.0",
|
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
|
||||||
"karma": "~4.3.0",
|
|
||||||
"karma-chrome-launcher": "~3.1.0",
|
|
||||||
"karma-coverage-istanbul-reporter": "~2.1.0",
|
|
||||||
"karma-jasmine": "~2.0.1",
|
|
||||||
"karma-jasmine-html-reporter": "^1.4.2",
|
|
||||||
"node-static": "0.7.11",
|
|
||||||
"protractor": "~5.4.3",
|
|
||||||
"ts-node": "~8.3.0",
|
|
||||||
"tslint": "~5.18.0",
|
|
||||||
"typescript": "~3.7.5"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
<app-crypto-pro></app-crypto-pro>
|
|
@ -1,24 +0,0 @@
|
|||||||
import { TestBed, async } from '@angular/core/testing';
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
|
|
||||||
describe('AppComponent', () => {
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent
|
|
||||||
],
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
it('should create the app', () => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.componentInstance;
|
|
||||||
expect(app).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should have as title 'angular'`, () => {
|
|
||||||
const fixture = TestBed.createComponent(AppComponent);
|
|
||||||
const app = fixture.componentInstance;
|
|
||||||
expect(app.title).toEqual('angular');
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,10 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-root',
|
|
||||||
templateUrl: './app.component.html',
|
|
||||||
styleUrls: ['./app.component.css']
|
|
||||||
})
|
|
||||||
export class AppComponent {
|
|
||||||
title = 'angular';
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
import { NgModule } from '@angular/core';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
|
||||||
import { CryptoProComponent } from './crypto-pro/crypto-pro.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
AppComponent,
|
|
||||||
CryptoProComponent
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
FormsModule
|
|
||||||
],
|
|
||||||
providers: [],
|
|
||||||
bootstrap: [AppComponent]
|
|
||||||
})
|
|
||||||
export class AppModule { }
|
|
@ -1,106 +0,0 @@
|
|||||||
<form
|
|
||||||
#signatureForm="ngForm"
|
|
||||||
novalidate
|
|
||||||
(ngSubmit)="createSignature(thumbprint)">
|
|
||||||
<fieldset>
|
|
||||||
<legend>Создание подписи</legend>
|
|
||||||
<label for="message">Подписываемое сообщение: *</label>
|
|
||||||
<br>
|
|
||||||
<textarea
|
|
||||||
id="message"
|
|
||||||
name="message"
|
|
||||||
cols="80"
|
|
||||||
rows="5"
|
|
||||||
placeholder="Введите сообщение"
|
|
||||||
autofocus
|
|
||||||
required
|
|
||||||
[(ngModel)]="message">Привет мир!</textarea>
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<label for="certificate">Сертификат: *</label>
|
|
||||||
<br>
|
|
||||||
<select
|
|
||||||
id="certificate"
|
|
||||||
name="certificate"
|
|
||||||
required
|
|
||||||
[(ngModel)]="thumbprint">
|
|
||||||
<option value="null" disabled>Не выбран</option>
|
|
||||||
<option *ngFor="let cert of certificateList" [value]="cert.thumbprint">
|
|
||||||
{{cert.name + ' (действителен до: ' + cert.validTo + ')'}}
|
|
||||||
</option>
|
|
||||||
</select>
|
|
||||||
<pre>{{certificateListError}}</pre>
|
|
||||||
|
|
||||||
<details
|
|
||||||
*ngIf="thumbprint"
|
|
||||||
(click)="showCertInfo(thumbprint)">
|
|
||||||
<summary>Информация о сертификате</summary>
|
|
||||||
<pre *ngIf="certInfo">{{certInfo | json}}</pre>
|
|
||||||
<pre *ngIf="!certInfo">Запрашивается...</pre>
|
|
||||||
</details>
|
|
||||||
<pre>{{certificateInfoError}}</pre>
|
|
||||||
|
|
||||||
<label>Тип подписи: *</label>
|
|
||||||
<br>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="detachedSignature"
|
|
||||||
[value]="false"
|
|
||||||
[(ngModel)]="detachedSignature">Совмещенная</label>
|
|
||||||
<br>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="detachedSignature"
|
|
||||||
[value]="true"
|
|
||||||
[(ngModel)]="detachedSignature">Отделенная</label>
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
[disabled]="!signatureForm.valid">Создать подпись</button>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>Результат</legend>
|
|
||||||
<label for="hash">Хеш (ГОСТ Р 34.11-2012 256 бит):</label><br>
|
|
||||||
<textarea
|
|
||||||
id="hash"
|
|
||||||
cols="80"
|
|
||||||
rows="5"
|
|
||||||
[(ngModel)]="hash"
|
|
||||||
[placeholder]="hashStatus"
|
|
||||||
></textarea>
|
|
||||||
<pre>{{hashError}}</pre>
|
|
||||||
|
|
||||||
<label for="signature">Подпись (PKCS7):</label><br>
|
|
||||||
<textarea
|
|
||||||
id="signature"
|
|
||||||
name="signature"
|
|
||||||
cols="80"
|
|
||||||
rows="30"
|
|
||||||
[placeholder]="signatureStatus"
|
|
||||||
[(ngModel)]="signature"
|
|
||||||
></textarea>
|
|
||||||
<pre>{{signatureError}}</pre>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Для
|
|
||||||
<a href="https://www.gosuslugi.ru/pgu/eds/"
|
|
||||||
target="_blank"
|
|
||||||
rel="nofollow noopener noreferrer"
|
|
||||||
title="Перейти к проверке подписи">проверки</a>
|
|
||||||
нужно создать файл со сгенерированной подписью в кодировке UTF-8 с расширением *.sgn
|
|
||||||
<br>
|
|
||||||
для отделенной подписи (или *.sig для совмещенной).
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend>Информация о системе</legend>
|
|
||||||
<pre *ngIf="systemInfo">{{systemInfo | json}}</pre>
|
|
||||||
<pre>{{systemInfoError}}</pre>
|
|
||||||
</fieldset>
|
|
@ -1,25 +0,0 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { CryptoProComponent } from './crypto-pro.component';
|
|
||||||
|
|
||||||
describe('CryptoProComponent', () => {
|
|
||||||
let component: CryptoProComponent;
|
|
||||||
let fixture: ComponentFixture<CryptoProComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ CryptoProComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(CryptoProComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,144 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import {
|
|
||||||
getCertificate,
|
|
||||||
getUserCertificates,
|
|
||||||
getSystemInfo,
|
|
||||||
isValidSystemSetup,
|
|
||||||
createHash,
|
|
||||||
createDetachedSignature,
|
|
||||||
createAttachedSignature,
|
|
||||||
SystemInfo,
|
|
||||||
Certificate
|
|
||||||
} from 'crypto-pro';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-crypto-pro',
|
|
||||||
templateUrl: './crypto-pro.component.html',
|
|
||||||
styleUrls: ['./crypto-pro.component.css']
|
|
||||||
})
|
|
||||||
export class CryptoProComponent implements OnInit {
|
|
||||||
public message = 'Привет мир!';
|
|
||||||
public certificateList: Certificate[] = [];
|
|
||||||
public hash: string = null;
|
|
||||||
public hashStatus = 'Не вычислен';
|
|
||||||
public detachedSignature = true;
|
|
||||||
public thumbprint: string = null;
|
|
||||||
public signature: string = null;
|
|
||||||
public signatureStatus = 'Не создана';
|
|
||||||
public systemInfo: SystemInfo & {
|
|
||||||
isValidSystemSetup: boolean;
|
|
||||||
};
|
|
||||||
public certificateListError: string = null;
|
|
||||||
public certificateInfoError: string = null;
|
|
||||||
public hashError: string = null;
|
|
||||||
public signatureError: string = null;
|
|
||||||
public systemInfoError: string = null;
|
|
||||||
public certInfo = null;
|
|
||||||
|
|
||||||
constructor() { }
|
|
||||||
|
|
||||||
public ngOnInit(): void {
|
|
||||||
this.displayCertificates();
|
|
||||||
this.displaySystemInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async createSignature(thumbprint) {
|
|
||||||
this.hash = null;
|
|
||||||
this.hashError = null;
|
|
||||||
this.signature = null;
|
|
||||||
this.signatureError = null;
|
|
||||||
this.hashStatus = 'Вычисляется...';
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.hash = await createHash(this.message);
|
|
||||||
} catch (error) {
|
|
||||||
this.hashError = error.message;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hashStatus = 'Не вычислен';
|
|
||||||
this.signatureStatus = 'Создается...';
|
|
||||||
|
|
||||||
if (this.detachedSignature) {
|
|
||||||
try {
|
|
||||||
this.signature = await createDetachedSignature(thumbprint, this.hash);
|
|
||||||
} catch (error) {
|
|
||||||
this.signatureError = error.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.signatureStatus = 'Не создана';
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.signature = await createAttachedSignature(thumbprint, this.message);
|
|
||||||
} catch (error) {
|
|
||||||
this.signatureError = error.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.signatureStatus = 'Не создана';
|
|
||||||
}
|
|
||||||
|
|
||||||
public async showCertInfo(thumbprint) {
|
|
||||||
this.certInfo = null;
|
|
||||||
this.certificateInfoError = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const certificate = await getCertificate(thumbprint);
|
|
||||||
|
|
||||||
this.certInfo = {
|
|
||||||
name: certificate.name,
|
|
||||||
issuerName: certificate.issuerName,
|
|
||||||
subjectName: certificate.subjectName,
|
|
||||||
thumbprint: certificate.thumbprint,
|
|
||||||
validFrom: certificate.validFrom,
|
|
||||||
validTo: certificate.validTo,
|
|
||||||
isValid: await certificate.isValid(),
|
|
||||||
version: await certificate.getCadesProp('Version'),
|
|
||||||
base64: await certificate.exportBase64(),
|
|
||||||
algorithm: await certificate.getAlgorithm(),
|
|
||||||
extendedKeyUsage: await certificate.getExtendedKeyUsage(),
|
|
||||||
ownerInfo: await certificate.getOwnerInfo(),
|
|
||||||
issuerInfo: await certificate.getIssuerInfo(),
|
|
||||||
decodedExtendedKeyUsage: await certificate.getDecodedExtendedKeyUsage(),
|
|
||||||
'1.3.6.1.4.1.311.80.1': await certificate.hasExtendedKeyUsage('1.3.6.1.4.1.311.80.1'),
|
|
||||||
'[\'1.3.6.1.5.5.7.3.2\', \'1.3.6.1.4.1.311.10.3.12\']': await certificate.hasExtendedKeyUsage([
|
|
||||||
'1.3.6.1.5.5.7.3.2',
|
|
||||||
'1.3.6.1.4.1.311.10.3.12'
|
|
||||||
]),
|
|
||||||
'1.3.6.1.4.1.311.80.2': await certificate.hasExtendedKeyUsage('1.3.6.1.4.1.311.80.2'),
|
|
||||||
'\'1.3.6.1.5.5.7.3.3\', \'1.3.6.1.4.1.311.10.3.12\'': await certificate.hasExtendedKeyUsage([
|
|
||||||
'1.3.6.1.5.5.7.3.3',
|
|
||||||
'1.3.6.1.4.1.311.10.3.12'
|
|
||||||
]),
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
this.certificateInfoError = error.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async displayCertificates() {
|
|
||||||
this.certificateListError = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.certificateList = await getUserCertificates();
|
|
||||||
} catch (error) {
|
|
||||||
this.certificateListError = error.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async displaySystemInfo() {
|
|
||||||
this.systemInfoError = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
this.systemInfo = {
|
|
||||||
...await getSystemInfo(),
|
|
||||||
isValidSystemSetup: await isValidSystemSetup()
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
this.systemInfoError = error.message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
export const environment = {
|
|
||||||
production: true
|
|
||||||
};
|
|
@ -1,16 +0,0 @@
|
|||||||
// This file can be replaced during build by using the `fileReplacements` array.
|
|
||||||
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
||||||
// The list of file replacements can be found in `angular.json`.
|
|
||||||
|
|
||||||
export const environment = {
|
|
||||||
production: false
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For easier debugging in development mode, you can import the following file
|
|
||||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
|
||||||
*
|
|
||||||
* This import should be commented out in production mode because it will have a negative impact
|
|
||||||
* on performance if an error is thrown.
|
|
||||||
*/
|
|
||||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
|
Binary file not shown.
Before Width: | Height: | Size: 948 B |
@ -1,13 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>Angular</title>
|
|
||||||
<base href="/">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<app-root></app-root>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,12 +0,0 @@
|
|||||||
import { enableProdMode } from '@angular/core';
|
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
||||||
|
|
||||||
import { AppModule } from './app/app.module';
|
|
||||||
import { environment } from './environments/environment';
|
|
||||||
|
|
||||||
if (environment.production) {
|
|
||||||
enableProdMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
|
||||||
.catch(err => console.error(err));
|
|
@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
||||||
* You can add your own extra polyfills to this file.
|
|
||||||
*
|
|
||||||
* This file is divided into 2 sections:
|
|
||||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
||||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
||||||
* file.
|
|
||||||
*
|
|
||||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
||||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
||||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
||||||
*
|
|
||||||
* Learn more in https://angular.io/guide/browser-support
|
|
||||||
*/
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* BROWSER POLYFILLS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
||||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Web Animations `@angular/platform-browser/animations`
|
|
||||||
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
|
||||||
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
|
||||||
*/
|
|
||||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
|
||||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
|
||||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
|
||||||
* will put import in the top of bundle, so user need to create a separate file
|
|
||||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
|
||||||
* into that file, and then add the following code before importing zone.js.
|
|
||||||
* import './zone-flags';
|
|
||||||
*
|
|
||||||
* The flags allowed in zone-flags.ts are listed here.
|
|
||||||
*
|
|
||||||
* The following flags will work for all browsers.
|
|
||||||
*
|
|
||||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
|
||||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
|
||||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
|
||||||
*
|
|
||||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
|
||||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
|
||||||
*
|
|
||||||
* (window as any).__Zone_enable_cross_context_check = true;
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* Zone JS is required by default for Angular itself.
|
|
||||||
*/
|
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
|
||||||
* APPLICATION IMPORTS
|
|
||||||
*/
|
|
@ -1 +0,0 @@
|
|||||||
/* You can add global styles to this file, and also import other style files */
|
|
@ -1,25 +0,0 @@
|
|||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
||||||
|
|
||||||
import 'zone.js/dist/zone-testing';
|
|
||||||
import { getTestBed } from '@angular/core/testing';
|
|
||||||
import {
|
|
||||||
BrowserDynamicTestingModule,
|
|
||||||
platformBrowserDynamicTesting
|
|
||||||
} from '@angular/platform-browser-dynamic/testing';
|
|
||||||
|
|
||||||
declare const require: {
|
|
||||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
||||||
keys(): string[];
|
|
||||||
<T>(id: string): T;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// First, initialize the Angular testing environment.
|
|
||||||
getTestBed().initTestEnvironment(
|
|
||||||
BrowserDynamicTestingModule,
|
|
||||||
platformBrowserDynamicTesting()
|
|
||||||
);
|
|
||||||
// Then we find all the tests.
|
|
||||||
const context = require.context('./', true, /\.spec\.ts$/);
|
|
||||||
// And load the modules.
|
|
||||||
context.keys().map(context);
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./out-tsc/app",
|
|
||||||
"types": []
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"src/main.ts",
|
|
||||||
"src/polyfills.ts"
|
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"src/**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"compileOnSave": false,
|
|
||||||
"compilerOptions": {
|
|
||||||
"baseUrl": "./",
|
|
||||||
"outDir": "./dist/out-tsc",
|
|
||||||
"sourceMap": true,
|
|
||||||
"declaration": false,
|
|
||||||
"downlevelIteration": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"module": "esnext",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"importHelpers": true,
|
|
||||||
"target": "es2015",
|
|
||||||
"lib": [
|
|
||||||
"es2018",
|
|
||||||
"dom"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"fullTemplateTypeCheck": true,
|
|
||||||
"strictInjectionParameters": true
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./out-tsc/spec",
|
|
||||||
"types": [
|
|
||||||
"jasmine",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"src/test.ts",
|
|
||||||
"src/polyfills.ts"
|
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"src/**/*.spec.ts",
|
|
||||||
"src/**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "tslint:recommended",
|
|
||||||
"rules": {
|
|
||||||
"array-type": false,
|
|
||||||
"arrow-parens": false,
|
|
||||||
"deprecation": {
|
|
||||||
"severity": "warning"
|
|
||||||
},
|
|
||||||
"component-class-suffix": true,
|
|
||||||
"contextual-lifecycle": true,
|
|
||||||
"directive-class-suffix": true,
|
|
||||||
"directive-selector": [
|
|
||||||
true,
|
|
||||||
"attribute",
|
|
||||||
"app",
|
|
||||||
"camelCase"
|
|
||||||
],
|
|
||||||
"component-selector": [
|
|
||||||
true,
|
|
||||||
"element",
|
|
||||||
"app",
|
|
||||||
"kebab-case"
|
|
||||||
],
|
|
||||||
"import-blacklist": [
|
|
||||||
true,
|
|
||||||
"rxjs/Rx"
|
|
||||||
],
|
|
||||||
"interface-name": false,
|
|
||||||
"max-classes-per-file": false,
|
|
||||||
"max-line-length": [
|
|
||||||
true,
|
|
||||||
140
|
|
||||||
],
|
|
||||||
"member-access": false,
|
|
||||||
"member-ordering": [
|
|
||||||
true,
|
|
||||||
{
|
|
||||||
"order": [
|
|
||||||
"static-field",
|
|
||||||
"instance-field",
|
|
||||||
"static-method",
|
|
||||||
"instance-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-consecutive-blank-lines": false,
|
|
||||||
"no-console": [
|
|
||||||
true,
|
|
||||||
"debug",
|
|
||||||
"info",
|
|
||||||
"time",
|
|
||||||
"timeEnd",
|
|
||||||
"trace"
|
|
||||||
],
|
|
||||||
"no-empty": false,
|
|
||||||
"no-inferrable-types": [
|
|
||||||
true,
|
|
||||||
"ignore-params"
|
|
||||||
],
|
|
||||||
"no-non-null-assertion": true,
|
|
||||||
"no-redundant-jsdoc": true,
|
|
||||||
"no-switch-case-fall-through": true,
|
|
||||||
"no-var-requires": false,
|
|
||||||
"object-literal-key-quotes": [
|
|
||||||
true,
|
|
||||||
"as-needed"
|
|
||||||
],
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"quotemark": [
|
|
||||||
true,
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"trailing-comma": false,
|
|
||||||
"no-conflicting-lifecycle": true,
|
|
||||||
"no-host-metadata-property": true,
|
|
||||||
"no-input-rename": true,
|
|
||||||
"no-inputs-metadata-property": true,
|
|
||||||
"no-output-native": true,
|
|
||||||
"no-output-on-prefix": true,
|
|
||||||
"no-output-rename": true,
|
|
||||||
"no-outputs-metadata-property": true,
|
|
||||||
"template-banana-in-box": true,
|
|
||||||
"template-no-negated-async": true,
|
|
||||||
"use-lifecycle-interface": true,
|
|
||||||
"use-pipe-transform-interface": true
|
|
||||||
},
|
|
||||||
"rulesDirectory": [
|
|
||||||
"codelyzer"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
SKIP_PREFLIGHT_CHECK=true
|
|
23
examples/react/.gitignore
vendored
23
examples/react/.gitignore
vendored
@ -1,23 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
.env.local
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
@ -1,68 +0,0 @@
|
|||||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
||||||
|
|
||||||
## Available Scripts
|
|
||||||
|
|
||||||
In the project directory, you can run:
|
|
||||||
|
|
||||||
### `npm start`
|
|
||||||
|
|
||||||
Runs the app in the development mode.<br />
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
||||||
|
|
||||||
The page will reload if you make edits.<br />
|
|
||||||
You will also see any lint errors in the console.
|
|
||||||
|
|
||||||
### `npm test`
|
|
||||||
|
|
||||||
Launches the test runner in the interactive watch mode.<br />
|
|
||||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
||||||
|
|
||||||
### `npm run build`
|
|
||||||
|
|
||||||
Builds the app for production to the `build` folder.<br />
|
|
||||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
||||||
|
|
||||||
The build is minified and the filenames include the hashes.<br />
|
|
||||||
Your app is ready to be deployed!
|
|
||||||
|
|
||||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
||||||
|
|
||||||
### `npm run eject`
|
|
||||||
|
|
||||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
||||||
|
|
||||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
||||||
|
|
||||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
||||||
|
|
||||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
||||||
|
|
||||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
||||||
|
|
||||||
### Code Splitting
|
|
||||||
|
|
||||||
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
|
|
||||||
|
|
||||||
### Analyzing the Bundle Size
|
|
||||||
|
|
||||||
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
|
|
||||||
|
|
||||||
### Making a Progressive Web App
|
|
||||||
|
|
||||||
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
|
|
||||||
|
|
||||||
### Advanced Configuration
|
|
||||||
|
|
||||||
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
|
|
||||||
|
|
||||||
### Deployment
|
|
||||||
|
|
||||||
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
|
|
||||||
|
|
||||||
### `npm run build` fails to minify
|
|
||||||
|
|
||||||
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
|
|
32998
examples/react/package-lock.json
generated
32998
examples/react/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,41 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "crypto-pro-example-react",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"description": "Пример использования пакета crypto-pro в javascript проекте с react",
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@testing-library/jest-dom": "4.2.4",
|
|
||||||
"@testing-library/react": "9.5.0",
|
|
||||||
"@testing-library/user-event": "7.2.1",
|
|
||||||
"crypto-pro-js": "^2.3.0",
|
|
||||||
"react": "^16.13.1",
|
|
||||||
"react-app-polyfill": "1.0.6",
|
|
||||||
"react-dom": "^16.13.1",
|
|
||||||
"react-scripts": "3.4.1"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"node-static": "0.7.11"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"serve": "static --host-address localhost --port 8081 build",
|
|
||||||
"start": "react-scripts start",
|
|
||||||
"build": "react-scripts build",
|
|
||||||
"test": "react-scripts test",
|
|
||||||
"eject": "react-scripts eject"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"extends": "react-app"
|
|
||||||
},
|
|
||||||
"browserslist": {
|
|
||||||
"production": [
|
|
||||||
">0.2%",
|
|
||||||
"not dead",
|
|
||||||
"not op_mini all"
|
|
||||||
],
|
|
||||||
"development": [
|
|
||||||
"last 1 chrome version",
|
|
||||||
"last 1 firefox version",
|
|
||||||
"last 1 safari version"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
(function (root, factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
// AMD. Register as an anonymous module.
|
|
||||||
define([], function () {
|
|
||||||
factory(root);
|
|
||||||
});
|
|
||||||
} else factory(root);
|
|
||||||
// node.js has always supported base64 conversions, while browsers that support
|
|
||||||
// web workers support base64 too, but you may never know.
|
|
||||||
})(typeof exports !== "undefined" ? exports : this, function (root) {
|
|
||||||
if (root.atob) {
|
|
||||||
// Some browsers' implementation of atob doesn't support whitespaces
|
|
||||||
// in the encoded string (notably, IE). This wraps the native atob
|
|
||||||
// in a function that strips the whitespaces.
|
|
||||||
// The original function can be retrieved in atob.original
|
|
||||||
try {
|
|
||||||
root.atob(" ");
|
|
||||||
} catch (e) {
|
|
||||||
root.atob = (function (atob) {
|
|
||||||
var func = function (string) {
|
|
||||||
return atob(String(string).replace(/[\t\n\f\r ]+/g, ""));
|
|
||||||
};
|
|
||||||
func.original = atob;
|
|
||||||
return func;
|
|
||||||
})(root.atob);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// base64 character set, plus padding character (=)
|
|
||||||
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
|
|
||||||
// Regular expression to check formal correctness of base64 encoded strings
|
|
||||||
b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
|
||||||
|
|
||||||
root.btoa = function (string) {
|
|
||||||
string = String(string);
|
|
||||||
var bitmap, a, b, c,
|
|
||||||
result = "", i = 0,
|
|
||||||
rest = string.length % 3; // To determine the final padding
|
|
||||||
|
|
||||||
for (; i < string.length;) {
|
|
||||||
if ((a = string.charCodeAt(i++)) > 255
|
|
||||||
|| (b = string.charCodeAt(i++)) > 255
|
|
||||||
|| (c = string.charCodeAt(i++)) > 255)
|
|
||||||
throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");
|
|
||||||
|
|
||||||
bitmap = (a << 16) | (b << 8) | c;
|
|
||||||
result += b64.charAt(bitmap >> 18 & 63) + b64.charAt(bitmap >> 12 & 63)
|
|
||||||
+ b64.charAt(bitmap >> 6 & 63) + b64.charAt(bitmap & 63);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there's need of padding, replace the last 'A's with equal signs
|
|
||||||
return rest ? result.slice(0, rest - 3) + "===".substring(rest) : result;
|
|
||||||
};
|
|
||||||
|
|
||||||
root.atob = function (string) {
|
|
||||||
// atob can work with strings with whitespaces, even inside the encoded part,
|
|
||||||
// but only \t, \n, \f, \r and ' ', which can be stripped.
|
|
||||||
string = String(string).replace(/[\t\n\f\r ]+/g, "");
|
|
||||||
if (!b64re.test(string))
|
|
||||||
throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
|
|
||||||
|
|
||||||
// Adding the padding if missing, for semplicity
|
|
||||||
string += "==".slice(2 - (string.length & 3));
|
|
||||||
var bitmap, result = "", r1, r2, i = 0;
|
|
||||||
for (; i < string.length;) {
|
|
||||||
bitmap = b64.indexOf(string.charAt(i++)) << 18 | b64.indexOf(string.charAt(i++)) << 12
|
|
||||||
| (r1 = b64.indexOf(string.charAt(i++))) << 6 | (r2 = b64.indexOf(string.charAt(i++)));
|
|
||||||
|
|
||||||
result += r1 === 64 ? String.fromCharCode(bitmap >> 16 & 255)
|
|
||||||
: r2 === 64 ? String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255)
|
|
||||||
: String.fromCharCode(bitmap >> 16 & 255, bitmap >> 8 & 255, bitmap & 255);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
});
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
@ -1,45 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
<meta
|
|
||||||
name="description"
|
|
||||||
content="Web site created using create-react-app"
|
|
||||||
/>
|
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
||||||
<!--
|
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
||||||
-->
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
||||||
<!--
|
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
|
||||||
Only files inside the `public` folder can be referenced from the HTML.
|
|
||||||
|
|
||||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
|
||||||
-->
|
|
||||||
<title>React App</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></div>
|
|
||||||
<!--
|
|
||||||
This HTML file is a template.
|
|
||||||
If you open it directly in the browser, you will see an empty page.
|
|
||||||
|
|
||||||
You can add webfonts, meta tags, or analytics to this file.
|
|
||||||
The build step will place the bundled scripts into the <body> tag.
|
|
||||||
|
|
||||||
To begin the development, run `npm start` or `yarn start`.
|
|
||||||
To create a production bundle, use `npm run build` or `yarn build`.
|
|
||||||
-->
|
|
||||||
<!-- Полифилл для работы демо в IE9 -->
|
|
||||||
<script src="atob-btoa.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"short_name": "React App",
|
|
||||||
"name": "Create React App Sample",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "favicon.ico",
|
|
||||||
"sizes": "64x64 32x32 24x24 16x16",
|
|
||||||
"type": "image/x-icon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "logo192.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "192x192"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "logo512.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "512x512"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": ".",
|
|
||||||
"display": "standalone",
|
|
||||||
"theme_color": "#000000",
|
|
||||||
"background_color": "#ffffff"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
# https://www.robotstxt.org/robotstxt.html
|
|
||||||
User-agent: *
|
|
||||||
Disallow:
|
|
@ -1,119 +0,0 @@
|
|||||||
import React, { useState } from 'react';
|
|
||||||
import { createAttachedSignature, createDetachedSignature, createHash } from 'crypto-pro';
|
|
||||||
import Message from './components/Message';
|
|
||||||
import Certificate from './components/Certificate';
|
|
||||||
import SignatureType from './components/SignatureType';
|
|
||||||
import Hash from './components/Hash';
|
|
||||||
import Signature from './components/Signature';
|
|
||||||
import SystemInfo from './components/SystemInfo';
|
|
||||||
|
|
||||||
function App() {
|
|
||||||
const [message, setMessage] = useState('');
|
|
||||||
const [certificate, setCertificate] = useState(null);
|
|
||||||
const [detachedSignature, setSignatureType] = useState(null);
|
|
||||||
const [hash, setHash] = useState('');
|
|
||||||
const [hashStatus, setHashStatus] = useState('Не вычислен');
|
|
||||||
const [hashError, setHashError] = useState(null);
|
|
||||||
const [signature, setSignature] = useState('');
|
|
||||||
const [signatureStatus, setSignatureStatus] = useState('Не создана');
|
|
||||||
const [signatureError, setSignatureError] = useState(null);
|
|
||||||
|
|
||||||
async function createSignature(event) {
|
|
||||||
let hash;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
setSignature('');
|
|
||||||
setSignatureError(null);
|
|
||||||
|
|
||||||
setHash('');
|
|
||||||
setHashError(null);
|
|
||||||
setHashStatus('Вычисляется...');
|
|
||||||
|
|
||||||
try {
|
|
||||||
hash = await createHash(message);
|
|
||||||
|
|
||||||
setHash(hash);
|
|
||||||
} catch (error) {
|
|
||||||
setHashError(error.message);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setHashStatus('Не вычислен');
|
|
||||||
setSignatureStatus('Создается...');
|
|
||||||
|
|
||||||
if (detachedSignature) {
|
|
||||||
try {
|
|
||||||
setSignature(await createDetachedSignature(certificate.thumbprint, hash));
|
|
||||||
} catch (error) {
|
|
||||||
setSignatureError(error.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSignatureStatus('Не создана');
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
setSignature(await createAttachedSignature(certificate.thumbprint, message));
|
|
||||||
} catch (error) {
|
|
||||||
setSignatureError(error.message);
|
|
||||||
}
|
|
||||||
|
|
||||||
setSignatureStatus('Не создана');
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<form onSubmit={createSignature} noValidate>
|
|
||||||
<fieldset>
|
|
||||||
<Message onChange={setMessage}/>
|
|
||||||
|
|
||||||
<br/><br/>
|
|
||||||
|
|
||||||
<Certificate onChange={setCertificate}/>
|
|
||||||
|
|
||||||
<SignatureType onChange={setSignatureType}/>
|
|
||||||
|
|
||||||
<br/><br/>
|
|
||||||
<hr/>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
disabled={!certificate || !message}>
|
|
||||||
Создать подпись
|
|
||||||
</button>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<Hash
|
|
||||||
hash={hash}
|
|
||||||
hashStatus={hashStatus}
|
|
||||||
hashError={hashError}/>
|
|
||||||
|
|
||||||
<Signature
|
|
||||||
signature={signature}
|
|
||||||
signatureStatus={signatureStatus}
|
|
||||||
signatureError={signatureError}/>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Для <a href="https://www.gosuslugi.ru/pgu/eds/"
|
|
||||||
target="_blank"
|
|
||||||
rel="nofollow noopener noreferrer"
|
|
||||||
title="Перейти к проверке подписи">проверки</a> нужно
|
|
||||||
создать файл со сгенерированной подписью в кодировке UTF-8 с расширением *.sgn
|
|
||||||
<br/>
|
|
||||||
для отделенной подписи (или *.sig для совмещенной).
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<SystemInfo/>
|
|
||||||
</fieldset>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
|
@ -1,9 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { render } from '@testing-library/react';
|
|
||||||
import App from './App';
|
|
||||||
|
|
||||||
xtest('renders learn react link', () => {
|
|
||||||
const { getByText } = render(<App />);
|
|
||||||
const linkElement = getByText(/learn react/i);
|
|
||||||
expect(linkElement).toBeInTheDocument();
|
|
||||||
});
|
|
@ -1,101 +0,0 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import { getCertificate, getUserCertificates } from 'crypto-pro';
|
|
||||||
|
|
||||||
function Certificate({onChange}) {
|
|
||||||
const [certificates, setCertificates] = useState([]);
|
|
||||||
const [certificatesError, setCertificatesError] = useState([]);
|
|
||||||
const [certificate, setCertificate] = useState(null);
|
|
||||||
const [certificateDetails, setCertificateDetails] = useState(null);
|
|
||||||
const [detailsError, setDetailsError] = useState(null);
|
|
||||||
|
|
||||||
function selectCertificate(event) {
|
|
||||||
const certificate = certificates.find(({thumbprint}) => thumbprint === event.target.value);
|
|
||||||
|
|
||||||
setCertificate(certificate);
|
|
||||||
onChange(certificate);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadCertificateDetails(thumbprint) {
|
|
||||||
try {
|
|
||||||
const certificate = await getCertificate(thumbprint);
|
|
||||||
|
|
||||||
setCertificateDetails({
|
|
||||||
name: certificate.name,
|
|
||||||
issuerName: certificate.issuerName,
|
|
||||||
subjectName: certificate.subjectName,
|
|
||||||
thumbprint: certificate.thumbprint,
|
|
||||||
validFrom: certificate.validFrom,
|
|
||||||
validTo: certificate.validTo,
|
|
||||||
isValid: await certificate.isValid(),
|
|
||||||
version: await certificate.getCadesProp('Version'),
|
|
||||||
base64: await certificate.exportBase64(),
|
|
||||||
algorithm: await certificate.getAlgorithm(),
|
|
||||||
extendedKeyUsage: await certificate.getExtendedKeyUsage(),
|
|
||||||
ownerInfo: await certificate.getOwnerInfo(),
|
|
||||||
issuerInfo: await certificate.getIssuerInfo(),
|
|
||||||
decodedExtendedKeyUsage: await certificate.getDecodedExtendedKeyUsage(),
|
|
||||||
'1.3.6.1.4.1.311.80.1': await certificate.hasExtendedKeyUsage('1.3.6.1.4.1.311.80.1'),
|
|
||||||
'[\'1.3.6.1.5.5.7.3.2\', \'1.3.6.1.4.1.311.10.3.12\']': await certificate.hasExtendedKeyUsage([
|
|
||||||
'1.3.6.1.5.5.7.3.2',
|
|
||||||
'1.3.6.1.4.1.311.10.3.12'
|
|
||||||
]),
|
|
||||||
'1.3.6.1.4.1.311.80.2': await certificate.hasExtendedKeyUsage('1.3.6.1.4.1.311.80.2'),
|
|
||||||
'\'1.3.6.1.5.5.7.3.3\', \'1.3.6.1.4.1.311.10.3.12\'': await certificate.hasExtendedKeyUsage([
|
|
||||||
'1.3.6.1.5.5.7.3.3',
|
|
||||||
'1.3.6.1.4.1.311.10.3.12'
|
|
||||||
]),
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
setDetailsError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
setCertificates(await getUserCertificates());
|
|
||||||
} catch (error) {
|
|
||||||
setCertificatesError(error.message);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<label htmlFor="certificate">Сертификат: *</label>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<select id="certificate" onChange={selectCertificate}>
|
|
||||||
<option defaultValue={null}>Не выбран</option>
|
|
||||||
|
|
||||||
{certificates.map(({name, thumbprint, validTo}) =>
|
|
||||||
<option key={thumbprint} value={thumbprint}>
|
|
||||||
{name + ' (действителен до: ' + validTo + ')'}
|
|
||||||
</option>
|
|
||||||
)}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<pre>{certificatesError || null}</pre>
|
|
||||||
|
|
||||||
{certificate ? (
|
|
||||||
<>
|
|
||||||
<details
|
|
||||||
onClick={loadCertificateDetails.bind(this, certificate.thumbprint)}>
|
|
||||||
<summary>Информация о сертификате</summary>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
{certificateDetails ? (
|
|
||||||
JSON.stringify(certificateDetails, null, ' ')
|
|
||||||
) : 'Запрашивается...'}
|
|
||||||
</pre>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<pre>{detailsError || null}</pre>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Certificate;
|
|
@ -1,25 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
function Hash({hash, hashStatus, hashError}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<legend>Результат</legend>
|
|
||||||
|
|
||||||
<label htmlFor="hash">Хеш (ГОСТ Р 34.11-2012 256 бит):</label>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<textarea
|
|
||||||
id="hash"
|
|
||||||
cols="80"
|
|
||||||
rows="5"
|
|
||||||
value={hash}
|
|
||||||
placeholder={hashStatus}
|
|
||||||
readOnly/>
|
|
||||||
|
|
||||||
<pre>{hashError || null}</pre>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Hash;
|
|
@ -1,35 +0,0 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
function Message({onChange}) {
|
|
||||||
const [message, setMessage] = useState('Привет мир!');
|
|
||||||
|
|
||||||
function onMessageChange(event) {
|
|
||||||
setMessage(event.target.value);
|
|
||||||
onChange(event.target.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => onChange(message));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<legend>Создание подписи</legend>
|
|
||||||
|
|
||||||
<label htmlFor="message">Подписываемое сообщение: *</label>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<textarea
|
|
||||||
id="message"
|
|
||||||
name="message"
|
|
||||||
cols="80"
|
|
||||||
rows="5"
|
|
||||||
placeholder="Введите сообщение"
|
|
||||||
value={message}
|
|
||||||
onChange={onMessageChange}
|
|
||||||
autoFocus
|
|
||||||
required/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Message;
|
|
@ -1,23 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
function Signature({signature, signatureStatus, signatureError}) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<label htmlFor="signature">Подпись (PKCS7):</label>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<textarea
|
|
||||||
id="signature"
|
|
||||||
cols="80"
|
|
||||||
rows="30"
|
|
||||||
value={signature}
|
|
||||||
placeholder={signatureStatus}
|
|
||||||
readOnly/>
|
|
||||||
|
|
||||||
<pre>{signatureError || null}</pre>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Signature;
|
|
@ -1,36 +0,0 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
|
|
||||||
function SignatureType({onChange}) {
|
|
||||||
const [type, setType] = useState(true);
|
|
||||||
|
|
||||||
function onTypeToggle() {
|
|
||||||
setType(!type);
|
|
||||||
onChange(!type);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => onChange(type));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<label>Тип подписи: *</label>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
checked={!type}
|
|
||||||
onChange={onTypeToggle}/>Совмещенная</label>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
checked={type}
|
|
||||||
onChange={onTypeToggle}/>Отделенная</label>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default SignatureType;
|
|
@ -1,36 +0,0 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import { getSystemInfo, isValidSystemSetup } from 'crypto-pro';
|
|
||||||
|
|
||||||
function SystemInfo() {
|
|
||||||
const [systemInfo, setSystemInfo] = useState(null);
|
|
||||||
const [systemInfoError, setSystemInfoError] = useState(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
(async () => {
|
|
||||||
try {
|
|
||||||
setSystemInfo({
|
|
||||||
...await getSystemInfo(),
|
|
||||||
isValidSystemSetup: await isValidSystemSetup()
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
setSystemInfoError(error.message);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<legend>Информация о системе</legend>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
{systemInfo ? (
|
|
||||||
JSON.stringify(systemInfo, null, ' ')
|
|
||||||
) : (
|
|
||||||
systemInfoError || null
|
|
||||||
)}
|
|
||||||
</pre>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default SystemInfo;
|
|
@ -1,19 +0,0 @@
|
|||||||
import 'react-app-polyfill/ie9';
|
|
||||||
import 'react-app-polyfill/stable';
|
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import App from './App';
|
|
||||||
import * as serviceWorker from './serviceWorker';
|
|
||||||
|
|
||||||
ReactDOM.render(
|
|
||||||
<React.StrictMode>
|
|
||||||
<App />
|
|
||||||
</React.StrictMode>,
|
|
||||||
document.getElementById('root')
|
|
||||||
);
|
|
||||||
|
|
||||||
// If you want your app to work offline and load faster, you can change
|
|
||||||
// unregister() to register() below. Note this comes with some pitfalls.
|
|
||||||
// Learn more about service workers: https://bit.ly/CRA-PWA
|
|
||||||
serviceWorker.unregister();
|
|
@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
|
|
||||||
<g fill="#61DAFB">
|
|
||||||
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
|
|
||||||
<circle cx="420.9" cy="296.5" r="45.7"/>
|
|
||||||
<path d="M520.5 78.1z"/>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 2.6 KiB |
@ -1,141 +0,0 @@
|
|||||||
// This optional code is used to register a service worker.
|
|
||||||
// register() is not called by default.
|
|
||||||
|
|
||||||
// This lets the app load faster on subsequent visits in production, and gives
|
|
||||||
// it offline capabilities. However, it also means that developers (and users)
|
|
||||||
// will only see deployed updates on subsequent visits to a page, after all the
|
|
||||||
// existing tabs open on the page have been closed, since previously cached
|
|
||||||
// resources are updated in the background.
|
|
||||||
|
|
||||||
// To learn more about the benefits of this model and instructions on how to
|
|
||||||
// opt-in, read https://bit.ly/CRA-PWA
|
|
||||||
|
|
||||||
const isLocalhost = Boolean(
|
|
||||||
window.location.hostname === 'localhost' ||
|
|
||||||
// [::1] is the IPv6 localhost address.
|
|
||||||
window.location.hostname === '[::1]' ||
|
|
||||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
|
||||||
window.location.hostname.match(
|
|
||||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
export function register(config) {
|
|
||||||
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
|
|
||||||
// The URL constructor is available in all browsers that support SW.
|
|
||||||
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
|
|
||||||
if (publicUrl.origin !== window.location.origin) {
|
|
||||||
// Our service worker won't work if PUBLIC_URL is on a different origin
|
|
||||||
// from what our page is served on. This might happen if a CDN is used to
|
|
||||||
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
|
||||||
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
|
||||||
|
|
||||||
if (isLocalhost) {
|
|
||||||
// This is running on localhost. Let's check if a service worker still exists or not.
|
|
||||||
checkValidServiceWorker(swUrl, config);
|
|
||||||
|
|
||||||
// Add some additional logging to localhost, pointing developers to the
|
|
||||||
// service worker/PWA documentation.
|
|
||||||
navigator.serviceWorker.ready.then(() => {
|
|
||||||
console.log(
|
|
||||||
'This web app is being served cache-first by a service ' +
|
|
||||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Is not localhost. Just register service worker
|
|
||||||
registerValidSW(swUrl, config);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function registerValidSW(swUrl, config) {
|
|
||||||
navigator.serviceWorker
|
|
||||||
.register(swUrl)
|
|
||||||
.then(registration => {
|
|
||||||
registration.onupdatefound = () => {
|
|
||||||
const installingWorker = registration.installing;
|
|
||||||
if (installingWorker == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
installingWorker.onstatechange = () => {
|
|
||||||
if (installingWorker.state === 'installed') {
|
|
||||||
if (navigator.serviceWorker.controller) {
|
|
||||||
// At this point, the updated precached content has been fetched,
|
|
||||||
// but the previous service worker will still serve the older
|
|
||||||
// content until all client tabs are closed.
|
|
||||||
console.log(
|
|
||||||
'New content is available and will be used when all ' +
|
|
||||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Execute callback
|
|
||||||
if (config && config.onUpdate) {
|
|
||||||
config.onUpdate(registration);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// At this point, everything has been precached.
|
|
||||||
// It's the perfect time to display a
|
|
||||||
// "Content is cached for offline use." message.
|
|
||||||
console.log('Content is cached for offline use.');
|
|
||||||
|
|
||||||
// Execute callback
|
|
||||||
if (config && config.onSuccess) {
|
|
||||||
config.onSuccess(registration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error('Error during service worker registration:', error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkValidServiceWorker(swUrl, config) {
|
|
||||||
// Check if the service worker can be found. If it can't reload the page.
|
|
||||||
fetch(swUrl, {
|
|
||||||
headers: { 'Service-Worker': 'script' },
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
// Ensure service worker exists, and that we really are getting a JS file.
|
|
||||||
const contentType = response.headers.get('content-type');
|
|
||||||
if (
|
|
||||||
response.status === 404 ||
|
|
||||||
(contentType != null && contentType.indexOf('javascript') === -1)
|
|
||||||
) {
|
|
||||||
// No service worker found. Probably a different app. Reload the page.
|
|
||||||
navigator.serviceWorker.ready.then(registration => {
|
|
||||||
registration.unregister().then(() => {
|
|
||||||
window.location.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Service worker found. Proceed as normal.
|
|
||||||
registerValidSW(swUrl, config);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
console.log(
|
|
||||||
'No internet connection found. App is running in offline mode.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function unregister() {
|
|
||||||
if ('serviceWorker' in navigator) {
|
|
||||||
navigator.serviceWorker.ready
|
|
||||||
.then(registration => {
|
|
||||||
registration.unregister();
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
console.error(error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
|
||||||
// allows you to do things like:
|
|
||||||
// expect(element).toHaveTextContent(/react/i)
|
|
||||||
// learn more: https://github.com/testing-library/jest-dom
|
|
||||||
import '@testing-library/jest-dom/extend-expect';
|
|
@ -4,7 +4,7 @@
|
|||||||
"description": "Пример использования пакета crypto-pro через тэг script",
|
"description": "Пример использования пакета crypto-pro через тэг script",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"link-library": "symlink-dir ./node_modules/crypto-pro/dist ./public/dist",
|
"link-library": "symlink-dir ./node_modules/crypto-pro-js/dist ./public/dist",
|
||||||
"serve": "static --host-address localhost --port 8080 public",
|
"serve": "static --host-address localhost --port 8080 public",
|
||||||
"start": "npm run link-library && npm run serve"
|
"start": "npm run link-library && npm run serve"
|
||||||
},
|
},
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
<script src="polyfills/find.js"></script>
|
<script src="polyfills/find.js"></script>
|
||||||
|
|
||||||
<!-- Библиотека -->
|
<!-- Библиотека -->
|
||||||
<script src="dist/crypto-pro.js"></script>
|
<script src="dist/crypto-pro-js.js"></script>
|
||||||
|
|
||||||
<!-- Полифиллы для работы демо скриптов -->
|
<!-- Полифиллы для работы демо скриптов -->
|
||||||
<script src="polyfills/atob-btoa.js"></script>
|
<script src="polyfills/atob-btoa.js"></script>
|
||||||
|
1065
package-lock.json
generated
1065
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "crypto-pro-js",
|
"name": "crypto-pro-js",
|
||||||
"version": "2.3.0",
|
"version": "2.3.1",
|
||||||
"description": "API для работы с КриптоПро. 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": [
|
||||||
@ -25,17 +25,15 @@
|
|||||||
"test": "jest --coverage && coveralls < coverage/lcov.info",
|
"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 && npm run examples-update:angular && npm run examples-update:react",
|
"examples-update": "npm run examples-update:script-tag",
|
||||||
"examples-update:script-tag": "npm --prefix ./examples/script-tag r crypto-pro && npm --prefix ./examples/script-tag i crypto-pro",
|
"examples-update:script-tag": "npm --prefix ./examples/script-tag r crypto-pro-js && npm --prefix ./examples/script-tag i crypto-pro-js",
|
||||||
"examples-update:angular": "npm --prefix ./examples/angular r crypto-pro && npm --prefix ./examples/angular i crypto-pro",
|
|
||||||
"examples-update:react": "npm --prefix ./examples/react r crypto-pro && npm --prefix ./examples/react i crypto-pro",
|
|
||||||
"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/kernusr/crypto-pro-js"
|
"url": "https://github.com/webmasterskaya/crypto-pro-js"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Artem Vasilev",
|
"name": "Artem Vasilev",
|
||||||
@ -79,7 +77,7 @@
|
|||||||
"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.0.1",
|
"tar": "6.1.9",
|
||||||
"ts-jest": "^25.5.1",
|
"ts-jest": "^25.5.1",
|
||||||
"ts-loader": "6.2.2",
|
"ts-loader": "6.2.2",
|
||||||
"typescript": "3.8.3",
|
"typescript": "3.8.3",
|
||||||
|
168
src/vendor/cadesplugin_api.js
vendored
168
src/vendor/cadesplugin_api.js
vendored
@ -9,11 +9,10 @@
|
|||||||
var plugin_resolve;
|
var plugin_resolve;
|
||||||
var isOpera = 0;
|
var isOpera = 0;
|
||||||
var isFireFox = 0;
|
var isFireFox = 0;
|
||||||
var isEdge = 0;
|
|
||||||
var isSafari = 0;
|
var isSafari = 0;
|
||||||
var failed_extensions = 0;
|
var isYandex = 0;
|
||||||
|
|
||||||
var canPromise = !!window.Promise;
|
var canPromise = !!window.Promise;
|
||||||
|
var cadesplugin_loaded_event_recieved = false;
|
||||||
var cadesplugin;
|
var cadesplugin;
|
||||||
|
|
||||||
if(canPromise)
|
if(canPromise)
|
||||||
@ -29,17 +28,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function check_browser() {
|
function check_browser() {
|
||||||
var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
var ua= navigator.userAgent, tem, M= ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
||||||
if(/trident/i.test(M[1])){
|
if(/trident/i.test(M[1])){
|
||||||
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
|
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
|
||||||
return { name:'IE', version:(tem[1] || '')};
|
return { name:'IE', version:(tem[1] || '')};
|
||||||
}
|
}
|
||||||
if(M[1] === 'Chrome'){
|
if(M[1] === 'Chrome'){
|
||||||
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
|
tem = ua.match(/\b(OPR|Edg|YaBrowser)\/(\d+)/);
|
||||||
if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};
|
if (tem != null)
|
||||||
|
return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] };
|
||||||
}
|
}
|
||||||
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
|
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
|
||||||
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
|
if ((tem = ua.match(/version\/(\d+)/i)) != null)
|
||||||
|
M.splice(1, 1, tem[1]);
|
||||||
return {name:M[0],version:M[1]};
|
return {name:M[0],version:M[1]};
|
||||||
}
|
}
|
||||||
var browserSpecs = check_browser();
|
var browserSpecs = check_browser();
|
||||||
@ -86,10 +87,14 @@
|
|||||||
|
|
||||||
function set_constantValues()
|
function set_constantValues()
|
||||||
{
|
{
|
||||||
|
cadesplugin.CAPICOM_MEMORY_STORE = 0;
|
||||||
cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;
|
cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;
|
||||||
cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;
|
cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;
|
||||||
|
cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;
|
||||||
|
cadesplugin.CADESCOM_MEMORY_STORE = 0;
|
||||||
cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;
|
cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;
|
||||||
cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;
|
cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;
|
||||||
|
cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;
|
||||||
cadesplugin.CADESCOM_CONTAINER_STORE = 100;
|
cadesplugin.CADESCOM_CONTAINER_STORE = 100;
|
||||||
|
|
||||||
cadesplugin.CAPICOM_MY_STORE = "My";
|
cadesplugin.CAPICOM_MY_STORE = "My";
|
||||||
@ -102,11 +107,22 @@
|
|||||||
cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;
|
cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;
|
||||||
cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;
|
cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;
|
||||||
|
|
||||||
|
cadesplugin.CADESCOM_XADES_DEFAULT = 0x00000010;
|
||||||
|
cadesplugin.CADESCOM_XADES_BES = 0x00000020;
|
||||||
|
cadesplugin.CADESCOM_XADES_T = 0x00000050;
|
||||||
|
cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;
|
||||||
|
cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;
|
||||||
|
|
||||||
cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
|
cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411";
|
||||||
cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411";
|
cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411";
|
||||||
cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411";
|
cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411";
|
||||||
cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411";
|
cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411";
|
||||||
|
|
||||||
|
cadesplugin.XmlDsigGost3411Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256";
|
||||||
|
cadesplugin.XmlDsigGost3410Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256";
|
||||||
|
cadesplugin.XmlDsigGost3411Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512";
|
||||||
|
cadesplugin.XmlDsigGost3410Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512";
|
||||||
|
|
||||||
cadesplugin.CADESCOM_CADES_DEFAULT = 0;
|
cadesplugin.CADESCOM_CADES_DEFAULT = 0;
|
||||||
cadesplugin.CADESCOM_CADES_BES = 1;
|
cadesplugin.CADESCOM_CADES_BES = 1;
|
||||||
cadesplugin.CADESCOM_CADES_T = 0x5;
|
cadesplugin.CADESCOM_CADES_T = 0x5;
|
||||||
@ -155,6 +171,7 @@
|
|||||||
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
|
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;
|
||||||
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
|
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;
|
||||||
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;
|
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;
|
||||||
|
cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;
|
||||||
cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;
|
cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;
|
||||||
|
|
||||||
cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;
|
cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;
|
||||||
@ -194,6 +211,31 @@
|
|||||||
cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;
|
cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;
|
||||||
cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;
|
cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;
|
||||||
cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;
|
cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;
|
||||||
|
cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;
|
||||||
|
cadesplugin.CADESCOM_UseContainerStore = 0x40000000;
|
||||||
|
|
||||||
|
cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;
|
||||||
|
cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;
|
||||||
|
cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;
|
||||||
|
cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;
|
||||||
|
|
||||||
|
cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;
|
||||||
|
cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;
|
||||||
|
cadesplugin.ENABLE_CARRIER_CREATE = 0x02;
|
||||||
|
cadesplugin.ENABLE_ANY_OPERATION = 0x03;
|
||||||
|
|
||||||
|
cadesplugin.CADESCOM_PRODUCT_CSP = 0;
|
||||||
|
cadesplugin.CADESCOM_PRODUCT_OCSP = 1;
|
||||||
|
cadesplugin.CADESCOM_PRODUCT_TSP = 2;
|
||||||
|
|
||||||
|
cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;
|
||||||
|
cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;
|
||||||
|
cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;
|
||||||
|
cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;
|
||||||
|
|
||||||
|
cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;
|
||||||
|
cadesplugin.AT_KEYEXCHANGE = 1;
|
||||||
|
cadesplugin.AT_SIGNATURE = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
function async_spawn(generatorFunc) {
|
function async_spawn(generatorFunc) {
|
||||||
@ -234,8 +276,11 @@
|
|||||||
if(isIE())
|
if(isIE())
|
||||||
return false;
|
return false;
|
||||||
// В Edge работаем через NativeMessage
|
// В Edge работаем через NativeMessage
|
||||||
if(browserSpecs.name === 'Edge') {
|
if (browserSpecs.name === 'Edg') {
|
||||||
isEdge = true;
|
return true;
|
||||||
|
}
|
||||||
|
if (browserSpecs.name === 'YaBrowser') {
|
||||||
|
isYandex = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии
|
// В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии
|
||||||
@ -436,57 +481,7 @@
|
|||||||
ovr.style.visibility="visible";
|
ovr.style.visibility="visible";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function firefox_or_safari_nmcades_onload() {
|
||||||
|
|
||||||
//Выводим окно поверх других с предложением установить расширение для Opera.
|
|
||||||
//Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение
|
|
||||||
function install_opera_extension()
|
|
||||||
{
|
|
||||||
if (!window.cadesplugin_skip_extension_install)
|
|
||||||
{
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
var ovr = document.createElement('div');
|
|
||||||
ovr.id = "cadesplugin_ovr";
|
|
||||||
ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)";
|
|
||||||
ovr.innerHTML = "<div id='cadesplugin_ovr_item' style='position:relative; width:400px; margin:100px auto; background-color:#fff; border:2px solid #000; padding:10px; text-align:center; opacity: 1; z-index: 1500'>" +
|
|
||||||
"<button id='cadesplugin_close_install' style='float: right; font-size: 10px; background: transparent; border: 1; margin: -5px'>X</button>" +
|
|
||||||
"<p>Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera." +
|
|
||||||
"<p><button id='cadesplugin_install' style='font:12px Arial'>Установить расширение</button></p>" +
|
|
||||||
"</div>";
|
|
||||||
document.getElementsByTagName("Body")[0].appendChild(ovr);
|
|
||||||
var btn_install = document.getElementById("cadesplugin_install");
|
|
||||||
btn_install.addEventListener('click', function(event) {
|
|
||||||
opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm",
|
|
||||||
function()
|
|
||||||
{
|
|
||||||
document.getElementById("cadesplugin_ovr").style.visibility = 'hidden';
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
function(){})
|
|
||||||
});
|
|
||||||
document.getElementById("cadesplugin_close_install").addEventListener('click',function()
|
|
||||||
{
|
|
||||||
plugin_loaded_error("Плагин недоступен");
|
|
||||||
document.getElementById("cadesplugin_ovr").style.visibility = 'hidden';
|
|
||||||
});
|
|
||||||
|
|
||||||
ovr.addEventListener('click',function()
|
|
||||||
{
|
|
||||||
plugin_loaded_error("Плагин недоступен");
|
|
||||||
document.getElementById("cadesplugin_ovr").style.visibility = 'hidden';
|
|
||||||
});
|
|
||||||
ovr.style.visibility="visible";
|
|
||||||
document.getElementById("cadesplugin_ovr_item").addEventListener('click',function(e){
|
|
||||||
e.stopPropagation();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
plugin_loaded_error("Плагин недоступен");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function firefox_or_edge_nmcades_onload() {
|
|
||||||
cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);
|
cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,45 +490,56 @@
|
|||||||
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"))
|
||||||
return;
|
return;
|
||||||
if(isFireFox || isEdge || isSafari)
|
if (cadesplugin_loaded_event_recieved)
|
||||||
|
return;
|
||||||
|
if(isFireFox || isSafari)
|
||||||
{
|
{
|
||||||
// Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js
|
// Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js
|
||||||
var url = event.data.substring(event.data.indexOf("url:") + 4);
|
var url = event.data.substring(event.data.indexOf("url:") + 4);
|
||||||
|
if (!url.match("^moz-extension://[a-zA-Z0-9-]+/nmcades_plugin_api.js$")
|
||||||
|
&& !url.match("^safari-extension://[a-zA-Z0-9-]+/[a-zA-Z0-9]+/nmcades_plugin_api.js$"))
|
||||||
|
{
|
||||||
|
cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "Bad url \"" + url + "\" for load CryptoPro Extension for CAdES Browser plug-in");
|
||||||
|
plugin_loaded_error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
var fileref = document.createElement('script');
|
var fileref = document.createElement('script');
|
||||||
fileref.setAttribute("type", "text/javascript");
|
fileref.setAttribute("type", "text/javascript");
|
||||||
fileref.setAttribute("src", url);
|
fileref.setAttribute("src", url);
|
||||||
fileref.onerror = plugin_loaded_error;
|
fileref.onerror = plugin_loaded_error;
|
||||||
fileref.onload = firefox_or_edge_nmcades_onload;
|
fileref.onload = firefox_or_safari_nmcades_onload;
|
||||||
document.getElementsByTagName("head")[0].appendChild(fileref);
|
document.getElementsByTagName("head")[0].appendChild(fileref);
|
||||||
// Для Firefox, Safari и Edge у нас только по одному расширению.
|
|
||||||
failed_extensions++;
|
|
||||||
}else {
|
}else {
|
||||||
cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);
|
cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);
|
||||||
}
|
}
|
||||||
|
cadesplugin_loaded_event_recieved = true;
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari
|
//Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari
|
||||||
function load_extension()
|
function load_extension()
|
||||||
{
|
{
|
||||||
|
if(isFireFox || isSafari){
|
||||||
if(isFireFox || isEdge || isSafari){
|
|
||||||
// вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.
|
// вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.
|
||||||
nmcades_api_onload();
|
nmcades_api_onload();
|
||||||
} else {
|
} else {
|
||||||
// в асинхронном варианте для chrome и opera подключаем оба расширения
|
// в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.
|
||||||
|
if (isOpera || isYandex) {
|
||||||
|
var fileref = document.createElement('script');
|
||||||
|
fileref.setAttribute("type", "text/javascript");
|
||||||
|
fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js");
|
||||||
|
fileref.onerror = plugin_loaded_error;
|
||||||
|
fileref.onload = nmcades_api_onload;
|
||||||
|
document.getElementsByTagName("head")[0].appendChild(fileref);
|
||||||
|
} else {
|
||||||
|
// для Chrome, Chromium, Chromium Edge расширение из Chrome store
|
||||||
var fileref = document.createElement('script');
|
var fileref = document.createElement('script');
|
||||||
fileref.setAttribute("type", "text/javascript");
|
fileref.setAttribute("type", "text/javascript");
|
||||||
fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js");
|
fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js");
|
||||||
fileref.onerror = plugin_loaded_error;
|
fileref.onerror = plugin_loaded_error;
|
||||||
fileref.onload = nmcades_api_onload;
|
fileref.onload = nmcades_api_onload;
|
||||||
document.getElementsByTagName("head")[0].appendChild(fileref);
|
document.getElementsByTagName("head")[0].appendChild(fileref);
|
||||||
fileref = document.createElement('script');
|
}
|
||||||
fileref.setAttribute("type", "text/javascript");
|
|
||||||
fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js");
|
|
||||||
fileref.onerror = plugin_loaded_error;
|
|
||||||
fileref.onload = nmcades_api_onload;
|
|
||||||
document.getElementsByTagName("head")[0].appendChild(fileref);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,18 +582,6 @@
|
|||||||
//Отправляем событие что сломались.
|
//Отправляем событие что сломались.
|
||||||
function plugin_loaded_error(msg)
|
function plugin_loaded_error(msg)
|
||||||
{
|
{
|
||||||
if(isNativeMessageSupported())
|
|
||||||
{
|
|
||||||
//в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera
|
|
||||||
failed_extensions++;
|
|
||||||
if(failed_extensions<2)
|
|
||||||
return;
|
|
||||||
if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))
|
|
||||||
{
|
|
||||||
install_opera_extension();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(typeof(msg) === 'undefined' || typeof(msg) === 'object')
|
if(typeof(msg) === 'undefined' || typeof(msg) === 'object')
|
||||||
msg = "Плагин недоступен";
|
msg = "Плагин недоступен";
|
||||||
plugin_resolved = 1;
|
plugin_resolved = 1;
|
||||||
@ -698,7 +692,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Export
|
//Export
|
||||||
cadesplugin.JSModuleVersion = "2.1.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