Merge branch 'master' into release/2.1.0

This commit is contained in:
vgoma 2020-07-11 23:09:35 +03:00
commit 019e825895
23 changed files with 64 additions and 46 deletions

View File

@ -1,11 +0,0 @@
# see what'll be included with `npm pack --dry-run`
/examples
/src
/types
/package
/tsconfig*
/*.js
/*.gif
/.*

View File

@ -1,3 +1,15 @@
2.0.5 / 2020-07-04
==================
* Улучшение: Дополнены словари для расшифровки данных о сертификате
2.0.4 / 2020-04-05
==================
* Улучшение: Исправлены ссылки в README.md
* Улучшение: Добавлен файл с лицензией
* Улучшение: Обновлены версии пакета в примерах
2.0.3 / 2020-03-29 2.0.3 / 2020-03-29
================== ==================

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 KiB

After

Width:  |  Height:  |  Size: 791 KiB

View File

@ -1,4 +1,4 @@
// Type definitions for crypto-pro 2.0.4 // Type definitions for crypto-pro 2.0.5
// Project: crypto-pro // Project: crypto-pro
// Definitions by: Vitalii Goma https://github.com/vgoma // Definitions by: Vitalii Goma https://github.com/vgoma

8
dist/crypto-pro.js vendored
View File

@ -1275,7 +1275,7 @@ exports.ISSUER_TAGS_TRANSLATIONS = [
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
{ possibleNames: ['ИНН', 'INN'], translation: 'ИНН' }, { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
{ possibleNames: ['E'], translation: 'Email' }, { possibleNames: ['E'], translation: 'Email' },
{ possibleNames: ['L'], translation: 'Город' }, { possibleNames: ['L'], translation: 'Город' },
]; ];
@ -1365,7 +1365,7 @@ exports.SUBJECT_TAGS_TRANSLATIONS = [
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
{ possibleNames: ['ИНН', 'INN'], translation: 'ИНН' }, { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
{ possibleNames: ['E'], translation: 'Email' }, { possibleNames: ['E'], translation: 'Email' },
{ possibleNames: ['L'], translation: 'Город' }, { possibleNames: ['L'], translation: 'Город' },
]; ];
@ -1749,11 +1749,11 @@ var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"
* @returns расшифрованная информация по отдельным тэгам * @returns расшифрованная информация по отдельным тэгам
*/ */
exports._parseCertInfo = function (tagsTranslations, rawInfo) { exports._parseCertInfo = function (tagsTranslations, rawInfo) {
var extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); var extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g);
if (extractedEntities) { if (extractedEntities) {
return extractedEntities.map(function (group) { return extractedEntities.map(function (group) {
var _a, _b, _c; var _a, _b, _c;
var segmentsMatch = group.match(/^([а-яА-Яa-zA-Z0-9.]+)=(.+?),?$/); var segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/);
var title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; var title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1];
// Вырезаем лишние кавычки // Вырезаем лишние кавычки
var description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); var description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3308,9 +3308,9 @@
} }
}, },
"crypto-pro": { "crypto-pro": {
"version": "2.0.4", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.0.4.tgz", "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.0.5.tgz",
"integrity": "sha512-fR8RE7iApGdvb0Z6vKV4yeaapKZyzZf/98ShA7i4Y2Mn1p3iwpL22X6gQWlFc/VGvz29dKomvvWiXiVYmOryfw==" "integrity": "sha512-YZbVNt9ZmE75H97gdqS2ZGW8xnuHxdvQxLH/SmMQIizIBLmMIylOhY3HvgEUxnrIkL64/m6vrG5H2w7pGTb17Q=="
}, },
"css": { "css": {
"version": "2.2.4", "version": "2.2.4",
@ -13162,9 +13162,9 @@
} }
}, },
"websocket-extensions": { "websocket-extensions": {
"version": "0.1.3", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz", "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz",
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==", "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
"dev": true "dev": true
}, },
"when": { "when": {

View File

@ -21,7 +21,7 @@
"@angular/platform-browser": "~9.0.7", "@angular/platform-browser": "~9.0.7",
"@angular/platform-browser-dynamic": "~9.0.7", "@angular/platform-browser-dynamic": "~9.0.7",
"@angular/router": "~9.0.7", "@angular/router": "~9.0.7",
"crypto-pro": "2.0.4", "crypto-pro": "2.0.5",
"rxjs": "~6.5.4", "rxjs": "~6.5.4",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"zone.js": "~0.10.2" "zone.js": "~0.10.2"

View File

@ -3712,9 +3712,9 @@
} }
}, },
"crypto-pro": { "crypto-pro": {
"version": "2.0.4", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.0.4.tgz", "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.0.5.tgz",
"integrity": "sha512-fR8RE7iApGdvb0Z6vKV4yeaapKZyzZf/98ShA7i4Y2Mn1p3iwpL22X6gQWlFc/VGvz29dKomvvWiXiVYmOryfw==" "integrity": "sha512-YZbVNt9ZmE75H97gdqS2ZGW8xnuHxdvQxLH/SmMQIizIBLmMIylOhY3HvgEUxnrIkL64/m6vrG5H2w7pGTb17Q=="
}, },
"css": { "css": {
"version": "2.2.4", "version": "2.2.4",

View File

@ -7,7 +7,7 @@
"@testing-library/jest-dom": "4.2.4", "@testing-library/jest-dom": "4.2.4",
"@testing-library/react": "9.5.0", "@testing-library/react": "9.5.0",
"@testing-library/user-event": "7.2.1", "@testing-library/user-event": "7.2.1",
"crypto-pro": "2.0.4", "crypto-pro": "2.0.5",
"react": "^16.13.1", "react": "^16.13.1",
"react-app-polyfill": "1.0.6", "react-app-polyfill": "1.0.6",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",

View File

@ -42,9 +42,9 @@
"dev": true "dev": true
}, },
"crypto-pro": { "crypto-pro": {
"version": "2.0.4", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.0.4.tgz", "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.0.5.tgz",
"integrity": "sha512-fR8RE7iApGdvb0Z6vKV4yeaapKZyzZf/98ShA7i4Y2Mn1p3iwpL22X6gQWlFc/VGvz29dKomvvWiXiVYmOryfw==" "integrity": "sha512-YZbVNt9ZmE75H97gdqS2ZGW8xnuHxdvQxLH/SmMQIizIBLmMIylOhY3HvgEUxnrIkL64/m6vrG5H2w7pGTb17Q=="
}, },
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",

View File

@ -13,6 +13,6 @@
"symlink-dir": "3.1.2" "symlink-dir": "3.1.2"
}, },
"dependencies": { "dependencies": {
"crypto-pro": "2.0.4" "crypto-pro": "2.0.5"
} }
} }

2
lib/crypto-pro.d.ts vendored
View File

@ -1,4 +1,4 @@
// Type definitions for crypto-pro 2.0.4 // Type definitions for crypto-pro 2.0.5
// Project: crypto-pro // Project: crypto-pro
// Definitions by: Vitalii Goma https://github.com/vgoma // Definitions by: Vitalii Goma https://github.com/vgoma

View File

@ -1050,7 +1050,7 @@ exports.ISSUER_TAGS_TRANSLATIONS = [
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
{ possibleNames: ['ИНН', 'INN'], translation: 'ИНН' }, { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
{ possibleNames: ['E'], translation: 'Email' }, { possibleNames: ['E'], translation: 'Email' },
{ possibleNames: ['L'], translation: 'Город' }, { possibleNames: ['L'], translation: 'Город' },
]; ];
@ -1140,7 +1140,7 @@ exports.SUBJECT_TAGS_TRANSLATIONS = [
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
{ possibleNames: ['ИНН', 'INN'], translation: 'ИНН' }, { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
{ possibleNames: ['E'], translation: 'Email' }, { possibleNames: ['E'], translation: 'Email' },
{ possibleNames: ['L'], translation: 'Город' }, { possibleNames: ['L'], translation: 'Город' },
]; ];
@ -1476,11 +1476,11 @@ const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.t
* @returns расшифрованная информация по отдельным тэгам * @returns расшифрованная информация по отдельным тэгам
*/ */
exports._parseCertInfo = (tagsTranslations, rawInfo) => { exports._parseCertInfo = (tagsTranslations, rawInfo) => {
const extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); const extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g);
if (extractedEntities) { if (extractedEntities) {
return extractedEntities.map((group) => { return extractedEntities.map((group) => {
var _a, _b, _c; var _a, _b, _c;
const segmentsMatch = group.match(/^([а-яА-Яa-zA-Z0-9.]+)=(.+?),?$/); const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/);
let title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; let title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1];
// Вырезаем лишние кавычки // Вырезаем лишние кавычки
const description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); const description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"');

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "crypto-pro", "name": "crypto-pro",
"version": "2.0.4", "version": "2.0.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,9 +1,14 @@
{ {
"name": "crypto-pro", "name": "crypto-pro",
"version": "2.0.4", "version": "2.0.5",
"description": "API для взаимодействия с КриптоПро", "description": "API для взаимодействия с КриптоПро",
"main": "./lib/crypto-pro.js", "main": "./lib/crypto-pro.js",
"types": "./lib/crypto-pro.d.ts", "types": "./lib/crypto-pro.d.ts",
"files": [
"lib/**/*",
"dist/**/*",
"bower.json"
],
"scripts": { "scripts": {
"clean": "rimraf dist lib package coverage", "clean": "rimraf dist lib package coverage",
"start": "cross-env TS_CONFIG=tsconfig-es5.json webpack --watch", "start": "cross-env TS_CONFIG=tsconfig-es5.json webpack --watch",

View File

@ -12,7 +12,7 @@ export const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
{ possibleNames: ['ИНН', 'INN'], translation: 'ИНН' }, { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
{ possibleNames: ['E'], translation: 'Email' }, { possibleNames: ['E'], translation: 'Email' },
{ possibleNames: ['L'], translation: 'Город' }, { possibleNames: ['L'], translation: 'Город' },
]; ];

View File

@ -14,7 +14,7 @@ export const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [
{ possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },
{ possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },
{ possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },
{ possibleNames: ['ИНН', 'INN'], translation: 'ИНН' }, { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },
{ possibleNames: ['E'], translation: 'Email' }, { possibleNames: ['E'], translation: 'Email' },
{ possibleNames: ['L'], translation: 'Город' }, { possibleNames: ['L'], translation: 'Город' },
]; ];

View File

@ -19,6 +19,7 @@ describe('_parseCertInfo', () => {
'UNKNOWN=неизвестный тэг', 'UNKNOWN=неизвестный тэг',
'E=email@example.ru', 'E=email@example.ru',
'INN=007811514257', 'INN=007811514257',
'ИНН организации=007811514257',
'OGRN=1127847087885', 'OGRN=1127847087885',
'SNILS=11617693460', 'SNILS=11617693460',
].join(', '); ].join(', ');
@ -99,6 +100,11 @@ describe('_parseCertInfo', () => {
title: 'ИНН', title: 'ИНН',
isTranslated: true, isTranslated: true,
}, },
{
description: '007811514257',
title: 'ИНН',
isTranslated: true,
},
{ {
description: '1127847087885', description: '1127847087885',
title: 'ОГРН', title: 'ОГРН',
@ -123,6 +129,7 @@ describe('_parseCertInfo', () => {
'S=78 Санкт-Петербург', 'S=78 Санкт-Петербург',
'C=RU', 'C=RU',
'INN=007813317783', 'INN=007813317783',
'ИНН организации=007813317783',
'OGRN=1057810150892', 'OGRN=1057810150892',
'E=uc@sampokey.ru', 'E=uc@sampokey.ru',
].join(', '); ].join(', ');
@ -173,6 +180,11 @@ describe('_parseCertInfo', () => {
title: 'ИНН', title: 'ИНН',
isTranslated: true, isTranslated: true,
}, },
{
description: '007813317783',
title: 'ИНН',
isTranslated: true,
},
{ {
description: '1057810150892', description: '1057810150892',
title: 'ОГРН', title: 'ОГРН',

View File

@ -15,11 +15,11 @@ export interface TagTranslation {
* @returns расшифрованная информация по отдельным тэгам * @returns расшифрованная информация по отдельным тэгам
*/ */
export const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => { export const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {
const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g);
if (extractedEntities) { if (extractedEntities) {
return extractedEntities.map((group) => { return extractedEntities.map((group) => {
const segmentsMatch = group.match(/^([а-яА-Яa-zA-Z0-9.]+)=(.+?),?$/); const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/);
let title = segmentsMatch?.[1]; let title = segmentsMatch?.[1];
// Вырезаем лишние кавычки // Вырезаем лишние кавычки
const description = segmentsMatch?.[2]?.replace(/^"(.*)"/, '$1')?.replace(/"{2}/g, '"'); const description = segmentsMatch?.[2]?.replace(/^"(.*)"/, '$1')?.replace(/"{2}/g, '"');