gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] 02/02: fix #6042


From: gnunet
Subject: [taler-wallet-core] 02/02: fix #6042
Date: Mon, 21 Jun 2021 15:08:45 +0200

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

sebasjm pushed a commit to branch master
in repository wallet-core.

commit d42a74565ebc596b67a8e105b8eb271f85b3f4d0
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Mon Jun 21 10:08:28 2021 -0300

    fix #6042
---
 .../src/crypto/workers/cryptoImplementation.ts     | 26 ++++++++++++++++++----
 packages/taler-wallet-webextension/manifest.json   |  2 +-
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git 
a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts 
b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
index 9cffef03..f799fd6e 100644
--- a/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
+++ b/packages/taler-wallet-core/src/crypto/workers/cryptoImplementation.ts
@@ -76,6 +76,7 @@ import {
   DeriveTipRequest,
   SignTrackTransactionRequest,
 } from "../cryptoTypes.js";
+import bigint from "big-integer";
 
 const logger = new Logger("cryptoImplementation.ts");
 
@@ -102,7 +103,15 @@ function amountToBuffer(amount: AmountJson): Uint8Array {
   const dvbuf = new DataView(buffer);
   const u8buf = new Uint8Array(buffer);
   const curr = stringToBytes(amount.currency);
-  dvbuf.setBigUint64(0, BigInt(amount.value));
+  if (typeof dvbuf.setBigUint64 !== "undefined") {
+    dvbuf.setBigUint64(0, BigInt(amount.value));
+  } else {
+    const arr = bigint(amount.value).toArray(2 ** 8).value
+    let offset = 8 - arr.length
+    for (let i = 0; i < arr.length; i++) {
+      dvbuf.setUint8(offset++, arr[i]);
+    }
+  }
   dvbuf.setUint32(8, amount.fraction);
   u8buf.set(curr, 8 + 4);
 
@@ -113,15 +122,24 @@ function timestampRoundedToBuffer(ts: Timestamp): 
Uint8Array {
   const b = new ArrayBuffer(8);
   const v = new DataView(b);
   const tsRounded = timestampTruncateToSecond(ts);
-  const s = BigInt(tsRounded.t_ms) * BigInt(1000);
-  v.setBigUint64(0, s);
+  if (typeof v.setBigUint64 !== "undefined") {
+    const s = BigInt(tsRounded.t_ms) * BigInt(1000);
+    v.setBigUint64(0, s);
+  } else {
+    const s = (tsRounded.t_ms === "never" ? bigint.zero : 
bigint(tsRounded.t_ms).times(1000));
+    const arr = s.toArray(2 ** 8).value
+    let offset = 8 - arr.length
+    for (let i = 0; i < arr.length; i++) {
+      v.setUint8(offset++, arr[i]);
+    }
+  }
   return new Uint8Array(b);
 }
 
 class SignaturePurposeBuilder {
   private chunks: Uint8Array[] = [];
 
-  constructor(private purposeNum: number) {}
+  constructor(private purposeNum: number) { }
 
   put(bytes: Uint8Array): SignaturePurposeBuilder {
     this.chunks.push(Uint8Array.from(bytes));
diff --git a/packages/taler-wallet-webextension/manifest.json 
b/packages/taler-wallet-webextension/manifest.json
index 3ab5625a..e864fe08 100644
--- a/packages/taler-wallet-webextension/manifest.json
+++ b/packages/taler-wallet-webextension/manifest.json
@@ -13,7 +13,7 @@
   "applications": {
     "gecko": {
       "id": "wallet@taler.net",
-      "strict_min_version": "68.0"
+      "strict_min_version": "57.0"
     }
   },
 

-- 
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]