commit 847b9f8f63162d98f57f90a0c92d42b10b0f40af
parent 828d290d7b04971c0db9a129069921ece0865025
Author: Florian Dold <dold@taler.net>
Date: Sun, 13 Sep 2026 23:22:04 +0200
wallet-core: use KYC subjects for authentication transfers
Mark direct authentication transfers with the Taler KYC subject prefix.
The reserve transfer prefix leaves the bank account unauthenticated.
Diffstat:
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/packages/taler-wallet-core/src/common.test.ts b/packages/taler-wallet-core/src/common.test.ts
@@ -19,10 +19,43 @@ import { test } from "node:test";
import {
augmentTransferOptions,
getRetryDuration,
+ prepareTransferOptionsRaw,
spendTokens,
} from "./common.js";
import { KycAuthTransferOptionRaw, WalletToken } from "./db/records.js";
import { WalletDbTransaction } from "./db/transaction.js";
+import { WalletExecutionContext } from "./wallet.js";
+
+test("direct transfer instructions distinguish KYC authentication from withdrawal", async () => {
+ for (const [isKyc, subject] of [
+ [true, "Taler KYC account-public-key"],
+ [false, "Taler account-public-key"],
+ ] as const) {
+ const result = await prepareTransferOptionsRaw(
+ {} as WalletExecutionContext,
+ {
+ acct: {
+ payto_uri: "payto://x-taler-bank/bank.example/exchange",
+ master_sig: "unused",
+ credit_restrictions: [],
+ debit_restrictions: [],
+ },
+ reservePub: "account-public-key",
+ reservePriv: "unused",
+ transferAmount: "TESTKUDOS:0.01",
+ isKyc,
+ },
+ );
+ assert.strictEqual(result.transferOptions.length, 1);
+ const option = result.transferOptions[0];
+ assert.strictEqual(option.type, "payto");
+ if (option.type !== "payto")
+ throw Error("expected bank transfer instructions");
+ const payto = new URL(option.paytoUri);
+ assert.strictEqual(payto.searchParams.get("message"), subject);
+ assert.strictEqual(payto.searchParams.get("amount"), "TESTKUDOS:0.01");
+ }
+});
test("the retry delay grows but stays bounded", (t) => {
const first = Duration.toMilliseconds(getRetryDuration(0));
diff --git a/packages/taler-wallet-core/src/common.ts b/packages/taler-wallet-core/src/common.ts
@@ -1,7 +1,7 @@
/*
This file is part of GNU Taler
(C) 2022 GNUnet e.V.
- (C) 2025 Taler Systems S.A.
+ (C) 2025-2026 Taler Systems S.A.
GNU Taler is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -1195,7 +1195,7 @@ export async function prepareTransferOptionsRaw(
});
if (reservePub != null) {
paytoUri = addPaytoQueryParams(paytoUri, {
- message: `Taler ${reservePub}`,
+ message: req.isKyc ? `Taler KYC ${reservePub}` : `Taler ${reservePub}`,
});
}
return {