diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-03-24 16:34:15 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-03-24 16:34:15 +0530 |
commit | a8e342213955de80ebf48972abadbd12e0e7b02a (patch) | |
tree | 417df2e7e71ab75391f7870aa2097c1fbdeb9d76 /src/crypto | |
parent | 01e83df471802d3253953b00672af0bc879403fe (diff) |
fix recoup response schema / add run-until-done
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/workers/cryptoApi.ts | 17 | ||||
-rw-r--r-- | src/crypto/workers/cryptoImplementation.ts | 38 |
2 files changed, 0 insertions, 55 deletions
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<boolean> { - return this.doRpc<boolean>( - "isValidRecoupConfirmation", - 1, - recoupCoinPub, - recoupConfirmation, - exchangeSigningKeys, - ); - } - signDepositPermission( depositInfo: DepositInfo, ): Promise<CoinDepositPermission> { 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++) { |