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/workers/cryptoImplementation.ts | |
parent | 01e83df471802d3253953b00672af0bc879403fe (diff) | |
download | wallet-core-a8e342213955de80ebf48972abadbd12e0e7b02a.tar.xz |
fix recoup response schema / add run-until-done
Diffstat (limited to 'src/crypto/workers/cryptoImplementation.ts')
-rw-r--r-- | src/crypto/workers/cryptoImplementation.ts | 38 |
1 files changed, 0 insertions, 38 deletions
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++) { |