Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wavesenterprise/commission-key-tool

Package Overview
Dependencies
Maintainers
10
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wavesenterprise/commission-key-tool - npm Package Compare versions

Comparing version 1.0.0-RC10 to 1.0.0-RC11

30

dist/index.js

@@ -11,2 +11,3 @@ #! /usr/bin/env node

const crypto_1 = require("./crypto");
const fs_1 = require("fs");
function customParseInt(value) {

@@ -19,2 +20,7 @@ const parsedValue = parseInt(value, 10);

}
const maskKey = (privateKey, lastCharsNum = 5) => {
const lastChars = Buffer.from(privateKey).toString('hex').padStart(64, '0').substr(64 - lastCharsNum);
fs_1.writeFileSync(`./.commission-pk-${lastChars}`, `${Buffer.from(privateKey).toString('hex')}`);
return Array(64 - lastCharsNum).fill('*').join('') + lastChars;
};
class RutokenWrapper {

@@ -113,2 +119,10 @@ constructor() {

let { n, k } = options;
if (!n && +n > 0) {
console.log(`Некорректное значение n: ${n}`);
process.exit(0);
}
if (!k && +k > 0) {
console.log(`Некорректное значение k: ${k}`);
process.exit(0);
}
try {

@@ -121,6 +135,6 @@ const rutokenWrapper = new RutokenWrapper();

console.log('publicKey', Buffer.from(publicKey).toString('hex'));
console.log('privateKey', Buffer.from(privateKey).toString('hex'));
console.log('privateKey', maskKey(privateKey));
console.log(`Разделяем ключ на ${n} частей`);
const shares = crypto.splitPrivateKey(privateKey, k, n);
console.log(shares.map((x) => `${x.idx}. ${Buffer.from(x.val).toString('hex').padStart(64, '0')}`));
console.log(shares.map((x) => `${x.idx}. ${maskKey(x.val)}`));
for (const share of shares) {

@@ -133,2 +147,6 @@ const rutoken = await rutokenWrapper.waitInitialization();

});
if (!pin) {
console.log('Некорректный пароль');
process.exit(0);
}
rutoken.connect(pin);

@@ -157,2 +175,6 @@ rutoken.writeShare(share);

});
if (!sharesCount && +sharesCount > 0) {
console.log(`Некорректное значние sharesCount: ${sharesCount}`);
process.exit(0);
}
const shares = [];

@@ -166,2 +188,6 @@ for (let i = 0; i < sharesCount; i++) {

});
if (!pin) {
console.log('Некорректный пароль');
process.exit(0);
}
rutoken.connect(pin);

@@ -168,0 +194,0 @@ const share = rutoken.readShares()[0];

2

package.json
{
"name": "@wavesenterprise/commission-key-tool",
"version": "1.0.0-RC10",
"version": "1.0.0-RC11",
"description": "Library for commission key splitting tool",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -21,3 +21,3 @@ ## Системные требования

- скачать и установить свежую версию Node.js
- скачать и установить версию Node.js v15
- установить Python 3+ из Microsoft Store

@@ -24,0 +24,0 @@ - установить https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc