commit ab42503d8c53af369e2abb1170c68d7f7013dfa2
parent 52db7e6e2d6140270bec5ac971de3ff067c747a9
Author: Florian Dold <dold@taler.net>
Date: Thu, 3 Sep 2026 15:47:38 +0200
wallet-core: purge signing keys together with legacy key sets
Diffstat:
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/packages/taler-wallet-core/src/exchanges.test.ts b/packages/taler-wallet-core/src/exchanges.test.ts
@@ -270,6 +270,7 @@ test("purging legacy keys removes key-scoped data and marks source withdrawals",
details: [] as number[],
globals: [] as number[],
currencyScopes: [] as string[],
+ signKeys: [] as string[],
};
const notifications: unknown[] = [];
const fakeTx = {
@@ -378,6 +379,11 @@ test("purging legacy keys removes key-scoped data and marks source withdrawals",
deleteExchangeDetails: async (rowId: number) => {
deleted.details.push(rowId);
},
+ getExchangeSignKeysByDetailsRowId: async (rowId: number) =>
+ rowId === 2 ? [{ signkeyPub: "legacy-signkey" }] : [],
+ deleteExchangeSignKey: async (_rowId: number, signkeyPub: string) => {
+ deleted.signKeys.push(signkeyPub);
+ },
deleteGlobalCurrencyExchange: async (id: number) => {
deleted.globals.push(id);
},
@@ -408,6 +414,7 @@ test("purging legacy keys removes key-scoped data and marks source withdrawals",
assert.deepStrictEqual(deleted.denominations, ["legacy-denom"]);
assert.deepStrictEqual(deleted.families, [10]);
assert.deepStrictEqual(deleted.details, [2]);
+ assert.deepStrictEqual(deleted.signKeys, ["legacy-signkey"]);
assert.deepStrictEqual(deleted.globals, [20]);
assert.deepStrictEqual(deleted.currencyScopes, [legacyMasterPub]);
assert.equal(notifications.length, 1);
diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts
@@ -4794,6 +4794,12 @@ export async function purgeExchangeLegacyKeysInTx(
}
checkDbInvariant(detail.rowId != null, "exchange details row ID");
await tx.deleteExchangeDetails(detail.rowId);
+ const signkeyRecs = await tx.getExchangeSignKeysByDetailsRowId(
+ detail.rowId,
+ );
+ for (const rec of signkeyRecs) {
+ await tx.deleteExchangeSignKey(detail.rowId, rec.signkeyPub);
+ }
}
for (const global of globalsAtUrl) {
if (!legacyMasterPubs.has(global.exchangeMasterPub)) {