gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (c032931f -> 3773a4cd)


From: gnunet
Subject: [taler-wallet-core] branch master updated (c032931f -> 3773a4cd)
Date: Wed, 06 Jan 2021 18:10:04 +0100

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

dold pushed a change to branch master
in repository wallet-core.

    from c032931f get basic test cases to work with new exchange
     new 458777c5 fix tipping planchet derivation
     new af08b2d1 bump version
     new 3773a4cd browser fixes

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../taler-wallet-core/src/crypto/talerCrypto.ts    |  4 ----
 .../src/crypto/workers/cryptoImplementation.ts     |  6 ++---
 packages/taler-wallet-core/src/operations/tip.ts   | 27 ++++++++++++++--------
 packages/taler-wallet-webextension/manifest.json   |  4 ++--
 packages/taler-wallet-webextension/package.json    |  2 +-
 .../src/browserHttpLib.ts                          | 13 ++++++++---
 6 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/packages/taler-wallet-core/src/crypto/talerCrypto.ts 
b/packages/taler-wallet-core/src/crypto/talerCrypto.ts
index d28f1117..38189685 100644
--- a/packages/taler-wallet-core/src/crypto/talerCrypto.ts
+++ b/packages/taler-wallet-core/src/crypto/talerCrypto.ts
@@ -340,10 +340,6 @@ export function createEcdheKeyPair(): EcdheKeyPair {
   return { ecdhePriv, ecdhePub };
 }
 
-export function createBlindingKeySecret(): Uint8Array {
-  return nacl.randomBytes(32);
-}
-
 export function hash(d: Uint8Array): Uint8Array {
   return nacl.hash(d);
 }
diff --git 
a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts 
b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
index fc8b53eb..9b703e2c 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
@@ -48,7 +48,6 @@ import {
   encodeCrock,
   decodeCrock,
   createEddsaKeyPair,
-  createBlindingKeySecret,
   hash,
   rsaBlind,
   eddsaVerify,
@@ -199,12 +198,11 @@ export class CryptoImplementation {
   createTipPlanchet(req: DeriveTipRequest): DerivedTipPlanchet {
     const fc = setupTipPlanchet(decodeCrock(req.secretSeed), 
req.planchetIndex);
     const denomPub = decodeCrock(req.denomPub);
-    const blindingFactor = createBlindingKeySecret();
     const coinPubHash = hash(fc.coinPub);
-    const ev = rsaBlind(coinPubHash, blindingFactor, denomPub);
+    const ev = rsaBlind(coinPubHash, fc.bks, denomPub);
 
     const tipPlanchet: DerivedTipPlanchet = {
-      blindingKey: encodeCrock(blindingFactor),
+      blindingKey: encodeCrock(fc.bks),
       coinEv: encodeCrock(ev),
       coinEvHash: encodeCrock(hash(ev)),
       coinPriv: encodeCrock(fc.coinPriv),
diff --git a/packages/taler-wallet-core/src/operations/tip.ts 
b/packages/taler-wallet-core/src/operations/tip.ts
index f683999b..68b5a2ad 100644
--- a/packages/taler-wallet-core/src/operations/tip.ts
+++ b/packages/taler-wallet-core/src/operations/tip.ts
@@ -52,7 +52,7 @@ import { checkDbInvariant, checkLogicInvariant } from 
"../util/invariants";
 import { TalerErrorCode } from "../TalerErrorCode";
 import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
 import { j2s } from "../util/helpers";
-import { DerivedTipPlanchet } from '../types/cryptoTypes';
+import { DerivedTipPlanchet } from "../types/cryptoTypes";
 
 const logger = new Logger("operations/tip.ts");
 
@@ -95,11 +95,11 @@ export async function prepareTip(
 
     const walletTipId = encodeCrock(getRandomBytes(32));
     await updateWithdrawalDenoms(ws, tipPickupStatus.exchange_url);
-    const denoms = await getPossibleWithdrawalDenoms(ws, 
tipPickupStatus.exchange_url);
-    const selectedDenoms = await selectWithdrawalDenominations(
-      amount,
-      denoms
+    const denoms = await getPossibleWithdrawalDenoms(
+      ws,
+      tipPickupStatus.exchange_url,
     );
+    const selectedDenoms = selectWithdrawalDenominations(amount, denoms);
 
     const secretSeed = encodeCrock(getRandomBytes(64));
 
@@ -213,7 +213,7 @@ async function processTipImpl(
   const planchets: DerivedTipPlanchet[] = [];
   // Planchets in the form that the merchant expects
   const planchetsDetail: TipPlanchetDetail[] = [];
-  const denomForPlanchet: { [index: number]: DenominationRecord} = [];
+  const denomForPlanchet: { [index: number]: DenominationRecord } = [];
 
   for (const dh of denomsForWithdraw.selectedDenoms) {
     const denom = await ws.db.get(Stores.denominations, [
@@ -222,11 +222,14 @@ async function processTipImpl(
     ]);
     checkDbInvariant(!!denom, "denomination should be in database");
     for (let i = 0; i < dh.count; i++) {
-      const p = await ws.cryptoApi.createTipPlanchet({
+      const deriveReq = {
         denomPub: denom.denomPub,
         planchetIndex: planchets.length,
         secretSeed: tipRecord.secretSeed,
-      });
+      };
+      logger.trace(`deriving tip planchet: ${j2s(deriveReq)}`)
+      const p = await ws.cryptoApi.createTipPlanchet(deriveReq);
+      logger.trace(`derive result: ${j2s(p)}`);
       denomForPlanchet[planchets.length] = denom;
       planchets.push(p);
       planchetsDetail.push({
@@ -242,14 +245,18 @@ async function processTipImpl(
   );
 
   const req = { planchets: planchetsDetail };
+  logger.trace(`sending tip request: ${j2s(req)}`);
   const merchantResp = await ws.http.postJson(tipStatusUrl.href, req);
 
+  logger.trace(`got tip response, status ${merchantResp.status}`);
+
   // Hide transient errors.
   if (
     tipRecord.retryInfo.retryCounter < 5 &&
-    merchantResp.status >= 500 &&
-    merchantResp.status <= 599
+    ((merchantResp.status >= 500 && merchantResp.status <= 599) ||
+      merchantResp.status === 424)
   ) {
+    logger.trace(`got transient tip error`);
     const err = makeErrorDetails(
       TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR,
       "tip pickup failed (transient)",
diff --git a/packages/taler-wallet-webextension/manifest.json 
b/packages/taler-wallet-webextension/manifest.json
index 0931d118..44dfe8cd 100644
--- a/packages/taler-wallet-webextension/manifest.json
+++ b/packages/taler-wallet-webextension/manifest.json
@@ -4,8 +4,8 @@
   "name": "GNU Taler Wallet (git)",
   "description": "Privacy preserving and transparent payments",
   "author": "GNU Taler Developers",
-  "version": "0.8.0.4",
-  "version_name": "0.8.0",
+  "version": "0.8.0.5",
+  "version_name": "0.8.1-dev.1",
 
   "minimum_chrome_version": "51",
   "minimum_opera_version": "36",
diff --git a/packages/taler-wallet-webextension/package.json 
b/packages/taler-wallet-webextension/package.json
index f852b682..5dc1f1b0 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -1,6 +1,6 @@
 {
   "name": "taler-wallet-webextension",
-  "version": "0.8.0",
+  "version": "0.8.1-dev.1",
   "description": "GNU Taler Wallet browser extension",
   "main": "./build/index.js",
   "types": "./build/index.d.ts",
diff --git a/packages/taler-wallet-webextension/src/browserHttpLib.ts 
b/packages/taler-wallet-webextension/src/browserHttpLib.ts
index bfc85563..08364e40 100644
--- a/packages/taler-wallet-webextension/src/browserHttpLib.ts
+++ b/packages/taler-wallet-webextension/src/browserHttpLib.ts
@@ -24,6 +24,7 @@ import {
   HttpRequestOptions,
   HttpResponse,
   Headers,
+  bytesToString,
 } from "taler-wallet-core";
 import { TalerErrorCode } from "taler-wallet-core";
 
@@ -78,10 +79,16 @@ export class BrowserHttpLib implements HttpRequestLibrary {
             reject(exc);
             return;
           }
+          const makeText = async (): Promise<string> => {
+            const td = new TextDecoder();
+            return td.decode(myRequest.response);
+          };
           const makeJson = async (): Promise<any> => {
             let responseJson;
             try {
-              responseJson = JSON.parse(myRequest.responseText);
+              const td = new TextDecoder();
+              const responseString = td.decode(myRequest.response);
+              responseJson = JSON.parse(responseString);
             } catch (e) {
               throw OperationFailedError.fromCode(
                 TalerErrorCode.WALLET_RECEIVED_MALFORMED_RESPONSE,
@@ -126,7 +133,7 @@ export class BrowserHttpLib implements HttpRequestLibrary {
             headers: headerMap,
             requestMethod: method,
             json: makeJson,
-            text: async () => myRequest.responseText,
+            text: makeText,
             bytes: async () => myRequest.response,
           };
           resolve(resp);
@@ -149,7 +156,7 @@ export class BrowserHttpLib implements HttpRequestLibrary {
   ): Promise<HttpResponse> {
     return this.fetch(url, {
       method: "POST",
-      body,
+      body: JSON.stringify(body),
       ...opt,
     });
   }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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