diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-11-27 17:59:51 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-11-27 17:59:57 +0100 |
commit | c3ca556affe2f514aeb7fd052fe6d626d9319e99 (patch) | |
tree | ffd85c479b3201c6372d380bb0a2819af503539c /src/crypto/emscInterface-test.ts | |
parent | d42b9e3df8d1bf0e2d0805a04663a79b22a2545d (diff) | |
download | wallet-core-c3ca556affe2f514aeb7fd052fe6d626d9319e99.tar.xz |
JS-only crypto (only primitives so far)
Diffstat (limited to 'src/crypto/emscInterface-test.ts')
-rw-r--r-- | src/crypto/emscInterface-test.ts | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/src/crypto/emscInterface-test.ts b/src/crypto/emscInterface-test.ts index 422ee45e2..30b9c2b51 100644 --- a/src/crypto/emscInterface-test.ts +++ b/src/crypto/emscInterface-test.ts @@ -20,8 +20,7 @@ import test from "ava"; import { NodeEmscriptenLoader } from "./nodeEmscriptenLoader"; import * as native from "./emscInterface"; -import nacl = require("./nacl-fast"); -import { encodeCrock, decodeCrock } from "./nativeCrypto"; +import { encodeCrock, decodeCrock } from "./talerCrypto"; import { timestampCheck } from "../helpers"; @@ -37,12 +36,7 @@ test("string hashing", async (t) => { const te = new TextEncoder(); - const x2 = te.encode("hello taler\0") - - const hc2 = encodeCrock(nacl.hash(x2)); - - console.log(`# hc2 ${hc}`); - t.true(h === hc2); + const x2 = te.encode("hello taler\0"); t.pass(); }); @@ -68,29 +62,8 @@ test("signing", async (t) => { console.timeEnd("a"); t.true(native.eddsaVerify(native.SignaturePurpose.TEST, purpose, sig, pub)); - console.log("priv size", decodeCrock(privCrock).byteLength); - - const pair = nacl.sign_keyPair_fromSeed(new Uint8Array(decodeCrock(privCrock))); - - console.log("emsc priv", privCrock); - console.log("emsc pub", pubCrock); - - console.log("nacl priv", encodeCrock(pair.secretKey)); - console.log("nacl pub", encodeCrock(pair.publicKey)); - const d2 = new Uint8Array(decodeCrock(purposeDataCrock)); - const d3 = nacl.hash(d2); - - console.time("b"); - for (let i = 0; i < 5000; i++) { - const s2 = nacl.sign_detached(d3, pair.secretKey); - } - console.timeEnd("b"); - - const s2 = nacl.sign_detached(d3, pair.secretKey); - console.log("sig1:", sig.toCrock()); - console.log("sig2:", encodeCrock(s2)); t.pass(); }); |