From 295ab8a35c45aed0a0a06e1b77249a0f379f1b1a Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sat, 8 Feb 2020 20:14:44 +0100 Subject: [PATCH] Add missing encoding/decoding helpers in CLI --- packages/cli/src/cli.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 42b4ff56..7d0dbd59 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -96,9 +96,14 @@ export function main(originalArgs: readonly string[]): void { } } console.info(colors.yellow(" * helper functions")); - console.info(colors.yellow(" - toAscii")); + console.info(colors.yellow(" - fromAscii")); + console.info(colors.yellow(" - fromBase64")); console.info(colors.yellow(" - fromHex")); + console.info(colors.yellow(" - fromUtf8")); + console.info(colors.yellow(" - toAscii")); + console.info(colors.yellow(" - toBase64")); console.info(colors.yellow(" - toHex")); + console.info(colors.yellow(" - toUtf8")); let init = ` import * as http from 'http'; @@ -111,7 +116,7 @@ export function main(originalArgs: readonly string[]): void { } // helper functions init += ` - const { toAscii, fromHex, toHex } = Encoding; + const { fromAscii, fromBase64, fromHex, fromUtf8, toAscii, toBase64, toHex, toUtf8 } = Encoding; `; if (args.selftest) { @@ -122,6 +127,9 @@ export function main(originalArgs: readonly string[]): void { const hexHash = toHex(hash); export class NewDummyClass {}; + const encoded = toHex(toUtf8(toBase64(toAscii("hello world")))); + const decoded = fromAscii(fromBase64(fromUtf8(fromHex(encoded)))); + const pen = await Secp256k1Pen.fromMnemonic( "zebra slush diet army arrest purpose hawk source west glimpse custom record", );