From a8e342213955de80ebf48972abadbd12e0e7b02a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 24 Mar 2020 16:34:15 +0530 Subject: fix recoup response schema / add run-until-done --- src/crypto/workers/cryptoApi.ts | 17 ------------- src/crypto/workers/cryptoImplementation.ts | 38 ------------------------------ 2 files changed, 55 deletions(-) (limited to 'src/crypto') diff --git a/src/crypto/workers/cryptoApi.ts b/src/crypto/workers/cryptoApi.ts index 31ab4dd7e..0b7c2e233 100644 --- a/src/crypto/workers/cryptoApi.ts +++ b/src/crypto/workers/cryptoApi.ts @@ -388,23 +388,6 @@ export class CryptoApi { ); } - /** - * Validate the signature in a recoup confirmation. - */ - isValidRecoupConfirmation( - recoupCoinPub: EddsaPublicKeyString, - recoupConfirmation: RecoupConfirmation, - exchangeSigningKeys: ExchangeSignKeyJson[], - ): Promise { - return this.doRpc( - "isValidRecoupConfirmation", - 1, - recoupCoinPub, - recoupConfirmation, - exchangeSigningKeys, - ); - } - signDepositPermission( depositInfo: DepositInfo, ): Promise { diff --git a/src/crypto/workers/cryptoImplementation.ts b/src/crypto/workers/cryptoImplementation.ts index 4d03e70f5..55caecb43 100644 --- a/src/crypto/workers/cryptoImplementation.ts +++ b/src/crypto/workers/cryptoImplementation.ts @@ -518,44 +518,6 @@ export class CryptoImplementation { return encodeCrock(sig); } - /** - * Validate the signature in a recoup confirmation. - */ - isValidRecoupConfirmation( - recoupCoinPub: EddsaPublicKeyString, - recoupConfirmation: RecoupConfirmation, - exchangeSigningKeys: ExchangeSignKeyJson[], - ): boolean { - const pubEnc = recoupConfirmation.exchange_pub; - if (!checkSignKeyOkay(pubEnc, exchangeSigningKeys)) { - return false; - } - - const sig = decodeCrock(recoupConfirmation.exchange_sig); - const pub = decodeCrock(pubEnc); - - if (recoupConfirmation.old_coin_pub) { - // We're dealing with a refresh recoup - const p = buildSigPS( - SignaturePurpose.EXCHANGE_CONFIRM_RECOUP_REFRESH, - ).put(timestampToBuffer(recoupConfirmation.timestamp)) - .put(amountToBuffer(Amounts.parseOrThrow(recoupConfirmation.amount))) - .put(decodeCrock(recoupCoinPub)) - .put(decodeCrock(recoupConfirmation.old_coin_pub)).build(); - return eddsaVerify(p, sig, pub) - } else if (recoupConfirmation.reserve_pub) { - const p = buildSigPS( - SignaturePurpose.EXCHANGE_CONFIRM_RECOUP_REFRESH, - ).put(timestampToBuffer(recoupConfirmation.timestamp)) - .put(amountToBuffer(Amounts.parseOrThrow(recoupConfirmation.amount))) - .put(decodeCrock(recoupCoinPub)) - .put(decodeCrock(recoupConfirmation.reserve_pub)).build(); - return eddsaVerify(p, sig, pub) - } else { - throw Error("invalid recoup confirmation"); - } - } - benchmark(repetitions: number): BenchmarkResult { let time_hash = 0; for (let i = 0; i < repetitions; i++) { -- cgit v1.2.3