@vostokplatform/signature-generator
Advanced tools
Comparing version 1.1.2 to 1.2.1
{ | ||
"name": "@vostokplatform/signature-generator", | ||
"version": "1.1.2", | ||
"version": "1.2.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const _1 = require("../"); | ||
const __1 = require("../"); | ||
const DEFAULT_CONFIG = { | ||
networkByte: _1.MAINNET_BYTE, | ||
networkByte: __1.MAINNET_BYTE, | ||
logLevel: 'warning', | ||
@@ -7,0 +7,0 @@ minimalSeedLength: 15, |
@@ -38,4 +38,4 @@ "use strict"; | ||
exports.PUBLIC_KEY_LENGTH = 32; | ||
exports.PUBLIC_KEY_LENGTH_GOST = 64; | ||
exports.PUBLIC_KEY_GOST_LENGTH = 64; | ||
// That is to mark ByteProcessor instances which cannot be affected by user | ||
exports.STUB_NAME = 'reservedName'; |
@@ -101,5 +101,5 @@ export const PERMISSION_TRANSACTION_ROLE = { | ||
export const PUBLIC_KEY_LENGTH: number = 32; | ||
export const PUBLIC_KEY_LENGTH_GOST: number = 64; | ||
export const PUBLIC_KEY_GOST_LENGTH: number = 64; | ||
// That is to mark ByteProcessor instances which cannot be affected by user | ||
export const STUB_NAME = 'reservedName'; |
@@ -253,3 +253,3 @@ "use strict"; | ||
for (var i = 0; i < input.length; i++) { | ||
if (ctx.c === 128) { | ||
if (ctx.c === 128) { // buffer full ? | ||
ctx.t += ctx.c; // add counters | ||
@@ -267,3 +267,3 @@ blake2bCompress(ctx, false); // compress (not last) | ||
ctx.t += ctx.c; // mark last block offset | ||
while (ctx.c < 128) { | ||
while (ctx.c < 128) { // fill up with zeros | ||
ctx.b[ctx.c++] = 0; | ||
@@ -270,0 +270,0 @@ } |
@@ -44,8 +44,8 @@ "use strict"; | ||
options = options || { type: 'Array' }; | ||
if (typeof window !== 'undefined' || typeof self !== 'undefined') { | ||
if (typeof exports === 'object' && typeof module !== 'undefined') { | ||
return nodeRandom(count, options); | ||
} | ||
else if (typeof window !== 'undefined' || typeof self !== 'undefined') { | ||
return browserRandom(count, options); | ||
} | ||
else if (typeof exports === 'object' && typeof module !== 'undefined') { | ||
return nodeRandom(count, options); | ||
} | ||
else { | ||
@@ -52,0 +52,0 @@ throw new Error('Your environment is not defined'); |
@@ -52,8 +52,8 @@ declare let exports: any; | ||
options = options || { type: 'Array' }; | ||
options = options || {type: 'Array'}; | ||
if (typeof window !== 'undefined' || typeof self !== 'undefined') { | ||
if (typeof exports === 'object' && typeof module !== 'undefined') { | ||
return nodeRandom(count, options); | ||
} else if (typeof window !== 'undefined' || typeof self !== 'undefined') { | ||
return browserRandom(count, options); | ||
} else if (typeof exports === 'object' && typeof module !== 'undefined') { | ||
return nodeRandom(count, options); | ||
} else { | ||
@@ -71,13 +71,13 @@ throw new Error('Your environment is not defined'); | ||
randomArray(byteCount) { | ||
return secureRandom(byteCount, { type: 'Array' }); | ||
return secureRandom(byteCount, {type: 'Array'}); | ||
}, | ||
randomUint8Array(byteCount) { | ||
return secureRandom(byteCount, { type: 'Uint8Array' }); | ||
return secureRandom(byteCount, {type: 'Uint8Array'}); | ||
}, | ||
randomBuffer(byteCount) { | ||
return secureRandom(byteCount, { type: 'Buffer' }); | ||
return secureRandom(byteCount, {type: 'Buffer'}); | ||
} | ||
}; |
@@ -52,2 +52,3 @@ "use strict"; | ||
return this.getBytes().then((dataBytes) => { | ||
console.log('crypto', Config_1.config.isCryptoGost()); | ||
return Config_1.config.isCryptoGost() | ||
@@ -217,3 +218,3 @@ ? cryptoGost_1.default.buildTransactionSignature(dataBytes, privateKey) | ||
new __1.Long('timestamp'), | ||
new __1.Base58('transactionId') | ||
new __1.Base58('leaseId') | ||
]); | ||
@@ -220,0 +221,0 @@ exports.TX_NUMBER_MAP[9 /* CANCEL_LEASING */] = CANCEL_LEASING; |
@@ -88,2 +88,3 @@ import { | ||
return this.getBytes().then((dataBytes) => { | ||
console.log('crypto', config.isCryptoGost()) | ||
return config.isCryptoGost() | ||
@@ -274,3 +275,3 @@ ? cryptoGost.buildTransactionSignature(dataBytes, privateKey) | ||
new Long('timestamp'), | ||
new Base58('transactionId') | ||
new Base58('leaseId') | ||
]); | ||
@@ -277,0 +278,0 @@ |
@@ -11,3 +11,3 @@ "use strict"; | ||
const concat_1 = require("./concat"); | ||
const _1 = require("../"); | ||
const __1 = require("../"); | ||
const constants_1 = require("../constants"); | ||
@@ -102,3 +102,3 @@ function sha256(input) { | ||
const addressBytes = base58_1.default.decode(address); | ||
if (addressBytes[0] !== 1 || addressBytes[1] !== _1.config.getNetworkByte()) { | ||
if (addressBytes[0] !== 1 || addressBytes[1] !== __1.config.getNetworkByte()) { | ||
return false; | ||
@@ -120,3 +120,3 @@ } | ||
} | ||
const prefix = Uint8Array.from([constants_1.ADDRESS_VERSION, _1.config.getNetworkByte()]); | ||
const prefix = Uint8Array.from([constants_1.ADDRESS_VERSION, __1.config.getNetworkByte()]); | ||
const publicKeyHashPart = Uint8Array.from(hashChain(publicKeyBytes).slice(0, 20)); | ||
@@ -123,0 +123,0 @@ const rawAddress = concat_1.concatUint8Arrays(prefix, publicKeyHashPart); |
@@ -7,3 +7,3 @@ "use strict"; | ||
const concat_1 = require("./concat"); | ||
const _1 = require("../"); | ||
const __1 = require("../"); | ||
const constants_1 = require("../constants"); | ||
@@ -65,3 +65,3 @@ const gost_1 = require("../libs/gost"); | ||
const addressBytes = base58_1.default.decode(address); | ||
if (addressBytes[0] !== 1 || addressBytes[1] !== _1.config.getNetworkByte()) { | ||
if (addressBytes[0] !== 1 || addressBytes[1] !== __1.config.getNetworkByte()) { | ||
return false; | ||
@@ -83,6 +83,6 @@ } | ||
} | ||
if (!publicKeyBytes || publicKeyBytes.byteLength !== constants_1.PUBLIC_KEY_LENGTH_GOST || !(publicKeyBytes instanceof Uint8Array)) { | ||
if (!publicKeyBytes || publicKeyBytes.byteLength !== constants_1.PUBLIC_KEY_GOST_LENGTH || !(publicKeyBytes instanceof Uint8Array)) { | ||
throw new Error('Missing or invalid public key'); | ||
} | ||
const prefix = Uint8Array.from([constants_1.ADDRESS_VERSION, _1.config.getNetworkByte()]); | ||
const prefix = Uint8Array.from([constants_1.ADDRESS_VERSION, __1.config.getNetworkByte()]); | ||
const publicKeyHashPart = gost_1.default.streebog256(publicKeyBytes).slice(0, 20); | ||
@@ -89,0 +89,0 @@ const rawAddress = concat_1.concatUint8Arrays(prefix, publicKeyHashPart); |
@@ -12,3 +12,3 @@ import * as CryptoJS from 'crypto-js'; | ||
import { config } from '../'; | ||
import { ADDRESS_VERSION, INITIAL_NONCE, PRIVATE_KEY_LENGTH, PUBLIC_KEY_LENGTH_GOST as PUBLIC_KEY_LENGTH } from '../constants'; | ||
import { ADDRESS_VERSION, INITIAL_NONCE, PRIVATE_KEY_LENGTH, PUBLIC_KEY_GOST_LENGTH as PUBLIC_KEY_LENGTH } from '../constants'; | ||
import { IKeyPairBytes } from '../interface'; | ||
@@ -15,0 +15,0 @@ import cryptoGost from '../libs/gost'; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6221908
83
109072
3
11
9