mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2025-04-18 19:43:12 +03:00
2.5.0
Signed-off-by: vgoma <vgoma@yandex.ru>
This commit is contained in:
parent
498301e4e9
commit
67e932b183
9
dist/api/createHash.d.ts
vendored
9
dist/api/createHash.d.ts
vendored
@ -1,3 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
import { TranscodeEncoding } from 'buffer';
|
||||
declare type Options = {
|
||||
hashedAlgorithm?: number;
|
||||
encoding?: TranscodeEncoding;
|
||||
};
|
||||
/**
|
||||
* Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит)
|
||||
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
|
||||
@ -7,4 +13,5 @@
|
||||
*
|
||||
* @returns хеш
|
||||
*/
|
||||
export declare const createHash: (unencryptedMessage: string | ArrayBuffer, hashedAlgorithm?: number) => Promise<string>;
|
||||
export declare const createHash: (unencryptedMessage: string | ArrayBuffer, options?: Options) => Promise<string>;
|
||||
export {};
|
||||
|
2
dist/crypto-pro.d.ts
vendored
2
dist/crypto-pro.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for crypto-pro 2.4.0
|
||||
// Type definitions for crypto-pro 2.5.0
|
||||
// Project: crypto-pro
|
||||
// Definitions by: Vitalii Goma https://github.com/vgoma
|
||||
|
||||
|
12
dist/crypto-pro.js
vendored
12
dist/crypto-pro.js
vendored
@ -3047,16 +3047,22 @@ var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */
|
||||
*
|
||||
* @returns хеш
|
||||
*/
|
||||
exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage, hashedAlgorithm) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage, options) { return __awaiter(void 0, void 0, void 0, function () {
|
||||
var cadesplugin;
|
||||
return __generator(this, function (_a) {
|
||||
cadesplugin = window.cadesplugin;
|
||||
return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createHash() {
|
||||
var _a;
|
||||
var cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData');
|
||||
var messageBase64;
|
||||
var hash;
|
||||
try {
|
||||
messageBase64 = Buffer.from(unencryptedMessage).toString('base64');
|
||||
if ((options === null || options === void 0 ? void 0 : options.encoding) && typeof unencryptedMessage === 'string') {
|
||||
messageBase64 = Buffer.from(unencryptedMessage, options === null || options === void 0 ? void 0 : options.encoding).toString('base64');
|
||||
}
|
||||
else {
|
||||
messageBase64 = Buffer.from(unencryptedMessage).toString('base64');
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
@ -3064,7 +3070,7 @@ exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencry
|
||||
}
|
||||
try {
|
||||
void (_generateCadesFn_1.__cadesAsyncToken__ +
|
||||
cadesHashedData.propset_Algorithm(hashedAlgorithm !== null && hashedAlgorithm !== void 0 ? hashedAlgorithm : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256));
|
||||
cadesHashedData.propset_Algorithm((_a = options === null || options === void 0 ? void 0 : options.hashedAlgorithm) !== null && _a !== void 0 ? _a : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256));
|
||||
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));
|
||||
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));
|
||||
}
|
||||
|
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
2
dist/crypto-pro.min.js
vendored
2
dist/crypto-pro.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/crypto-pro.min.js.map
vendored
2
dist/crypto-pro.min.js.map
vendored
File diff suppressed because one or more lines are too long
6
examples/angular/package-lock.json
generated
6
examples/angular/package-lock.json
generated
@ -3167,9 +3167,9 @@
|
||||
}
|
||||
},
|
||||
"crypto-pro": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.4.0.tgz",
|
||||
"integrity": "sha512-zrUkrr5YwXv7yu5Tte7b2vvRPeHG9HvRYCViD6JRh1YQBKu6K/+1+aRsy7iXNwHePPZWIi4vXepun4X/G+ykwQ=="
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.0.tgz",
|
||||
"integrity": "sha512-OSz1++q644gfE8wCwygPK4KfMypM1D0aFKuClLcKiDwcIK+S1duXstmwMIPFyoafiQt2H+2CKW0EtYQm+4b0FA=="
|
||||
},
|
||||
"css-loader": {
|
||||
"version": "6.7.3",
|
||||
|
@ -18,7 +18,7 @@
|
||||
"@angular/platform-browser": "^15.0.0",
|
||||
"@angular/platform-browser-dynamic": "^15.0.0",
|
||||
"@angular/router": "^15.0.0",
|
||||
"crypto-pro": "^2.4.0",
|
||||
"crypto-pro": "^2.5.0",
|
||||
"rxjs": "~7.5.0",
|
||||
"tslib": "^2.3.0",
|
||||
"zone.js": "~0.12.0"
|
||||
|
6
examples/react/package-lock.json
generated
6
examples/react/package-lock.json
generated
@ -3712,9 +3712,9 @@
|
||||
}
|
||||
},
|
||||
"crypto-pro": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.4.0.tgz",
|
||||
"integrity": "sha512-zrUkrr5YwXv7yu5Tte7b2vvRPeHG9HvRYCViD6JRh1YQBKu6K/+1+aRsy7iXNwHePPZWIi4vXepun4X/G+ykwQ=="
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.0.tgz",
|
||||
"integrity": "sha512-OSz1++q644gfE8wCwygPK4KfMypM1D0aFKuClLcKiDwcIK+S1duXstmwMIPFyoafiQt2H+2CKW0EtYQm+4b0FA=="
|
||||
},
|
||||
"css": {
|
||||
"version": "2.2.4",
|
||||
|
@ -7,7 +7,7 @@
|
||||
"@testing-library/jest-dom": "4.2.4",
|
||||
"@testing-library/react": "9.5.0",
|
||||
"@testing-library/user-event": "7.2.1",
|
||||
"crypto-pro": "^2.4.0",
|
||||
"crypto-pro": "^2.5.0",
|
||||
"react": "^16.13.1",
|
||||
"react-app-polyfill": "1.0.6",
|
||||
"react-dom": "^16.13.1",
|
||||
|
6
examples/script-tag/package-lock.json
generated
6
examples/script-tag/package-lock.json
generated
@ -42,9 +42,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"crypto-pro": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.4.0.tgz",
|
||||
"integrity": "sha512-zrUkrr5YwXv7yu5Tte7b2vvRPeHG9HvRYCViD6JRh1YQBKu6K/+1+aRsy7iXNwHePPZWIi4vXepun4X/G+ykwQ=="
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.0.tgz",
|
||||
"integrity": "sha512-OSz1++q644gfE8wCwygPK4KfMypM1D0aFKuClLcKiDwcIK+S1duXstmwMIPFyoafiQt2H+2CKW0EtYQm+4b0FA=="
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
|
@ -13,6 +13,6 @@
|
||||
"symlink-dir": "3.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"crypto-pro": "^2.4.0"
|
||||
"crypto-pro": "^2.5.0"
|
||||
}
|
||||
}
|
||||
|
9
lib/api/createHash.d.ts
vendored
9
lib/api/createHash.d.ts
vendored
@ -1,3 +1,9 @@
|
||||
/// <reference types="node" />
|
||||
import { TranscodeEncoding } from 'buffer';
|
||||
declare type Options = {
|
||||
hashedAlgorithm?: number;
|
||||
encoding?: TranscodeEncoding;
|
||||
};
|
||||
/**
|
||||
* Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит)
|
||||
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
|
||||
@ -7,4 +13,5 @@
|
||||
*
|
||||
* @returns хеш
|
||||
*/
|
||||
export declare const createHash: (unencryptedMessage: string | ArrayBuffer, hashedAlgorithm?: number) => Promise<string>;
|
||||
export declare const createHash: (unencryptedMessage: string | ArrayBuffer, options?: Options) => Promise<string>;
|
||||
export {};
|
||||
|
2
lib/crypto-pro.d.ts
vendored
2
lib/crypto-pro.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for crypto-pro 2.4.0
|
||||
// Type definitions for crypto-pro 2.5.0
|
||||
// Project: crypto-pro
|
||||
// Definitions by: Vitalii Goma https://github.com/vgoma
|
||||
|
||||
|
@ -2834,14 +2834,20 @@ const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn *
|
||||
*
|
||||
* @returns хеш
|
||||
*/
|
||||
exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage, hashedAlgorithm) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage, options) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { cadesplugin } = window;
|
||||
return eval(_generateCadesFn_1._generateCadesFn(function createHash() {
|
||||
var _a;
|
||||
const cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData');
|
||||
let messageBase64;
|
||||
let hash;
|
||||
try {
|
||||
messageBase64 = Buffer.from(unencryptedMessage).toString('base64');
|
||||
if ((options === null || options === void 0 ? void 0 : options.encoding) && typeof unencryptedMessage === 'string') {
|
||||
messageBase64 = Buffer.from(unencryptedMessage, options === null || options === void 0 ? void 0 : options.encoding).toString('base64');
|
||||
}
|
||||
else {
|
||||
messageBase64 = Buffer.from(unencryptedMessage).toString('base64');
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
console.error(error);
|
||||
@ -2849,7 +2855,7 @@ exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessa
|
||||
}
|
||||
try {
|
||||
void (_generateCadesFn_1.__cadesAsyncToken__ +
|
||||
cadesHashedData.propset_Algorithm(hashedAlgorithm !== null && hashedAlgorithm !== void 0 ? hashedAlgorithm : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256));
|
||||
cadesHashedData.propset_Algorithm((_a = options === null || options === void 0 ? void 0 : options.hashedAlgorithm) !== null && _a !== void 0 ? _a : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256));
|
||||
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));
|
||||
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "crypto-pro",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "crypto-pro",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"description": "API для взаимодействия с КриптоПро",
|
||||
"main": "./lib/crypto-pro.js",
|
||||
"types": "./lib/crypto-pro.d.ts",
|
||||
|
Loading…
Reference in New Issue
Block a user