diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-06-08 19:32:38 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-06-08 19:32:38 +0530 |
commit | c60b10ac827b564f999c401c013b55e123de3b5f (patch) | |
tree | d57a9b5cc6d5250fecd781c49ceebedf4f18d2b6 | |
parent | b55054241e6156432df5f3991bbb8cb0e6091c2c (diff) |
test vectors for setupRefreshPlanchet
-rw-r--r-- | src/headless/taler-wallet-cli.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts index 5a792ee00..b45b0eae8 100644 --- a/src/headless/taler-wallet-cli.ts +++ b/src/headless/taler-wallet-cli.ts @@ -25,7 +25,7 @@ import * as clk from "./clk"; import { BridgeIDBFactory } from "idb-bridge"; import { Logger } from "../util/logging"; import { Amounts } from "../util/amounts"; -import { decodeCrock } from "../crypto/talerCrypto"; +import { decodeCrock, setupRefreshPlanchet, encodeCrock } from "../crypto/talerCrypto"; import { OperationFailedAndReportedError } from "../operations/errors"; import { Bank } from "./bank"; import { classifyTalerUri, TalerUriType } from "../util/taleruri"; @@ -33,6 +33,7 @@ import { Configuration } from "../util/talerconfig"; import { setDangerousTimetravel } from "../util/time"; import { makeCodecForList, codecForString } from "../util/codec"; import { NodeHttpLib } from "./NodeHttpLib"; +import * as nacl from "../crypto/primitives/nacl-fast"; const logger = new Logger("taler-wallet-cli.ts"); @@ -535,6 +536,20 @@ const testCli = walletCli.subcommand("testingArgs", "testing", { }); testCli + .subcommand("vectors", "vectors") + .action(async (args) => { + const secretSeed = nacl.randomBytes(64); + const coinIndex = Math.ceil(Math.random() * 100) + const p = setupRefreshPlanchet(secretSeed, coinIndex); + console.log("setupRefreshPlanchet") + console.log(` (in) secret seed: ${encodeCrock(secretSeed)}`); + console.log(` (in) coin index: ${coinIndex}`); + console.log(` (out) blinding secret: ${encodeCrock(p.bks)}`); + console.log(` (out) coin priv: ${encodeCrock(p.coinPriv)}`); + console.log(` (out) coin pub: ${encodeCrock(p.coinPub)}`); + }); + +testCli .subcommand("integrationtestBasic", "integrationtest-basic") .requiredArgument("cfgfile", clk.STRING) .action(async (args) => { |