From e57316c6cb8b8126c0c2df41da280d411097b5e7 Mon Sep 17 00:00:00 2001 From: chrwoizi Date: Fri, 14 Feb 2020 11:46:15 +0100 Subject: [PATCH] Wait until the keys are generated The initialization method should wait until the key file is written because other methods could use the keys-method after initialization. --- lib/Client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index fbb7868..3140b10 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -104,7 +104,7 @@ module.exports = class Client { async initialization(order) { const keys = await this.keys(); - if (keys === null) this._generateKeys(); + if (keys === null) await this._generateKeys(); if (this.tracesStorage) this.tracesStorage.new().ofType('ORDER.INI'); @@ -223,10 +223,10 @@ module.exports = class Client { } } - _generateKeys() { + async _generateKeys() { const keysObject = Keys.generate(); - this._writeKeys(keysObject); + await this._writeKeys(keysObject); } async setBankKeys(bankKeys) {