fix tipping

This commit is contained in:
Florian Dold 2022-03-07 20:44:18 +01:00
parent 0290c5fd37
commit 0323868e10
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
5 changed files with 15 additions and 21 deletions

View File

@ -609,7 +609,7 @@ export interface TipPlanchetDetail {
/** /**
* Coin's blinded public key. * Coin's blinded public key.
*/ */
coin_ev: string; coin_ev: CoinEnvelope;
} }
/** /**
@ -1307,17 +1307,6 @@ export const codecForMerchantRefundResponse =
.property("refunds", codecForList(codecForMerchantRefundPermission())) .property("refunds", codecForList(codecForMerchantRefundPermission()))
.build("MerchantRefundResponse"); .build("MerchantRefundResponse");
export const codecForMerchantBlindSigWrapperV1 =
(): Codec<MerchantBlindSigWrapperV1> =>
buildCodecForObject<MerchantBlindSigWrapperV1>()
.property("blind_sig", codecForString())
.build("BlindSigWrapper");
export const codecForMerchantTipResponseV1 = (): Codec<MerchantTipResponseV1> =>
buildCodecForObject<MerchantTipResponseV1>()
.property("blind_sigs", codecForList(codecForMerchantBlindSigWrapperV1()))
.build("MerchantTipResponseV1");
export const codecForBlindSigWrapperV2 = (): Codec<MerchantBlindSigWrapperV2> => export const codecForBlindSigWrapperV2 = (): Codec<MerchantBlindSigWrapperV2> =>
buildCodecForObject<MerchantBlindSigWrapperV2>() buildCodecForObject<MerchantBlindSigWrapperV2>()
.property("blind_sig", codecForBlindedDenominationSignature()) .property("blind_sig", codecForBlindedDenominationSignature())

View File

@ -1894,9 +1894,11 @@ export class MerchantService implements MerchantServiceInterface {
default_max_deposit_fee: default_max_deposit_fee:
instanceConfig.defaultMaxDepositFee ?? instanceConfig.defaultMaxDepositFee ??
`${this.merchantConfig.currency}:1.0`, `${this.merchantConfig.currency}:1.0`,
default_wire_transfer_delay: instanceConfig.defaultWireTransferDelay ?? { default_wire_transfer_delay:
d_ms: "forever", instanceConfig.defaultWireTransferDelay ??
}, Duration.fromSpec({
days: 1,
}),
default_pay_delay: instanceConfig.defaultPayDelay ?? { d_ms: "forever" }, default_pay_delay: instanceConfig.defaultPayDelay ?? { d_ms: "forever" },
}); });
} }

View File

@ -110,7 +110,7 @@ export interface DeriveTipRequest {
*/ */
export interface DerivedTipPlanchet { export interface DerivedTipPlanchet {
blindingKey: string; blindingKey: string;
coinEv: string; coinEv: CoinEnvelope;
coinEvHash: string; coinEvHash: string;
coinPriv: string; coinPriv: string;
coinPub: string; coinPub: string;

View File

@ -229,11 +229,16 @@ export class CryptoImplementation {
const denomPub = decodeCrock(req.denomPub.rsa_public_key); const denomPub = decodeCrock(req.denomPub.rsa_public_key);
const coinPubHash = hash(fc.coinPub); const coinPubHash = hash(fc.coinPub);
const ev = rsaBlind(coinPubHash, fc.bks, denomPub); const ev = rsaBlind(coinPubHash, fc.bks, denomPub);
const coinEv = {
cipher: DenomKeyType.Rsa,
rsa_blinded_planchet: encodeCrock(ev),
};
const tipPlanchet: DerivedTipPlanchet = { const tipPlanchet: DerivedTipPlanchet = {
blindingKey: encodeCrock(fc.bks), blindingKey: encodeCrock(fc.bks),
coinEv: encodeCrock(ev), coinEv,
coinEvHash: encodeCrock(hash(ev)), coinEvHash: encodeCrock(
hashCoinEv(coinEv, encodeCrock(hashDenomPub(req.denomPub))),
),
coinPriv: encodeCrock(fc.coinPriv), coinPriv: encodeCrock(fc.coinPriv),
coinPub: encodeCrock(fc.coinPub), coinPub: encodeCrock(fc.coinPub),
}; };

View File

@ -27,13 +27,11 @@ import {
NotificationType, NotificationType,
TipPlanchetDetail, TipPlanchetDetail,
TalerErrorCode, TalerErrorCode,
codecForMerchantTipResponseV1,
Logger, Logger,
URL, URL,
DenomKeyType, DenomKeyType,
BlindedDenominationSignature, BlindedDenominationSignature,
codecForMerchantTipResponseV2, codecForMerchantTipResponseV2,
MerchantProtocolVersion,
} from "@gnu-taler/taler-util"; } from "@gnu-taler/taler-util";
import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js"; import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
import { import {