taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 2ae3ebfeb642257437d49e015a6541876ff8e542
parent 49d7f178ffedac94d5e1493c6df7f9a1ce6707d3
Author: Florian Dold <florian@dold.me>
Date:   Wed,  5 Mar 2025 16:51:33 +0100

wallet-core: get rid of unused testing flag (allowDenomselLate)

Diffstat:
Mpackages/aml-backoffice-ui/package.json | 2+-
Mpackages/anastasis-cli/package.json | 2+-
Mpackages/anastasis-core/package.json | 2+-
Mpackages/anastasis-webui/package.json | 2+-
Mpackages/auditor-backoffice-ui/package.json | 2+-
Mpackages/bank-ui/package.json | 2+-
Mpackages/challenger-ui/package.json | 2+-
Mpackages/idb-bridge/package.json | 2+-
Mpackages/kyc-ui/package.json | 2+-
Mpackages/merchant-backend-ui/package.json | 2+-
Mpackages/merchant-backoffice-ui/package.json | 2+-
Mpackages/pogen/package.json | 2+-
Mpackages/taler-harness/debian/changelog | 6++++++
Mpackages/taler-harness/package.json | 2+-
Mpackages/taler-harness/src/bench2.ts | 14+++-----------
Mpackages/taler-harness/src/integrationtests/test-wallet-dbless.ts | 13+++----------
Mpackages/taler-harness/src/integrationtests/test-withdrawal-idempotent.ts | 5+----
Mpackages/taler-util/package.json | 2+-
Mpackages/taler-util/src/types-taler-wallet.ts | 4----
Mpackages/taler-wallet-cli/debian/changelog | 6++++++
Mpackages/taler-wallet-cli/package.json | 2+-
Mpackages/taler-wallet-cli/src/index.ts | 3---
Mpackages/taler-wallet-core/package.json | 2+-
Mpackages/taler-wallet-core/src/dbless.ts | 10++--------
Mpackages/taler-wallet-core/src/denomSelection.ts | 6++----
Mpackages/taler-wallet-core/src/denominations.ts | 41+++++++++++------------------------------
Mpackages/taler-wallet-core/src/exchanges.ts | 13++-----------
Mpackages/taler-wallet-core/src/refresh.ts | 7+------
Mpackages/taler-wallet-core/src/wallet.ts | 1-
Mpackages/taler-wallet-core/src/withdraw.ts | 24++++--------------------
Mpackages/taler-wallet-embedded/package.json | 2+-
Mpackages/taler-wallet-webextension/manifest-common.json | 4++--
Mpackages/taler-wallet-webextension/package.json | 2+-
Mpackages/web-util/package.json | 2+-
34 files changed, 62 insertions(+), 133 deletions(-)

diff --git a/packages/aml-backoffice-ui/package.json b/packages/aml-backoffice-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/aml-backoffice-ui", - "version": "0.14.9", + "version": "0.14.10", "author": "sebasjm", "license": "AGPL-3.0-OR-LATER", "description": "Back-office SPA for GNU Taler Exchange.", diff --git a/packages/anastasis-cli/package.json b/packages/anastasis-cli/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/anastasis-cli", - "version": "0.14.9", + "version": "0.14.10", "description": "", "engines": { "node": ">=0.18.0" diff --git a/packages/anastasis-core/package.json b/packages/anastasis-core/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/anastasis-core", - "version": "0.14.9", + "version": "0.14.10", "description": "", "main": "./lib/index.js", "module": "./lib/index.js", diff --git a/packages/anastasis-webui/package.json b/packages/anastasis-webui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/anastasis-webui", - "version": "0.14.9", + "version": "0.14.10", "license": "MIT", "type": "module", "scripts": { diff --git a/packages/auditor-backoffice-ui/package.json b/packages/auditor-backoffice-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/auditor-backoffice-ui", - "version": "0.14.9", + "version": "0.14.10", "license": "AGPL-3.0-or-later", "type": "module", "scripts": { diff --git a/packages/bank-ui/package.json b/packages/bank-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/bank-ui", - "version": "0.14.9", + "version": "0.14.10", "license": "AGPL-3.0-OR-LATER", "type": "module", "scripts": { diff --git a/packages/challenger-ui/package.json b/packages/challenger-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/challenger-ui", - "version": "0.14.9", + "version": "0.14.10", "author": "sebasjm", "license": "AGPL-3.0-OR-LATER", "description": "UI for GNU Challenger.", diff --git a/packages/idb-bridge/package.json b/packages/idb-bridge/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/idb-bridge", - "version": "0.14.9", + "version": "0.14.10", "description": "IndexedDB implementation that uses SQLite3 as storage", "main": "./dist/idb-bridge.js", "module": "./lib/index.js", diff --git a/packages/kyc-ui/package.json b/packages/kyc-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/kyc-ui", - "version": "0.14.9", + "version": "0.14.10", "author": "sebasjm", "license": "AGPL-3.0-OR-LATER", "description": "UI for GNU Exchange KYC.", diff --git a/packages/merchant-backend-ui/package.json b/packages/merchant-backend-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/merchant-backend-ui", - "version": "0.14.9", + "version": "0.14.10", "license": "AGPL-3.0-or-later", "scripts": { "compile": "tsc && ./build.mjs", diff --git a/packages/merchant-backoffice-ui/package.json b/packages/merchant-backoffice-ui/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@gnu-taler/merchant-backoffice-ui", - "version": "0.14.9", + "version": "0.14.10", "license": "AGPL-3.0-or-later", "type": "module", "scripts": { diff --git a/packages/pogen/package.json b/packages/pogen/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/pogen", - "version": "0.14.9", + "version": "0.14.10", "bin": { "pogen": "bin/pogen" }, diff --git a/packages/taler-harness/debian/changelog b/packages/taler-harness/debian/changelog @@ -1,3 +1,9 @@ +taler-harness (0.14.10) unstable; urgency=low + + * Release 0.14.10 + + -- Florian Dold <dold@taler.net> Wed, 05 Mar 2025 00:46:50 +0100 + taler-harness (0.14.9) unstable; urgency=low * Release 0.14.9 diff --git a/packages/taler-harness/package.json b/packages/taler-harness/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-harness", - "version": "0.14.9", + "version": "0.14.10", "description": "", "engines": { "node": ">=0.12.0" diff --git a/packages/taler-harness/src/bench2.ts b/packages/taler-harness/src/bench2.ts @@ -66,8 +66,6 @@ export async function runBench2(configJson: any): Promise<void> { const reserveAmount = (numDeposits + 1) * 10; - const denomselAllowLate = false; - const merchantPair = await cryptoApi.createEddsaKeypair({}); const merchantPub = merchantPair.pub; const merchantPriv = merchantPair.priv; @@ -93,9 +91,7 @@ export async function runBench2(configJson: any): Promise<void> { console.log("reserve found"); - const d1 = findDenomOrThrow(exchangeInfo, `${curr}:8` as AmountString, { - denomselAllowLate, - }); + const d1 = findDenomOrThrow(exchangeInfo, `${curr}:8` as AmountString); for (let j = 0; j < numDeposits; j++) { console.log("withdrawing coin"); @@ -123,12 +119,8 @@ export async function runBench2(configJson: any): Promise<void> { }); const refreshDenoms = [ - findDenomOrThrow(exchangeInfo, `${curr}:1` as AmountString, { - denomselAllowLate, - }), - findDenomOrThrow(exchangeInfo, `${curr}:1` as AmountString, { - denomselAllowLate, - }), + findDenomOrThrow(exchangeInfo, `${curr}:1` as AmountString), + findDenomOrThrow(exchangeInfo, `${curr}:1` as AmountString), ]; console.log("refreshing coin"); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts b/packages/taler-harness/src/integrationtests/test-wallet-dbless.ts @@ -89,11 +89,8 @@ export async function runWalletDblessTest(t: GlobalTestState) { console.log(exchangeInfo); await checkReserve(http, exchange.baseUrl, reserveKeyPair.pub); - const denomselAllowLate = false; - const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8" as AmountString, { - denomselAllowLate, - }); + const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8" as AmountString); const coin = await withdrawCoin({ http, @@ -133,12 +130,8 @@ export async function runWalletDblessTest(t: GlobalTestState) { }); const refreshDenoms = [ - findDenomOrThrow(exchangeInfo, "TESTKUDOS:1" as AmountString, { - denomselAllowLate, - }), - findDenomOrThrow(exchangeInfo, "TESTKUDOS:1" as AmountString, { - denomselAllowLate, - }), + findDenomOrThrow(exchangeInfo, "TESTKUDOS:1" as AmountString), + findDenomOrThrow(exchangeInfo, "TESTKUDOS:1" as AmountString), ]; await refreshCoin({ diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-idempotent.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-idempotent.ts @@ -86,11 +86,8 @@ export async function runWithdrawalIdempotentTest(t: GlobalTestState) { console.log(exchangeInfo); await checkReserve(http, exchange.baseUrl, reserveKeyPair.pub); - const denomselAllowLate = false; - const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8" as AmountString, { - denomselAllowLate, - }); + const d1 = findDenomOrThrow(exchangeInfo, "TESTKUDOS:8" as AmountString); await myWithdrawCoin({ http, diff --git a/packages/taler-util/package.json b/packages/taler-util/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-util", - "version": "0.14.9", + "version": "0.14.10", "description": "Generic helper functionality for GNU Taler", "type": "module", "types": "./lib/index.node.d.ts", diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts @@ -426,10 +426,6 @@ export interface WalletRunConfig { * testing environment. */ testing: { - /** - * Allow withdrawal of denominations even though they are about to expire. - */ - denomselAllowLate: boolean; devModeActive: boolean; insecureTrustExchange: boolean; preventThrottling: boolean; diff --git a/packages/taler-wallet-cli/debian/changelog b/packages/taler-wallet-cli/debian/changelog @@ -1,3 +1,9 @@ +taler-wallet-cli (0.14.10) unstable; urgency=low + + * Release 0.14.10 + + -- Florian Dold <dold@taler.net> Wed, 05 Mar 2025 00:46:50 +0100 + taler-wallet-cli (0.14.9) unstable; urgency=low * Release 0.14.9 diff --git a/packages/taler-wallet-cli/package.json b/packages/taler-wallet-cli/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-wallet-cli", - "version": "0.14.9", + "version": "0.14.10", "description": "", "engines": { "node": ">=0.18.0" diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts @@ -288,9 +288,6 @@ async function createLocalWallet( lazyTaskLoop: args.lazyTaskLoop, testing: { devModeActive: checkEnvFlag("TALER_WALLET_DEV_MODE"), - denomselAllowLate: checkEnvFlag( - "TALER_WALLET_DEBUG_DENOMSEL_ALLOW_LATE", - ), emitObservabilityEvents: observabilityEventFile != null, skipDefaults: walletCliArgs.wallet.skipDefaults, }, diff --git a/packages/taler-wallet-core/package.json b/packages/taler-wallet-core/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-wallet-core", - "version": "0.14.9", + "version": "0.14.10", "description": "", "engines": { "node": ">=0.18.0" diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts @@ -188,22 +188,16 @@ export async function withdrawCoin(args: { }; } -export interface FindDenomOptions { - denomselAllowLate?: boolean; -} +export interface FindDenomOptions {} export function findDenomOrThrow( exchangeInfo: ExchangeInfo, amount: AmountString, options: FindDenomOptions = {}, ): DenominationRecord { - const denomselAllowLate = options.denomselAllowLate ?? false; for (const d of exchangeInfo.keys.currentDenominations) { const value: AmountJson = Amounts.parseOrThrow(d.value); - if ( - Amounts.cmp(value, amount) === 0 && - isCandidateWithdrawableDenom(d, denomselAllowLate) - ) { + if (Amounts.cmp(value, amount) === 0 && isCandidateWithdrawableDenom(d)) { return d; } } diff --git a/packages/taler-wallet-core/src/denomSelection.ts b/packages/taler-wallet-core/src/denomSelection.ts @@ -44,7 +44,6 @@ const logger = new Logger("denomSelection.ts"); export function selectWithdrawalDenominations( amountAvailable: AmountJson, denoms: DenominationRecord[], - denomselAllowLate: boolean = false, ): DenomSelectionState { let remaining = Amounts.copy(amountAvailable); @@ -58,7 +57,7 @@ export function selectWithdrawalDenominations( let earliestDepositExpiration: AbsoluteTime | undefined; let hasDenomWithAgeRestriction = false; - denoms = denoms.filter((d) => isWithdrawableDenom(d, denomselAllowLate)); + denoms = denoms.filter((d) => isWithdrawableDenom(d)); denoms.sort((d1, d2) => Amounts.cmp(d2.value, d1.value)); if (logger.shouldLogTrace()) { @@ -131,7 +130,6 @@ export function selectForcedWithdrawalDenominations( amountAvailable: AmountJson, denoms: DenominationRecord[], forcedDenomSel: ForcedDenomSel, - denomselAllowLate: boolean, ): DenomSelectionState { const selectedDenoms: { count: number; @@ -143,7 +141,7 @@ export function selectForcedWithdrawalDenominations( let earliestDepositExpiration: AbsoluteTime | undefined; let hasDenomWithAgeRestriction = false; - denoms = denoms.filter((d) => isWithdrawableDenom(d, denomselAllowLate)); + denoms = denoms.filter((d) => isWithdrawableDenom(d)); denoms.sort((d1, d2) => Amounts.cmp(d2.value, d1.value)); for (const fds of forcedDenomSel.denoms) { diff --git a/packages/taler-wallet-core/src/denominations.ts b/packages/taler-wallet-core/src/denominations.ts @@ -466,10 +466,7 @@ export function createTimeline<Type extends object>( * Denominations with an unverified signature * are not considered withdrawable. */ -export function isWithdrawableDenom( - d: DenominationRecord, - denomselAllowLate?: boolean, -): boolean { +export function isWithdrawableDenom(d: DenominationRecord): boolean { if (d.isLost) { logger.trace( `Skipping lost denomination ${d.denomPubHash} of ${d.exchangeBaseUrl}`, @@ -488,17 +485,10 @@ export function isWithdrawableDenom( const withdrawExpire = AbsoluteTime.fromProtocolTimestamp( timestampProtocolFromDb(d.stampExpireWithdraw), ); - let lastPossibleWithdraw: AbsoluteTime; - if (denomselAllowLate) { - // Required by some tests. - // FIXME: Check which ones! - lastPossibleWithdraw = withdrawExpire; - } else { - lastPossibleWithdraw = AbsoluteTime.subtractDuraction( - withdrawExpire, - Duration.fromSpec({ minutes: 5 }), - ); - } + const lastPossibleWithdraw = AbsoluteTime.subtractDuraction( + withdrawExpire, + Duration.fromSpec({ minutes: 5 }), + ); const remaining = Duration.getRemaining(lastPossibleWithdraw, now); const withdrawalStillOkay = remaining.d_ms !== 0; if (!withdrawalStillOkay) { @@ -527,10 +517,7 @@ export function isWithdrawableDenom( * Denominations with an unverified signature * are considered candidates. */ -export function isCandidateWithdrawableDenom( - d: DenominationRecord, - denomselAllowLate?: boolean, -): boolean { +export function isCandidateWithdrawableDenom(d: DenominationRecord): boolean { const now = AbsoluteTime.now(); const start = AbsoluteTime.fromProtocolTimestamp( timestampProtocolFromDb(d.stampStart), @@ -548,17 +535,11 @@ export function isCandidateWithdrawableDenom( const withdrawExpire = AbsoluteTime.fromProtocolTimestamp( timestampProtocolFromDb(d.stampExpireWithdraw), ); - let lastPossibleWithdraw: AbsoluteTime; - if (denomselAllowLate) { - // Required by some tests. - // FIXME: Check which ones! - lastPossibleWithdraw = withdrawExpire; - } else { - lastPossibleWithdraw = AbsoluteTime.subtractDuraction( - withdrawExpire, - Duration.fromSpec({ minutes: 5 }), - ); - } + + const lastPossibleWithdraw = AbsoluteTime.subtractDuraction( + withdrawExpire, + Duration.fromSpec({ minutes: 5 }), + ); const remaining = Duration.getRemaining(lastPossibleWithdraw, now); const stillOkay = remaining.d_ms !== 0; return started && stillOkay && !d.isRevoked && d.isOffered && !d.isLost; diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts @@ -1165,10 +1165,7 @@ async function checkExchangeEntryOutdated( await tx.denominations.indexes.byExchangeBaseUrl.getAll(exchangeBaseUrl); logger.trace(`exchange entry has ${denoms.length} denominations`); for (const denom of denoms) { - const denomOkay = isCandidateWithdrawableDenom( - denom, - wex.ws.config.testing.denomselAllowLate, - ); + const denomOkay = isCandidateWithdrawableDenom(denom); if (denomOkay) { numOkay++; } @@ -1711,13 +1708,7 @@ export async function updateExchangeFromUrlHandler( let ageMask = 0; for (const x of keysInfo.currentDenominations) { - if ( - isCandidateWithdrawableDenom( - x, - wex.ws.config.testing.denomselAllowLate, - ) && - x.denomPub.age_mask != 0 - ) { + if (isCandidateWithdrawableDenom(x) && x.denomPub.age_mask != 0) { ageMask = x.denomPub.age_mask; break; } diff --git a/packages/taler-wallet-core/src/refresh.ts b/packages/taler-wallet-core/src/refresh.ts @@ -456,11 +456,7 @@ export function getTotalRefreshCostInternal( refreshedDenom.feeRefresh, ).amount; const denomMap = Object.fromEntries(denoms.map((x) => [x.denomPubHash, x])); - const withdrawDenoms = selectWithdrawalDenominations( - withdrawAmount, - denoms, - false, - ); + const withdrawDenoms = selectWithdrawalDenominations(withdrawAmount, denoms); const resultingAmount = Amounts.add( Amounts.zeroOfCurrency(withdrawAmount.currency), ...withdrawDenoms.selectedDenoms.map( @@ -556,7 +552,6 @@ async function initRefreshSession( const newCoinDenoms = selectWithdrawalDenominations( availableAmount, availableDenoms, - wex.ws.config.testing.denomselAllowLate, ); if (newCoinDenoms.selectedDenoms.length === 0) { diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts @@ -2434,7 +2434,6 @@ function applyRunConfigDefaults(wcp?: PartialWalletRunConfig): WalletRunConfig { allowHttp: wcp?.features?.allowHttp ?? false, }, testing: { - denomselAllowLate: wcp?.testing?.denomselAllowLate ?? false, devModeActive: wcp?.testing?.devModeActive ?? false, insecureTrustExchange: wcp?.testing?.insecureTrustExchange ?? false, preventThrottling: wcp?.testing?.preventThrottling ?? false, diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts @@ -1312,9 +1312,7 @@ export async function getWithdrawableDenomsTx( await tx.denominations.indexes.byExchangeBaseUrl.getAll(exchangeBaseUrl); return allDenoms .filter((d) => d.currency === currency) - .filter((d) => - isWithdrawableDenom(d, wex.ws.config.testing.denomselAllowLate), - ); + .filter((d) => isWithdrawableDenom(d)); } /** @@ -1880,12 +1878,7 @@ export async function updateWithdrawalDenomsForExchange( ); denominations = allDenoms .filter((d) => d.currency === exchangeDetails.currency) - .filter((d) => - isCandidateWithdrawableDenom( - d, - wex.ws.config.testing.denomselAllowLate, - ), - ); + .filter((d) => isCandidateWithdrawableDenom(d)); } return { exchangeDetails, denominations }; }, @@ -2292,10 +2285,7 @@ async function redenominateWithdrawal( throw Error("denom in use but not not found"); } // FIXME: Also check planchet if there was a different error or planchet already withdrawn - const denomOkay = isWithdrawableDenom( - denom, - wex.ws.config.testing.denomselAllowLate, - ); + const denomOkay = isWithdrawableDenom(denom); const numCoins = sel.count - (sel.skip ?? 0); const denomValue = Amount.from(denom.value).mult(numCoins); const denomFeeWithdraw = Amount.from(denom.fees.feeWithdraw).mult( @@ -2714,7 +2704,6 @@ export async function getExchangeWithdrawalInfo( const selectedDenoms = selectWithdrawalDenominations( instructedAmount, candidateDenoms, - wex.ws.config.testing.denomselAllowLate, ); logger.trace("selection done"); @@ -3303,15 +3292,10 @@ async function getInitialDenomsSelection( amount, denoms, forcedDenoms, - wex.ws.config.testing.denomselAllowLate, ); return initialDenomSel; } else { - const initialDenomSel = selectWithdrawalDenominations( - amount, - denoms, - wex.ws.config.testing.denomselAllowLate, - ); + const initialDenomSel = selectWithdrawalDenominations(amount, denoms); return initialDenomSel; } } diff --git a/packages/taler-wallet-embedded/package.json b/packages/taler-wallet-embedded/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-wallet-embedded", - "version": "0.14.9", + "version": "0.14.10", "description": "", "engines": { "node": ">=0.18.0" diff --git a/packages/taler-wallet-webextension/manifest-common.json b/packages/taler-wallet-webextension/manifest-common.json @@ -2,7 +2,7 @@ "name": "GNU Taler Wallet (git)", "description": "Privacy preserving and transparent payments", "author": "GNU Taler Developers", - "version": "0.14.9", + "version": "0.14.10", "icons": { "16": "static/img/taler-logo-16.png", "19": "static/img/taler-logo-19.png", @@ -14,5 +14,5 @@ "256": "static/img/taler-logo-256.png", "512": "static/img/taler-logo-512.png" }, - "version_name": "0.14.9" + "version_name": "0.14.10" } diff --git a/packages/taler-wallet-webextension/package.json b/packages/taler-wallet-webextension/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/taler-wallet-webextension", - "version": "0.14.9", + "version": "0.14.10", "description": "GNU Taler Wallet browser extension", "main": "./build/index.js", "types": "./build/index.d.ts", diff --git a/packages/web-util/package.json b/packages/web-util/package.json @@ -1,6 +1,6 @@ { "name": "@gnu-taler/web-util", - "version": "0.14.9", + "version": "0.14.10", "description": "Generic helper functionality for GNU Taler Web Apps", "type": "module", "types": "./lib/index.node.d.ts",