Skip to content

Commit

Permalink
fix: remove broken crypto decrypt command
Browse files Browse the repository at this point in the history
`crypto decrypt` compatible with an outdated keystore format, use AEX-3-based keystores instead.

Use `account address --privateKey` instead of `crypto decrypt`
  • Loading branch information
davidyuk committed Jul 6, 2022
1 parent 32e5b0f commit 03c645c
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions src/commands/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down Expand Up @@ -101,12 +81,6 @@ program
.description('Decodes base58 address to hex')
.action(decodeAddress);

program
.command('decrypt <directory>')
.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 <tx> [privkey]')
.option('-p, --password [password]', 'password of the private key')
Expand Down

0 comments on commit 03c645c

Please sign in to comment.