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
811babb9f3
commit
825b765a86
33
dist/1.crypto-pro.js
vendored
33
dist/1.crypto-pro.js
vendored
@ -289,8 +289,8 @@ webpackJsonpCryptoPro([1],[
|
||||
return;
|
||||
}
|
||||
|
||||
cadesplugin.async_spawn(function* () {
|
||||
var oStore = yield cadesplugin.CreateObjectAsync('CAdESCOM.Store'),
|
||||
eval(cryptoCommon.execute(function () {
|
||||
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
|
||||
result = [],
|
||||
certs,
|
||||
count,
|
||||
@ -298,7 +298,7 @@ webpackJsonpCryptoPro([1],[
|
||||
|
||||
// Открываем хранилище
|
||||
try {
|
||||
yield oStore.Open(
|
||||
'yield' + oStore.Open(
|
||||
cadesplugin.CAPICOM_CURRENT_USER_STORE,
|
||||
cadesplugin.CAPICOM_MY_STORE,
|
||||
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED
|
||||
@ -310,20 +310,20 @@ webpackJsonpCryptoPro([1],[
|
||||
|
||||
// Получаем доступ к сертификатам
|
||||
try {
|
||||
certs = yield oStore.Certificates;
|
||||
certs = 'yield' + oStore.Certificates;
|
||||
|
||||
if (certs) {
|
||||
certs = yield certs.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);
|
||||
certs = 'yield' + certs.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);
|
||||
/**
|
||||
* Не рассматриваются сертификаты, в которых отсутствует закрытый ключ
|
||||
* или не действительны на данный момент
|
||||
* */
|
||||
certs = yield certs.Find(
|
||||
certs = 'yield' + certs.Find(
|
||||
cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,
|
||||
cryptoConstants.PropId.CAPICOM_PROPID_KEY_PROV_INFO
|
||||
);
|
||||
|
||||
count = yield certs.Count;
|
||||
count = 'yield' + certs.Count;
|
||||
}
|
||||
} catch (err) {
|
||||
reject('Ошибка получения списка сертификатов: ' + err.message);
|
||||
@ -337,15 +337,15 @@ webpackJsonpCryptoPro([1],[
|
||||
|
||||
try {
|
||||
while (count) {
|
||||
item = yield certs.Item(count);
|
||||
item = 'yield' + certs.Item(count);
|
||||
|
||||
result.push(new Certificate({
|
||||
_cert: yield item,
|
||||
thumbprint: yield item.Thumbprint,
|
||||
subjectName: yield item.SubjectName,
|
||||
issuerName: yield item.IssuerName,
|
||||
validFrom: yield item.ValidFromDate,
|
||||
validTo: yield item.ValidToDate
|
||||
_cert: 'yield' + item,
|
||||
thumbprint: 'yield' + item.Thumbprint,
|
||||
subjectName: 'yield' + item.SubjectName,
|
||||
issuerName: 'yield' + item.IssuerName,
|
||||
validFrom: 'yield' + item.ValidFromDate,
|
||||
validTo: 'yield' + item.ValidToDate
|
||||
}));
|
||||
|
||||
count--;
|
||||
@ -360,7 +360,7 @@ webpackJsonpCryptoPro([1],[
|
||||
_certListCache = cryptoCommon.prepareCertsInfo(result);
|
||||
|
||||
resolve(_certListCache);
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@ -617,7 +617,8 @@ webpackJsonpCryptoPro([1],[
|
||||
|
||||
cb = String(new GeneratorFunction(args, cb));
|
||||
|
||||
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
|
||||
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'cadesplugin.CreateObjectAsync$1');
|
||||
cb = cb.replace(/("|')(yield)(\1)\s*?\+\s*?\b/gm, '$2 ');
|
||||
|
||||
return 'cadesplugin.async_spawn(' + cb + ');';
|
||||
}
|
||||
|
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
3
dist/2.crypto-pro.js
vendored
3
dist/2.crypto-pro.js
vendored
@ -60,7 +60,8 @@ webpackJsonpCryptoPro([2],[
|
||||
|
||||
cb = String(new GeneratorFunction(args, cb));
|
||||
|
||||
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
|
||||
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'cadesplugin.CreateObjectAsync$1');
|
||||
cb = cb.replace(/("|')(yield)(\1)\s*?\+\s*?\b/gm, '$2 ');
|
||||
|
||||
return 'cadesplugin.async_spawn(' + cb + ');';
|
||||
}
|
||||
|
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
@ -281,8 +281,8 @@ function getCertsList(resetCache) {
|
||||
return;
|
||||
}
|
||||
|
||||
cadesplugin.async_spawn(function* () {
|
||||
var oStore = yield cadesplugin.CreateObjectAsync('CAdESCOM.Store'),
|
||||
eval(cryptoCommon.execute(function () {
|
||||
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
|
||||
result = [],
|
||||
certs,
|
||||
count,
|
||||
@ -290,7 +290,7 @@ function getCertsList(resetCache) {
|
||||
|
||||
// Открываем хранилище
|
||||
try {
|
||||
yield oStore.Open(
|
||||
'yield' + oStore.Open(
|
||||
cadesplugin.CAPICOM_CURRENT_USER_STORE,
|
||||
cadesplugin.CAPICOM_MY_STORE,
|
||||
cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED
|
||||
@ -302,20 +302,20 @@ function getCertsList(resetCache) {
|
||||
|
||||
// Получаем доступ к сертификатам
|
||||
try {
|
||||
certs = yield oStore.Certificates;
|
||||
certs = 'yield' + oStore.Certificates;
|
||||
|
||||
if (certs) {
|
||||
certs = yield certs.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);
|
||||
certs = 'yield' + certs.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);
|
||||
/**
|
||||
* Не рассматриваются сертификаты, в которых отсутствует закрытый ключ
|
||||
* или не действительны на данный момент
|
||||
* */
|
||||
certs = yield certs.Find(
|
||||
certs = 'yield' + certs.Find(
|
||||
cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,
|
||||
cryptoConstants.PropId.CAPICOM_PROPID_KEY_PROV_INFO
|
||||
);
|
||||
|
||||
count = yield certs.Count;
|
||||
count = 'yield' + certs.Count;
|
||||
}
|
||||
} catch (err) {
|
||||
reject('Ошибка получения списка сертификатов: ' + err.message);
|
||||
@ -329,15 +329,15 @@ function getCertsList(resetCache) {
|
||||
|
||||
try {
|
||||
while (count) {
|
||||
item = yield certs.Item(count);
|
||||
item = 'yield' + certs.Item(count);
|
||||
|
||||
result.push(new Certificate({
|
||||
_cert: yield item,
|
||||
thumbprint: yield item.Thumbprint,
|
||||
subjectName: yield item.SubjectName,
|
||||
issuerName: yield item.IssuerName,
|
||||
validFrom: yield item.ValidFromDate,
|
||||
validTo: yield item.ValidToDate
|
||||
_cert: 'yield' + item,
|
||||
thumbprint: 'yield' + item.Thumbprint,
|
||||
subjectName: 'yield' + item.SubjectName,
|
||||
issuerName: 'yield' + item.IssuerName,
|
||||
validFrom: 'yield' + item.ValidFromDate,
|
||||
validTo: 'yield' + item.ValidToDate
|
||||
}));
|
||||
|
||||
count--;
|
||||
@ -352,7 +352,7 @@ function getCertsList(resetCache) {
|
||||
_certListCache = cryptoCommon.prepareCertsInfo(result);
|
||||
|
||||
resolve(_certListCache);
|
||||
});
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,8 @@ function execute(cb) {
|
||||
|
||||
cb = String(new GeneratorFunction(args, cb));
|
||||
|
||||
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'yield cadesplugin.CreateObjectAsync$1');
|
||||
cb = cb.replace(/cryptoCommon\.createObj(\([\s\S]*?\))/gm, 'cadesplugin.CreateObjectAsync$1');
|
||||
cb = cb.replace(/("|')(yield)(\1)\s*?\+\s*?\b/gm, '$2 ');
|
||||
|
||||
return 'cadesplugin.async_spawn(' + cb + ');';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user