aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-01 22:26:22 +0200
committerFlorian Dold <florian@dold.me>2022-09-01 22:26:22 +0200
commitec43b6a5bf4f8064aaad7fc303a10c7f585a110e (patch)
tree1dbeabf78bc911a651c42a202b0c39e1c6906ccf /packages/taler-wallet-core
parentd6a172c4a00b615dce31630bf65e6d62b30f608e (diff)
wallet-core: fix issue with crock encoding of age restrictions
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r--packages/taler-wallet-core/src/crypto/cryptoImplementation.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts10
-rw-r--r--packages/taler-wallet-core/src/util/coinSelection.ts13
3 files changed, 16 insertions, 13 deletions
diff --git a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts
index 2f39f7806..f0a5cba2b 100644
--- a/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts
+++ b/packages/taler-wallet-core/src/crypto/cryptoImplementation.ts
@@ -1084,7 +1084,7 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
s.age_commitment =
depositInfo.ageCommitmentProof?.commitment.publicKeys;
} else if (depositInfo.ageCommitmentProof) {
- (s as any).h_age_commitment = hAgeCommitment;
+ (s as any).h_age_commitment = encodeCrock(hAgeCommitment);
}
return s;
@@ -1518,9 +1518,7 @@ export const nativeCryptoR: TalerCryptoInterfaceR = {
});
logger.info(`payto URI: ${req.reservePayto}`);
- logger.info(
- `signing WALLET_PURSE_MERGE over ${encodeCrock(mergeSigBlob)}`,
- );
+ logger.info(`signing WALLET_PURSE_MERGE over ${encodeCrock(mergeSigBlob)}`);
const reserveSigBlob = buildSigPS(
TalerSignaturePurpose.WALLET_ACCOUNT_MERGE,
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index 1a73dc01c..9678258f0 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -242,7 +242,7 @@ export function selectWithdrawalDenominations(
for (const d of denoms) {
let count = 0;
const cost = Amounts.add(d.value, d.feeWithdraw).amount;
- for (; ;) {
+ for (;;) {
if (Amounts.cmp(remaining, cost) < 0) {
break;
}
@@ -903,7 +903,8 @@ export async function updateWithdrawalDenoms(
denom.verificationStatus === DenominationVerificationStatus.Unverified
) {
logger.trace(
- `Validating denomination (${current + 1}/${denominations.length
+ `Validating denomination (${current + 1}/${
+ denominations.length
}) signature of ${denom.denomPubHash}`,
);
let valid = false;
@@ -1030,7 +1031,7 @@ async function queryReserve(
if (
resp.status === 404 &&
result.talerErrorResponse.code ===
- TalerErrorCode.EXCHANGE_RESERVES_STATUS_UNKNOWN
+ TalerErrorCode.EXCHANGE_RESERVES_STATUS_UNKNOWN
) {
ws.notify({
type: NotificationType.ReserveNotYetFound,
@@ -1336,7 +1337,7 @@ export async function getExchangeWithdrawalInfo(
) {
logger.warn(
`wallet's support for exchange protocol version ${WALLET_EXCHANGE_PROTOCOL_VERSION} might be outdated ` +
- `(exchange has ${exchangeDetails.protocolVersion}), checking for updates`,
+ `(exchange has ${exchangeDetails.protocolVersion}), checking for updates`,
);
}
}
@@ -1869,6 +1870,7 @@ export async function acceptWithdrawalFromUri(
confirmUrl: withdrawInfo.confirmTransferUrl,
},
},
+ restrictAge: req.restrictAge,
forcedDenomSel: req.forcedDenomSel,
reserveStatus: ReserveRecordStatus.RegisteringBank,
});
diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts
index b3439067e..97e25abd3 100644
--- a/packages/taler-wallet-core/src/util/coinSelection.ts
+++ b/packages/taler-wallet-core/src/util/coinSelection.ts
@@ -291,11 +291,14 @@ export function selectPayCoins(
aci.denomPub.age_mask,
req.requiredMinimumAge,
);
- if (!aci.ageCommitmentProof) {
- // No age restriction, can't use for this payment
- continue;
- }
- if (aci.ageCommitmentProof.proof.privateKeys.length < index) {
+ // if (!aci.ageCommitmentProof) {
+ // // No age restriction, can't use for this payment
+ // continue;
+ // }
+ if (
+ aci.ageCommitmentProof &&
+ aci.ageCommitmentProof.proof.privateKeys.length < index
+ ) {
// Available age proofs to low, can't use for this payment
continue;
}