gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: fix recoup response schema /


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix recoup response schema / add run-until-done
Date: Tue, 24 Mar 2020 12:04:22 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new a8e34221 fix recoup response schema / add run-until-done
a8e34221 is described below

commit a8e342213955de80ebf48972abadbd12e0e7b02a
Author: Florian Dold <address@hidden>
AuthorDate: Tue Mar 24 16:34:15 2020 +0530

    fix recoup response schema / add run-until-done
---
 src/crypto/workers/cryptoApi.ts            | 17 -------------
 src/crypto/workers/cryptoImplementation.ts | 38 ------------------------------
 src/headless/taler-wallet-cli.ts           | 10 ++++++++
 src/operations/recoup.ts                   | 20 ----------------
 src/types/talerTypes.ts                    | 32 -------------------------
 5 files changed, 10 insertions(+), 107 deletions(-)

diff --git a/src/crypto/workers/cryptoApi.ts b/src/crypto/workers/cryptoApi.ts
index 31ab4dd7..0b7c2e23 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 4d03e70f..55caecb4 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++) {
diff --git a/src/headless/taler-wallet-cli.ts b/src/headless/taler-wallet-cli.ts
index 17495391..b8802380 100644
--- a/src/headless/taler-wallet-cli.ts
+++ b/src/headless/taler-wallet-cli.ts
@@ -241,6 +241,16 @@ walletCli
     });
   });
 
+walletCli
+  .subcommand("finishPendingOpt", "run-until-done", {
+    help: "Run until no more work is left.",
+  })
+  .action(async (args) => {
+    await withWallet(args, async (wallet) => {
+      await wallet.runUntilDoneAndStop();
+    });
+  });
+
 walletCli
   .subcommand("handleUri", "handle-uri", {
     help: "Handle a taler:// URI.",
diff --git a/src/operations/recoup.ts b/src/operations/recoup.ts
index 163f7759..3c3d0f45 100644
--- a/src/operations/recoup.ts
+++ b/src/operations/recoup.ts
@@ -153,16 +153,6 @@ async function recoupWithdrawCoin(
     return;
   }
 
-  const isValid = ws.cryptoApi.isValidRecoupConfirmation(
-    coin.coinPub,
-    recoupConfirmation,
-    exchangeDetails.signingKeys,
-  );
-
-  if (!isValid) {
-    throw Error("invalid recoup confirmation signature");
-  }
-
   // FIXME: verify that our expectations about the amount match
 
   await ws.db.runWithWriteTransaction(
@@ -237,16 +227,6 @@ async function recoupRefreshCoin(
     return;
   }
 
-  const isValid = ws.cryptoApi.isValidRecoupConfirmation(
-    coin.coinPub,
-    recoupConfirmation,
-    exchangeDetails.signingKeys,
-  );
-
-  if (!isValid) {
-    throw Error("invalid recoup confirmation signature");
-  }
-
   const refreshGroupId = await ws.db.runWithWriteTransaction(
     [Stores.coins, Stores.reserves],
     async tx => {
diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts
index e5be32ab..90751940 100644
--- a/src/types/talerTypes.ts
+++ b/src/types/talerTypes.ts
@@ -194,34 +194,6 @@ export class RecoupConfirmation {
    * provided if refreshed was true.
    */
   old_coin_pub?: string;
-
-  /**
-   * How much will the exchange pay back (needed by wallet in
-   * case coin was partially spent and wallet got restored from backup)
-   */
-  amount: string;
-
-  /**
-   * Time by which the exchange received the /payback request.
-   */
-  timestamp: Timestamp;
-
-  /**
-   * the EdDSA signature of TALER_PaybackConfirmationPS using a current
-   * signing key of the exchange affirming the successful
-   * payback request, and that the exchange promises to transfer the funds
-   * by the date specified (this allows the exchange delaying the transfer
-   * a bit to aggregate additional payback requests into a larger one).
-   */
-  exchange_sig: string;
-
-  /**
-   * Public EdDSA key of the exchange that was used to generate the signature.
-   * Should match one of the exchange's signing keys from /keys.  It is given
-   * explicitly as the client might otherwise be confused by clock skew as to
-   * which signing key was used.
-   */
-  exchange_pub: string;
 }
 
 /**
@@ -1010,10 +982,6 @@ export const codecForRecoupConfirmation = () =>
     makeCodecForObject<RecoupConfirmation>()
       .property("reserve_pub", makeCodecOptional(codecForString))
       .property("old_coin_pub", makeCodecOptional(codecForString))
-      .property("amount", codecForString)
-      .property("timestamp", codecForTimestamp)
-      .property("exchange_sig", codecForString)
-      .property("exchange_pub", codecForString)
       .build("RecoupConfirmation"),
   );
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]