gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] branch master updated: add withdraw si


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] branch master updated: add withdraw signature test
Date: Thu, 09 Mar 2017 18:47:06 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-webex.

The following commit(s) were added to refs/heads/master by this push:
     new e6aed62  add withdraw signature test
e6aed62 is described below

commit e6aed62973e3fdf57d879e9c9b23d6ddecf3191f
Author: Florian Dold <address@hidden>
AuthorDate: Thu Mar 9 18:47:04 2017 +0100

    add withdraw signature test
---
 src/emscriptif-test.ts | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/emscriptif-test.ts b/src/emscriptif-test.ts
index f0baa2b..c30a066 100644
--- a/src/emscriptif-test.ts
+++ b/src/emscriptif-test.ts
@@ -47,3 +47,34 @@ test("rsa-encode", (t: TestLib) => {
   t.assert(pubHashStr == pubHash.toCrock());
   t.pass();
 });
+
+
+test("withdraw-request", (t: TestLib) => {
+  const reservePrivStr = 
"G9R8KRRCAFKPD0KW7PW48CC2T03VQ8K2AN9J6J6K2YW27J5MHN90";
+  const reservePriv = native.EddsaPrivateKey.fromCrock(reservePrivStr);
+  const reservePub = reservePriv.getPublicKey();
+  const amountWithFee = new native.Amount({currency: "KUDOS", value: 1, 
fraction: 10000});
+  amountWithFee.add(new native.Amount({currency: "KUDOS", value: 0, fraction: 
20000}));
+  const withdrawFee = new native.Amount({currency: "KUDOS", value: 0, 
fraction: 20000})
+  const denomPub = native.RsaPublicKey.fromCrock(denomPubStr1);
+  const ev = native.ByteArray.fromStringWithNull("hello, world");
+
+
+  // Signature
+  let withdrawRequest = new native.WithdrawRequestPS({
+    reserve_pub: reservePub,
+    amount_with_fee: amountWithFee.toNbo(),
+    withdraw_fee: withdrawFee.toNbo(),
+    h_denomination_pub: denomPub.encode().hash(),
+    h_coin_envelope: ev.hash()
+  });
+
+  var sigStr = 
"AD3T8W44NV193J19RAN3NAJHPP6RVB0R3NWV7ZK5G8Q946YDK0B6F8YJBNRRBXSPVTKY31S7BVZPJFFTJJRMY61DH51X4JSXK677428";
+
+  var sig = native.eddsaSign(withdrawRequest.toPurpose(), reservePriv);
+  t.assert(native.eddsaVerify(native.SignaturePurpose.RESERVE_WITHDRAW, 
withdrawRequest.toPurpose(), sig, reservePub));
+  t.assert(sig.toCrock() == sigStr);
+  t.pass();
+});
+
+

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]