From dfd653f84cfb3a622aef7d9d567d35a819128b1d Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 23 Jun 2022 05:03:42 -0600 Subject: [PATCH] docs: update CLI docs (and add --plain-text flag) --- bin/crowdnode.js | 13 +++++++++---- cli/README.md | 18 +++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/bin/crowdnode.js b/bin/crowdnode.js index 2cf8cdf..47357e2 100755 --- a/bin/crowdnode.js +++ b/bin/crowdnode.js @@ -74,7 +74,7 @@ function showHelp() { console.info(""); console.info("Key Management & Encryption:"); - console.info(" crowdnode generate [./privkey.wif]"); + console.info(" crowdnode generate [--plain-text] [./privkey.wif]"); console.info(" crowdnode encrypt"); // TODO allow encrypting one-by-one? console.info(" crowdnode list"); console.info(" crowdnode use "); @@ -119,6 +119,7 @@ async function main() { // flags let forceConfirm = removeItem(args, "--unconfirmed"); + let plainText = removeItem(args, "--plain-text"); let noReserve = removeItem(args, "--no-reserve"); let subcommand = args.shift(); @@ -158,7 +159,7 @@ async function main() { } if ("generate" === subcommand) { - await generateKey({ defaultKey: defaultAddr }, args); + await generateKey({ defaultKey: defaultAddr, plainText }, args); return; } @@ -559,9 +560,10 @@ async function mustGetDefaultWif(defaultAddr, opts) { /** * @param {Object} psuedoState * @param {String} psuedoState.defaultKey - addr name of default key + * @param {Boolean} psuedoState.plainText - don't encrypt * @param {Array} args */ -async function generateKey({ defaultKey }, args) { +async function generateKey({ defaultKey, plainText }, args) { let name = args.shift(); //@ts-ignore - TODO submit JSDoc PR for Dashcore let pk = new Dashcore.PrivateKey(); @@ -569,7 +571,10 @@ async function generateKey({ defaultKey }, args) { let addr = pk.toAddress().toString(); let plainWif = pk.toWIF(); - let wif = await maybeEncrypt(plainWif); + let wif = plainWif; + if (!plainText) { + wif = await maybeEncrypt(plainWif); + } let filename = `~/${configdir}/keys/${addr}.wif`; let filepath = Path.join(`${keysDir}/${addr}.wif`); diff --git a/cli/README.md b/cli/README.md index df49480..fccf840 100644 --- a/cli/README.md +++ b/cli/README.md @@ -90,15 +90,19 @@ Usage: crowdnode withdrawal [keyfile-or-addr] # 1.0-100.0 (steps by 0.1) Helpful Extras: - crowdnode generate [./privkey.wif] - crowdnode list - crowdnode encrypt # TODO - crowdnode decrypt # TODO - crowdnode use - crowdnode load [keyfile-or-addr] [dash-amount] crowdnode balance [keyfile-or-addr] + crowdnode load [keyfile-or-addr] [dash-amount] crowdnode transfer [dash-amount] - crowdnode rm + +Key Management & Encryption: + crowdnode generate [./privkey.wif] [--plain-text] + crowdnode list + crowdnode use # set as default key + crowdnode passphrase # set or rotate passphrase + crowdnode import # copy and encrypt key + crowdnode encrypt # encrypt all keys + crowdnode decrypt # decrypt all keys + crowdnode delete # delete key (must have 0 balance) CrowdNode HTTP RPC: crowdnode http FundsOpen -- 2.25.1