commit fc3592a0bd0af758261b3bf552b943268eaaad78
parent 31e32a271d9a2c7d1b0998dc01f5a74d2da7911a
Author: Florian Dold <dold@taler.net>
Date: Mon, 20 Jul 2026 13:58:58 +0200
util: fix handling of "forever" in signature blobs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/packages/taler-util/src/taler-crypto.ts b/packages/taler-util/src/taler-crypto.ts
@@ -1713,10 +1713,10 @@ export function durationRoundedToBuffer(ts: TalerProtocolDuration): Uint8Array {
const v = new DataView(b);
// The buffer we sign over represents the timestamp in microseconds.
if (typeof v.setBigUint64 !== "undefined") {
- const s = BigInt(ts.d_us);
+ const s = ts.d_us === "forever" ? foreverNum : BigInt(ts.d_us);
v.setBigUint64(0, s);
} else {
- const s = ts.d_us === "forever" ? bigint.zero : bigint(ts.d_us);
+ const s = ts.d_us === "forever" ? bigint(foreverNum) : bigint(ts.d_us);
const arr = s.toArray(2 ** 8).value;
let offset = 8 - arr.length;
for (let i = 0; i < arr.length; i++) {