diff options
-rw-r--r-- | packages/taler-integrationtests/src/harness.ts | 116 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/versions.ts | 2 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/types/dbTypes.ts | 15 | ||||
-rw-r--r-- | 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 1dd6c7c6f..ebf1e98d9 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 11ff8f528..b798871c2 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 2f9c0ec19..dcfdf3316 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 d121601c5..fa8c2d40f 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(); |