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.
This commit is contained in:
chrwoizi 2020-02-14 11:46:15 +01:00 committed by GitHub
parent 4b0bf0eba6
commit e57316c6cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {