Add promises to keystore singleton service.

This commit is contained in:
Spencer Ofwiti 2021-06-14 17:50:39 +03:00
parent 8b1de5dcb5
commit 85e41e99b0
4 changed files with 11 additions and 9 deletions

View File

@ -10,11 +10,13 @@ export class KeystoreService {
constructor() {}
public static async getKeystore(): Promise<MutableKeyStore> {
if (!KeystoreService.mutableKeyStore) {
this.mutableKeyStore = new MutablePgpKeyStore();
await this.mutableKeyStore.loadKeyring();
return KeystoreService.mutableKeyStore;
}
return KeystoreService.mutableKeyStore;
return new Promise(async (resolve, reject) => {
if (!KeystoreService.mutableKeyStore) {
this.mutableKeyStore = new MutablePgpKeyStore();
await this.mutableKeyStore.loadKeyring();
return resolve(KeystoreService.mutableKeyStore);
}
return resolve(KeystoreService.mutableKeyStore);
});
}
}

View File

@ -6,7 +6,7 @@ export const environment = {
logLevel: NgxLoggerLevel.ERROR,
serverLogLevel: NgxLoggerLevel.OFF,
loggingUrl: '',
cicMetaUrl: 'https://meta.dev.grassrootseconomics.net',
cicMetaUrl: 'https://meta-auth.dev.grassrootseconomics.net',
publicKeysUrl: 'https://dev.grassrootseconomics.net/.well-known/publickeys/',
cicCacheUrl: 'https://cache.dev.grassrootseconomics.net',
web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net',

View File

@ -6,7 +6,7 @@ export const environment = {
logLevel: NgxLoggerLevel.ERROR,
serverLogLevel: NgxLoggerLevel.OFF,
loggingUrl: '',
cicMetaUrl: 'https://meta.dev.grassrootseconomics.net',
cicMetaUrl: 'https://meta-auth.dev.grassrootseconomics.net',
publicKeysUrl: 'https://dev.grassrootseconomics.net/.well-known/publickeys/',
cicCacheUrl: 'https://cache.dev.grassrootseconomics.net',
web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net',

View File

@ -6,7 +6,7 @@ export const environment = {
logLevel: NgxLoggerLevel.ERROR,
serverLogLevel: NgxLoggerLevel.OFF,
loggingUrl: 'http://localhost:8000',
cicMetaUrl: 'https://meta.dev.grassrootseconomics.net',
cicMetaUrl: 'https://meta-auth.dev.grassrootseconomics.net',
publicKeysUrl: 'https://dev.grassrootseconomics.net/.well-known/publickeys/',
cicCacheUrl: 'https://cache.dev.grassrootseconomics.net',
web3Provider: 'wss://bloxberg-ws.dev.grassrootseconomics.net',