рефакторинг

This commit is contained in:
vgoma 2017-11-29 14:19:24 +03:00
parent 798fc26a8d
commit 6fd7a3db79
2 changed files with 14 additions and 14 deletions

View File

@ -18,7 +18,7 @@ Certificate.prototype.isValid = function isValid() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var result; var result;
try { try {
@ -41,7 +41,7 @@ Certificate.prototype.getProp = function (propName) {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var result; var result;
try { try {
@ -63,7 +63,7 @@ Certificate.prototype.exportBase64 = function exportBase64() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var base64; var base64;
try { try {
@ -85,7 +85,7 @@ Certificate.prototype.getAlgorithm = function getAlgorithm() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var result = {}, var result = {},
algorithm; algorithm;
@ -128,7 +128,7 @@ Certificate.prototype.getExtendedKeyUsage = function getExtendedKeyUsage() {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var OIDS = [], var OIDS = [],
count, count,
item; item;
@ -169,7 +169,7 @@ Certificate.prototype.hasExtendedKeyUsage = cryptoCommon.hasExtendedKeyUsage;
* */ * */
function isValidEDSSettings() { function isValidEDSSettings() {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var result; var result;
try { try {
@ -188,7 +188,7 @@ function isValidEDSSettings() {
* */ * */
function getCadesCert(hash) { function getCadesCert(hash) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'), var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
certs, certs,
certCnt, certCnt,
@ -253,7 +253,7 @@ function getCertInfo(tags, propName) {
var cert = this._cert; var cert = this._cert;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var propInfo; var propInfo;
try { try {
@ -281,7 +281,7 @@ function getCertsList(resetCache) {
return; return;
} }
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'), var oStore = 'yield' + cryptoCommon.createObj('CAdESCOM.Store'),
result = [], result = [],
certs, certs,
@ -398,7 +398,7 @@ function signData(hash, dataBase64, signType) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
getCadesCert(hash).then(function (cert) { getCadesCert(hash).then(function (cert) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var clientTime = new Date(), var clientTime = new Date(),
oAttrs = 'yield' + cryptoCommon.createObj('CADESCOM.CPAttribute'), oAttrs = 'yield' + cryptoCommon.createObj('CADESCOM.CPAttribute'),
oSignedData = 'yield' + cryptoCommon.createObj('CAdESCOM.CadesSignedData'), oSignedData = 'yield' + cryptoCommon.createObj('CAdESCOM.CadesSignedData'),
@ -456,7 +456,7 @@ function signData(hash, dataBase64, signType) {
function signDataXML(hash, dataXML) { function signDataXML(hash, dataXML) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
getCadesCert(hash).then(function (cert) { getCadesCert(hash).then(function (cert) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var oSigner = 'yield' + cryptoCommon.createObj('CAdESCOM.CPSigner'), var oSigner = 'yield' + cryptoCommon.createObj('CAdESCOM.CPSigner'),
signerXML = 'yield' + cryptoCommon.createObj('CAdESCOM.SignedXML'), signerXML = 'yield' + cryptoCommon.createObj('CAdESCOM.SignedXML'),
cnts = cryptoConstants, cnts = cryptoConstants,
@ -498,7 +498,7 @@ function getSystemInfo() {
var sysInfo = cryptoCommon.getEnvInfo(); var sysInfo = cryptoCommon.getEnvInfo();
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
eval(cryptoCommon.execute(function () { eval(cryptoCommon.generateAsyncFn(function () {
var e; var e;
try { try {

View File

@ -37,7 +37,7 @@ var subjectNameTagsTranslations = [
{possibleNames: ['L'], translation: 'Город'} {possibleNames: ['L'], translation: 'Город'}
]; ];
function execute(cb) { function generateAsyncFn(cb) {
var canAsync = cadesplugin.CreateObjectAsync; var canAsync = cadesplugin.CreateObjectAsync;
cb = String(cb); cb = String(cb);
@ -293,7 +293,7 @@ function isValidCadesVersion(version) {
} }
module.exports = { module.exports = {
execute: execute, generateAsyncFn: generateAsyncFn,
subjectNameTagsTranslations: subjectNameTagsTranslations, subjectNameTagsTranslations: subjectNameTagsTranslations,
issuerNameTagsTranslations: issuerNameTagsTranslations, issuerNameTagsTranslations: issuerNameTagsTranslations,
parseCertInfo: parseCertInfo, parseCertInfo: parseCertInfo,