Eliminate extra preKeys, fail early on key creation if no PNI identity key
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
0e19255256
commit
3339899684
6 changed files with 444 additions and 6 deletions
|
@ -489,6 +489,24 @@ export default class AccountManager extends EventTarget {
|
|||
async maybeUpdateKeys(serviceIdKind: ServiceIdKind): Promise<void> {
|
||||
const logId = `maybeUpdateKeys(${serviceIdKind})`;
|
||||
await this.queueTask(async () => {
|
||||
const { storage } = window.textsecure;
|
||||
let identityKey: KeyPairType;
|
||||
|
||||
try {
|
||||
const ourServiceId = storage.user.getCheckedServiceId(serviceIdKind);
|
||||
identityKey = this.getIdentityKeyOrThrow(ourServiceId);
|
||||
} catch (error) {
|
||||
if (serviceIdKind === ServiceIdKind.PNI) {
|
||||
log.info(
|
||||
`${logId}: Not enough information to update PNI keys`,
|
||||
Errors.toLogFormat(error)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
const { count: preKeyCount, pqCount: kyberPreKeyCount } =
|
||||
await this.server.getMyKeyCounts(serviceIdKind);
|
||||
|
||||
|
@ -544,9 +562,6 @@ export default class AccountManager extends EventTarget {
|
|||
}
|
||||
log.info(`${logId}: Uploading with ${keySummary.join(', ')}`);
|
||||
|
||||
const { storage } = window.textsecure;
|
||||
const ourServiceId = storage.user.getCheckedServiceId(serviceIdKind);
|
||||
const identityKey = this.getIdentityKeyOrThrow(ourServiceId);
|
||||
const toUpload = {
|
||||
identityKey: identityKey.pubKey,
|
||||
preKeys,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue