gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: get basic test cases to work


From: gnunet
Subject: [taler-wallet-core] branch master updated: get basic test cases to work with new exchange
Date: Tue, 05 Jan 2021 17:59:56 +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 c032931f get basic test cases to work with new exchange
c032931f is described below

commit c032931f22e4d1b44e2a3af52c705db147129024
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Jan 5 17:59:50 2021 +0100

    get basic test cases to work with new exchange
---
 packages/taler-integrationtests/src/harness.ts     | 116 +++++++++++++++++----
 .../taler-wallet-core/src/operations/versions.ts   |   2 +-
 packages/taler-wallet-core/src/types/dbTypes.ts    |  15 +--
 packages/taler-wallet-core/src/util/talerconfig.ts |   7 ++
 4 files changed, 109 insertions(+), 31 deletions(-)

diff --git a/packages/taler-integrationtests/src/harness.ts 
b/packages/taler-integrationtests/src/harness.ts
index 1dd6c7c6..ebf1e98d 100644
--- a/packages/taler-integrationtests/src/harness.ts
+++ b/packages/taler-integrationtests/src/harness.ts
@@ -414,6 +414,7 @@ export interface BankConfig {
 
 function setPaths(config: Configuration, home: string) {
   config.setString("paths", "taler_home", home);
+  config.setString("paths", "taler_runtime_dir", "$TALER_HOME/taler-runtime/");
   config.setString(
     "paths",
     "taler_data_home",
@@ -851,7 +852,7 @@ export class ExchangeService implements 
ExchangeServiceInterface {
     config.setString("exchange", "max_keys_caching", "forever");
     config.setString("exchange", "db", "postgres");
     config.setString(
-      "exchange",
+      "exchange-offline",
       "master_priv_file",
       "${TALER_DATA_HOME}/exchange/offline-keys/master.priv",
     );
@@ -862,19 +863,6 @@ export class ExchangeService implements 
ExchangeServiceInterface {
     config.setString("exchange", "lookahead_sign", "32 weeks 1 day");
     config.setString("exchange", "lookahead_provide", "4 weeks 1 day");
 
-    for (let i = 2020; i < 2029; i++) {
-      config.setString(
-        "fees-x-taler-bank",
-        `wire-fee-${i}`,
-        `${e.currency}:0.01`,
-      );
-      config.setString(
-        "fees-x-taler-bank",
-        `closing-fee-${i}`,
-        `${e.currency}:0.01`,
-      );
-    }
-
     config.setString("exchangedb-postgres", "config", e.database);
 
     const exchangeMasterKey = createEddsaKeyPair();
@@ -886,7 +874,7 @@ export class ExchangeService implements 
ExchangeServiceInterface {
     );
 
     const masterPrivFile = config
-      .getPath("exchange", "master_priv_file")
+      .getPath("exchange-offline", "master_priv_file")
       .required();
 
     fs.mkdirSync(path.dirname(masterPrivFile), { recursive: true });
@@ -963,6 +951,9 @@ export class ExchangeService implements 
ExchangeServiceInterface {
   exchangeHttpProc: ProcessWrapper | undefined;
   exchangeWirewatchProc: ProcessWrapper | undefined;
 
+  helperCryptoRsaProc: ProcessWrapper | undefined;
+  helperCryptoEddsaProc: ProcessWrapper | undefined;
+
   constructor(
     private globalState: GlobalTestState,
     private exchangeConfig: ExchangeConfig,
@@ -995,14 +986,85 @@ export class ExchangeService implements 
ExchangeServiceInterface {
       await httpd.wait();
       this.exchangeHttpProc = undefined;
     }
+    const cryptoRsa = this.helperCryptoRsaProc;
+    if (cryptoRsa) {
+      cryptoRsa.proc.kill("SIGTERM");
+      await cryptoRsa.wait();
+      this.helperCryptoRsaProc = undefined;
+    }
+    const cryptoEddsa = this.helperCryptoEddsaProc;
+    if (cryptoEddsa) {
+      cryptoEddsa.proc.kill("SIGTERM");
+      await cryptoEddsa.wait();
+      this.helperCryptoRsaProc = undefined;
+    }
   }
 
+  /**
+   * Update keys signing the keys generated by the security module
+   * with the offline signing key.
+   */
   async keyup(): Promise<void> {
-    await sh(
+    await runCommand(
       this.globalState,
-      "exchange-keyup",
-      `taler-exchange-keyup ${this.timetravelArg} -c "${this.configFilename}"`,
+      "exchange-offline",
+      "taler-exchange-offline",
+      [
+        "-c",
+        this.configFilename,
+        ...this.timetravelArgArr,
+        "download",
+        "sign",
+        "upload",
+      ],
     );
+
+    const accounts: string[] = [];
+
+    const config = Configuration.load(this.configFilename);
+    for (const sectionName of config.getSectionNames()) {
+      if (sectionName.startsWith("exchange-account")) {
+        accounts.push(config.getString(sectionName, "payto_uri").required());
+      }
+    }
+
+    console.log("configuring bank accounts", accounts);
+
+    for (const acc of accounts) {
+      await runCommand(
+        this.globalState,
+        "exchange-offline",
+        "taler-exchange-offline",
+        [
+          "-c",
+          this.configFilename,
+          ...this.timetravelArgArr,
+          "enable-account",
+          acc,
+          "upload",
+        ],
+      );
+    }
+
+    const year = new Date().getFullYear();
+    for (let i = year; i < year+5; i++) {
+      await runCommand(
+        this.globalState,
+        "exchange-offline",
+        "taler-exchange-offline",
+        [
+          "-c",
+          this.configFilename,
+          ...this.timetravelArgArr,
+          "wire-fee",
+          `${i}`,
+          "x-taler-bank",
+          `${this.exchangeConfig.currency}:0.01`,
+          `${this.exchangeConfig.currency}:0.01`,
+          "upload",
+        ],
+      );
+    }
   }
 
   async revokeDenomination(denomPubHash: string) {
@@ -1032,11 +1094,17 @@ export class ExchangeService implements 
ExchangeServiceInterface {
       "exchange-dbinit",
       `taler-exchange-dbinit -c "${this.configFilename}"`,
     );
-    await this.keyup();
-    await sh(
-      this.globalState,
-      "exchange-wire",
-      `taler-exchange-wire ${this.timetravelArg} -c "${this.configFilename}"`,
+
+    this.helperCryptoEddsaProc = this.globalState.spawnService(
+      "taler-helper-crypto-eddsa",
+      ["-c", this.configFilename, ...this.timetravelArgArr],
+      `exchange-crypto-eddsa-${this.name}`,
+    );
+
+    this.helperCryptoRsaProc = this.globalState.spawnService(
+      "taler-helper-crypto-rsa",
+      ["-c", this.configFilename, ...this.timetravelArgArr],
+      `exchange-crypto-rsa-${this.name}`,
     );
 
     this.exchangeWirewatchProc = this.globalState.spawnService(
@@ -1056,6 +1124,8 @@ export class ExchangeService implements 
ExchangeServiceInterface {
       ],
       `exchange-httpd-${this.name}`,
     );
+
+    await this.keyup();
   }
 
   async pingUntilAvailable(): Promise<void> {
diff --git a/packages/taler-wallet-core/src/operations/versions.ts 
b/packages/taler-wallet-core/src/operations/versions.ts
index 11ff8f52..b798871c 100644
--- a/packages/taler-wallet-core/src/operations/versions.ts
+++ b/packages/taler-wallet-core/src/operations/versions.ts
@@ -19,7 +19,7 @@
  *
  * Uses libtool's current:revision:age versioning.
  */
-export const WALLET_EXCHANGE_PROTOCOL_VERSION = "8:0:0";
+export const WALLET_EXCHANGE_PROTOCOL_VERSION = "9:0:0";
 
 /**
  * Protocol version spoken with the merchant.
diff --git a/packages/taler-wallet-core/src/types/dbTypes.ts 
b/packages/taler-wallet-core/src/types/dbTypes.ts
index 2f9c0ec1..dcfdf331 100644
--- a/packages/taler-wallet-core/src/types/dbTypes.ts
+++ b/packages/taler-wallet-core/src/types/dbTypes.ts
@@ -1206,7 +1206,7 @@ export interface PurchaseRecord {
 
   /**
    * Deposit permissions, available once the user has accepted the payment.
-   * 
+   *
    * This value is cached and derived from payCoinSelection.
    */
   coinDepositPermissions: CoinDepositPermission[] | undefined;
@@ -1508,12 +1508,12 @@ class PurchasesStore extends Store<"purchases", 
PurchaseRecord> {
     "fulfillmentUrlIndex",
     string,
     PurchaseRecord
-  >(this, "fulfillmentUrlIndex", "contractData.fulfillmentUrl");
+  >(this, "fulfillmentUrlIndex", "download.contractData.fulfillmentUrl");
 
   orderIdIndex = new Index<"purchases", "orderIdIndex", string, 
PurchaseRecord>(
     this,
     "orderIdIndex",
-    ["contractData.merchantBaseUrl", "contractData.orderId"],
+    ["download.contractData.merchantBaseUrl", "download.contractData.orderId"],
   );
 }
 
@@ -1602,11 +1602,12 @@ class PlanchetsStore extends Store<"planchets", 
PlanchetRecord> {
     PlanchetRecord
   >(this, "withdrawalGroupIndex", "withdrawalGroupId");
 
-  coinEvHashIndex = new Index<"planchets", "coinEvHashIndex", string, 
PlanchetRecord>(
-    this,
+  coinEvHashIndex = new Index<
+    "planchets",
     "coinEvHashIndex",
-    "coinEvHash",
-  );
+    string,
+    PlanchetRecord
+  >(this, "coinEvHashIndex", "coinEvHash");
 }
 
 /**
diff --git a/packages/taler-wallet-core/src/util/talerconfig.ts 
b/packages/taler-wallet-core/src/util/talerconfig.ts
index d121601c..fa8c2d40 100644
--- a/packages/taler-wallet-core/src/util/talerconfig.ts
+++ b/packages/taler-wallet-core/src/util/talerconfig.ts
@@ -213,6 +213,13 @@ export class Configuration {
     sec[option.toUpperCase()] = value;
   }
 
+  /**
+   * Get lower-cased section names.
+   */
+  getSectionNames(): string[] {
+    return Object.keys(this.sectionMap).map((x) => x.toLowerCase());
+  }
+
   getString(section: string, option: string): ConfigValue<string> {
     const secNorm = section.toUpperCase();
     const optNorm = option.toUpperCase();

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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