fix #6042
This commit is contained in:
parent
0d86f84dc0
commit
d42a74565e
@ -76,6 +76,7 @@ import {
|
|||||||
DeriveTipRequest,
|
DeriveTipRequest,
|
||||||
SignTrackTransactionRequest,
|
SignTrackTransactionRequest,
|
||||||
} from "../cryptoTypes.js";
|
} from "../cryptoTypes.js";
|
||||||
|
import bigint from "big-integer";
|
||||||
|
|
||||||
const logger = new Logger("cryptoImplementation.ts");
|
const logger = new Logger("cryptoImplementation.ts");
|
||||||
|
|
||||||
@ -102,7 +103,15 @@ function amountToBuffer(amount: AmountJson): Uint8Array {
|
|||||||
const dvbuf = new DataView(buffer);
|
const dvbuf = new DataView(buffer);
|
||||||
const u8buf = new Uint8Array(buffer);
|
const u8buf = new Uint8Array(buffer);
|
||||||
const curr = stringToBytes(amount.currency);
|
const curr = stringToBytes(amount.currency);
|
||||||
|
if (typeof dvbuf.setBigUint64 !== "undefined") {
|
||||||
dvbuf.setBigUint64(0, BigInt(amount.value));
|
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);
|
dvbuf.setUint32(8, amount.fraction);
|
||||||
u8buf.set(curr, 8 + 4);
|
u8buf.set(curr, 8 + 4);
|
||||||
|
|
||||||
@ -113,8 +122,17 @@ function timestampRoundedToBuffer(ts: Timestamp): Uint8Array {
|
|||||||
const b = new ArrayBuffer(8);
|
const b = new ArrayBuffer(8);
|
||||||
const v = new DataView(b);
|
const v = new DataView(b);
|
||||||
const tsRounded = timestampTruncateToSecond(ts);
|
const tsRounded = timestampTruncateToSecond(ts);
|
||||||
|
if (typeof v.setBigUint64 !== "undefined") {
|
||||||
const s = BigInt(tsRounded.t_ms) * BigInt(1000);
|
const s = BigInt(tsRounded.t_ms) * BigInt(1000);
|
||||||
v.setBigUint64(0, s);
|
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);
|
return new Uint8Array(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"applications": {
|
"applications": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "wallet@taler.net",
|
"id": "wallet@taler.net",
|
||||||
"strict_min_version": "68.0"
|
"strict_min_version": "57.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user