diff options
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 5 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/common.ts | 5 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/exchanges.ts | 10 |
3 files changed, 20 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index ce0070e69..b68da8333 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -473,6 +473,11 @@ export interface ExchangeDetailsRecord { | undefined; wireInfo: WireInfo; + + /** + * Age restrictions supported by the exchange (bitmask). + */ + ageMask?: number; } export interface ExchangeTosRecord { diff --git a/packages/taler-wallet-core/src/operations/common.ts b/packages/taler-wallet-core/src/operations/common.ts index 59d2b8ec3..3ac003da3 100644 --- a/packages/taler-wallet-core/src/operations/common.ts +++ b/packages/taler-wallet-core/src/operations/common.ts @@ -18,6 +18,7 @@ * Imports. */ import { + AgeRestriction, AmountJson, Amounts, CoinRefreshRequest, @@ -365,6 +366,7 @@ export function makeExchangeListItem( paytoUris: [], exchangeStatus: ExchangeEntryStatus.Unknown, permanent: r.permanent, + supportedAgeGroups: [], }; } let exchangeStatus; @@ -376,5 +378,8 @@ export function makeExchangeListItem( paytoUris: exchangeDetails.wireInfo.accounts.map((x) => x.payto_uri), exchangeStatus, permanent: r.permanent, + supportedAgeGroups: exchangeDetails.ageMask + ? AgeRestriction.getAgeGroupsFromMask(exchangeDetails.ageMask) + : [], }; } diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts index a8c4fec10..63e71c36c 100644 --- a/packages/taler-wallet-core/src/operations/exchanges.ts +++ b/packages/taler-wallet-core/src/operations/exchanges.ts @@ -76,6 +76,7 @@ import { runOperationHandlerForResult, } from "../util/retries.js"; import { WALLET_EXCHANGE_PROTOCOL_VERSION } from "../versions.js"; +import { isWithdrawableDenom } from "./withdraw.js"; const logger = new Logger("exchanges.ts"); @@ -657,6 +658,14 @@ export async function updateExchangeFromUrlHandler( let detailsPointerChanged = false; + let ageMask = 0; + for (const x of keysInfo.currentDenominations) { + if (isWithdrawableDenom(x) && x.denomPub.age_mask != 0) { + ageMask = x.denomPub.age_mask; + break; + } + } + const updated = await ws.db .mktx((x) => [ x.exchanges, @@ -699,6 +708,7 @@ export async function updateExchangeFromUrlHandler( wireInfo, tosCurrentEtag: tosDownload.tosEtag, tosAccepted: existingTosAccepted, + ageMask, }; if (existingDetails?.rowId) { newDetails.rowId = existingDetails.rowId; |