aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r--packages/taler-wallet-core/src/bank-api-client.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/testing.ts5
-rw-r--r--packages/taler-wallet-core/src/util/http.ts2
-rw-r--r--packages/taler-wallet-core/src/util/timer.ts4
4 files changed, 10 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/bank-api-client.ts b/packages/taler-wallet-core/src/bank-api-client.ts
index bfb06bb0f..dc7845150 100644
--- a/packages/taler-wallet-core/src/bank-api-client.ts
+++ b/packages/taler-wallet-core/src/bank-api-client.ts
@@ -23,6 +23,7 @@
*/
import {
AmountString,
+ base64FromArrayBuffer,
buildCodecForObject,
Codec,
codecForAny,
@@ -31,6 +32,7 @@ import {
getRandomBytes,
j2s,
Logger,
+ stringToBytes,
TalerErrorCode,
} from "@gnu-taler/taler-util";
import { TalerError } from "./errors.js";
@@ -85,7 +87,7 @@ export interface HarnessExchangeBankAccount {
*/
function makeBasicAuthHeader(username: string, password: string): string {
const auth = `${username}:${password}`;
- const authEncoded: string = Buffer.from(auth).toString("base64");
+ const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));
return `Basic ${authEncoded}`;
}
diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts
index 9a11af8bb..50454a920 100644
--- a/packages/taler-wallet-core/src/operations/testing.ts
+++ b/packages/taler-wallet-core/src/operations/testing.ts
@@ -18,8 +18,10 @@
* Imports.
*/
import {
+ base64FromArrayBuffer,
ConfirmPayResultType,
Logger,
+ stringToBytes,
TestPayResult,
WithdrawTestBalanceRequest,
} from "@gnu-taler/taler-util";
@@ -78,10 +80,11 @@ function makeId(length: number): string {
/**
* Helper function to generate the "Authorization" HTTP header.
+ * FIXME: redundant, put in taler-util
*/
function makeBasicAuthHeader(username: string, password: string): string {
const auth = `${username}:${password}`;
- const authEncoded: string = Buffer.from(auth).toString("base64");
+ const authEncoded: string = base64FromArrayBuffer(stringToBytes(auth));
return `Basic ${authEncoded}`;
}
diff --git a/packages/taler-wallet-core/src/util/http.ts b/packages/taler-wallet-core/src/util/http.ts
index 0489f920b..118da40fe 100644
--- a/packages/taler-wallet-core/src/util/http.ts
+++ b/packages/taler-wallet-core/src/util/http.ts
@@ -68,7 +68,7 @@ export interface HttpRequestOptions {
*/
cancellationToken?: CancellationToken;
- body?: string | ArrayBuffer | ArrayBufferView;
+ body?: string | ArrayBuffer | Object;
}
/**
diff --git a/packages/taler-wallet-core/src/util/timer.ts b/packages/taler-wallet-core/src/util/timer.ts
index 8ec1a25f8..d198e03c9 100644
--- a/packages/taler-wallet-core/src/util/timer.ts
+++ b/packages/taler-wallet-core/src/util/timer.ts
@@ -53,7 +53,7 @@ class IntervalHandle {
* only event left. Has no effect in the browser.
*/
unref(): void {
- if (typeof this.h === "object") {
+ if (typeof this.h === "object" && "unref" in this.h) {
this.h.unref();
}
}
@@ -71,7 +71,7 @@ class TimeoutHandle {
* only event left. Has no effect in the browser.
*/
unref(): void {
- if (typeof this.h === "object") {
+ if (typeof this.h === "object" && "unref" in this.h) {
this.h.unref();
}
}