diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index bc16bddff859..318bbcff123e 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -281,7 +281,7 @@ async function bulkAddKyberPreKeys( await channels.bulkAddKyberPreKeys(updated); } async function getAllKyberPreKeys(): Promise> { - const keys = await channels.getAllPreKeys(); + const keys = await channels.getAllKyberPreKeys(); return keys.map(key => specToBytes(KYBER_PRE_KEY_SPEC, key)); } diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index 9df6ea85ca24..30553a138738 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -384,12 +384,12 @@ export default class AccountManager extends EventTarget { } catch (error) { const errorText = Errors.toLogFormat(error); throw new Error( - `generateNewKyberPreKeys: Failed to fetch identity key - ${errorText}` + `getIdentityKeyOrThrow: Failed to fetch identity key - ${errorText}` ); } if (!identityKey) { - throw new Error('generateNewKyberPreKeys: Missing identity key'); + throw new Error('getIdentityKeyOrThrow: Missing identity key'); } return identityKey; @@ -418,8 +418,10 @@ export default class AccountManager extends EventTarget { toSave.push(generatePreKey(keyId)); } - await store.storePreKeys(ourUuid, toSave); - await storage.put(PRE_KEY_ID_KEY[uuidKind], startId + count); + await Promise.all([ + store.storePreKeys(ourUuid, toSave), + storage.put(PRE_KEY_ID_KEY[uuidKind], startId + count), + ]); return toSave.map(key => ({ keyId: key.keyId, @@ -467,8 +469,10 @@ export default class AccountManager extends EventTarget { }); } - await store.storeKyberPreKeys(ourUuid, toSave); - await storage.put(KYBER_KEY_ID_KEY[uuidKind], startId + count); + await Promise.all([ + store.storeKyberPreKeys(ourUuid, toSave), + storage.put(KYBER_KEY_ID_KEY[uuidKind], startId + count), + ]); return toUpload; }