From 03c645cbc30e0088a034135d3b26edcc9aa08f55 Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Thu, 30 Jun 2022 16:12:34 +0300 Subject: [PATCH] fix: remove broken `crypto decrypt` command `crypto decrypt` compatible with an outdated keystore format, use AEX-3-based keystores instead. Use `account address --privateKey` instead of `crypto decrypt` --- src/commands/crypto.js | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/commands/crypto.js b/src/commands/crypto.js index b9a0eee1..2b62fb45 100644 --- a/src/commands/crypto.js +++ b/src/commands/crypto.js @@ -17,27 +17,7 @@ import { Command } from 'commander'; import fs from 'fs'; -import path from 'path'; import { Crypto } from '@aeternity/aepp-sdk'; -import { prompt, PROMPT_TYPE } from '../utils/prompt'; -import { getCmdFromArguments } from '../utils/cli'; - -// ## Key Extraction (from node nodes) -async function extractReadableKeys(dir, options) { - const pwd = options.input; - const password = await prompt(PROMPT_TYPE.askPassword); - const key = fs.readFileSync(path.join(pwd, dir, 'sign_key')); - const pubKey = fs.readFileSync(path.join(pwd, dir, 'sign_key.pub')); - - const decrypted = Crypto.decryptPrivateKey(password, key); - - const privateHex = Buffer.from(decrypted).toString('hex'); - const decryptedPub = Crypto.decryptPubKey(password, pubKey); - - console.log(`Private key (hex): ${privateHex}`); - console.log(`Public key (base check): ak_${Crypto.encodeBase58Check(decryptedPub)}`); - console.log(`Public key (hex): ${decryptedPub.toString('hex')}`); -} // ## Transaction Deserialization // @@ -101,12 +81,6 @@ program .description('Decodes base58 address to hex') .action(decodeAddress); -program - .command('decrypt ') - .description('Decrypts public and private key to readable formats for testing purposes') - .option('-i, --input [directory]', 'Directory where to look for keys', '.') - .action((dir, ...args) => extractReadableKeys(dir, getCmdFromArguments(args))); - program .command('sign [privkey]') .option('-p, --password [password]', 'password of the private key')