mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2024-11-23 16:44:59 +03:00
попытка объединить асинхронную и синхронную кодовую базу
This commit is contained in:
parent
af437dcd23
commit
bdb36572f1
28
dist/1.crypto-pro.js
vendored
28
dist/1.crypto-pro.js
vendored
@ -177,11 +177,11 @@ webpackJsonpCryptoPro([1],[
|
||||
* */
|
||||
function isValidEDSSettings() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
cadesplugin.async_spawn(function* () {
|
||||
cryptoCommon.execute(function () {
|
||||
var result;
|
||||
|
||||
try {
|
||||
result = yield cadesplugin.CreateObjectAsync('CAdESCOM.About');
|
||||
result = cryptoCommon.createObj('CAdESCOM.About');
|
||||
} catch (error) {
|
||||
reject('Настройки ЭП на данной машине не верны');
|
||||
}
|
||||
@ -603,6 +603,28 @@ webpackJsonpCryptoPro([1],[
|
||||
{possibleNames: ['L'], translation: 'Город'}
|
||||
];
|
||||
|
||||
function execute(cb) {
|
||||
if (cadesplugin.CreateObjectAsync) {
|
||||
var GeneratorFunction = (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
|
||||
|
||||
cb = String(cb);
|
||||
|
||||
var args = cb.match(/^function\s*?\((.*?)\)/);
|
||||
|
||||
args = (args && args[1]) || '';
|
||||
|
||||
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
|
||||
|
||||
cadesplugin.async_spawn(new GeneratorFunction(args, cb));
|
||||
}
|
||||
}
|
||||
|
||||
function createObj(type) {
|
||||
if (cadesplugin.CreateObjectAsync) {
|
||||
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Парсит информацию из строки с информацией о сертификате
|
||||
* */
|
||||
@ -830,6 +852,8 @@ webpackJsonpCryptoPro([1],[
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
execute: execute,
|
||||
createObj: createObj,
|
||||
subjectNameTagsTranslations: subjectNameTagsTranslations,
|
||||
issuerNameTagsTranslations: issuerNameTagsTranslations,
|
||||
parseCertInfo: parseCertInfo,
|
||||
|
2
dist/1.crypto-pro.js.map
vendored
2
dist/1.crypto-pro.js.map
vendored
File diff suppressed because one or more lines are too long
24
dist/2.crypto-pro.js
vendored
24
dist/2.crypto-pro.js
vendored
@ -46,6 +46,28 @@ webpackJsonpCryptoPro([2],[
|
||||
{possibleNames: ['L'], translation: 'Город'}
|
||||
];
|
||||
|
||||
function execute(cb) {
|
||||
if (cadesplugin.CreateObjectAsync) {
|
||||
var GeneratorFunction = (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
|
||||
|
||||
cb = String(cb);
|
||||
|
||||
var args = cb.match(/^function\s*?\((.*?)\)/);
|
||||
|
||||
args = (args && args[1]) || '';
|
||||
|
||||
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
|
||||
|
||||
cadesplugin.async_spawn(new GeneratorFunction(args, cb));
|
||||
}
|
||||
}
|
||||
|
||||
function createObj(type) {
|
||||
if (cadesplugin.CreateObjectAsync) {
|
||||
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Парсит информацию из строки с информацией о сертификате
|
||||
* */
|
||||
@ -273,6 +295,8 @@ webpackJsonpCryptoPro([2],[
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
execute: execute,
|
||||
createObj: createObj,
|
||||
subjectNameTagsTranslations: subjectNameTagsTranslations,
|
||||
issuerNameTagsTranslations: issuerNameTagsTranslations,
|
||||
parseCertInfo: parseCertInfo,
|
||||
|
2
dist/2.crypto-pro.js.map
vendored
2
dist/2.crypto-pro.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/crypto-pro.js
vendored
2
dist/crypto-pro.js
vendored
@ -178,7 +178,7 @@ var CryptoPro =
|
||||
cadesplugin.then(
|
||||
function () {
|
||||
if (canAsync) {
|
||||
__webpack_require__.e/* nsure */(1, function () {
|
||||
__webpack_require__.e/* nsure */(1/* empty */, function () {
|
||||
cryptoService = __webpack_require__(4);
|
||||
finishLoading();
|
||||
});
|
||||
|
2
dist/crypto-pro.js.map
vendored
2
dist/crypto-pro.js.map
vendored
File diff suppressed because one or more lines are too long
@ -3,6 +3,8 @@
|
||||
|
||||
var $certs = document.querySelector('#certList');
|
||||
|
||||
window.CryptoPro.call('isValidEDSSettings');
|
||||
|
||||
/**
|
||||
* Пример получения списка сертификатов
|
||||
* */
|
||||
|
1776
npm-shrinkwrap.json
generated
1776
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -169,11 +169,11 @@ Certificate.prototype.hasExtendedKeyUsage = cryptoCommon.hasExtendedKeyUsage;
|
||||
* */
|
||||
function isValidEDSSettings() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
cadesplugin.async_spawn(function* () {
|
||||
cryptoCommon.execute(function () {
|
||||
var result;
|
||||
|
||||
try {
|
||||
result = yield cadesplugin.CreateObjectAsync('CAdESCOM.About');
|
||||
result = cryptoCommon.createObj('CAdESCOM.About');
|
||||
} catch (error) {
|
||||
reject('Настройки ЭП на данной машине не верны');
|
||||
}
|
||||
|
@ -37,6 +37,28 @@ var subjectNameTagsTranslations = [
|
||||
{possibleNames: ['L'], translation: 'Город'}
|
||||
];
|
||||
|
||||
function execute(cb) {
|
||||
if (cadesplugin.CreateObjectAsync) {
|
||||
var GeneratorFunction = (new Function('', 'return Object.getPrototypeOf(function*(){}).constructor'))();
|
||||
|
||||
cb = String(cb);
|
||||
|
||||
var args = cb.match(/^function\s*?\((.*?)\)/);
|
||||
|
||||
args = (args && args[1]) || '';
|
||||
|
||||
cb = cb.replace(/^.*?{([\s\S]*?)}$/, '$1');
|
||||
|
||||
cadesplugin.async_spawn(new GeneratorFunction(args, cb));
|
||||
}
|
||||
}
|
||||
|
||||
function createObj(type) {
|
||||
if (cadesplugin.CreateObjectAsync) {
|
||||
return (new Function('', 'return yield cadesplugin.CreateObjectAsync(' + type + ')'))();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Парсит информацию из строки с информацией о сертификате
|
||||
* */
|
||||
@ -264,6 +286,8 @@ function isValidCadesVersion(version) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
execute: execute,
|
||||
createObj: createObj,
|
||||
subjectNameTagsTranslations: subjectNameTagsTranslations,
|
||||
issuerNameTagsTranslations: issuerNameTagsTranslations,
|
||||
parseCertInfo: parseCertInfo,
|
||||
|
Loading…
Reference in New Issue
Block a user