Clean up AccountManager#registerSecondDevice
This commit is contained in:
parent
ca1aef660f
commit
c0dcce7c82
1 changed files with 4 additions and 17 deletions
|
@ -194,9 +194,8 @@ export default class AccountManager extends EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
async registerSecondDevice(
|
async registerSecondDevice(
|
||||||
setProvisioningUrl: Function,
|
setProvisioningUrl: (url: string) => unknown,
|
||||||
confirmNumber: (number?: string) => Promise<string>,
|
confirmNumber: (number?: string) => Promise<string>
|
||||||
progressCallback?: Function
|
|
||||||
) {
|
) {
|
||||||
const clearSessionsAndPreKeys = this.clearSessionsAndPreKeys.bind(this);
|
const clearSessionsAndPreKeys = this.clearSessionsAndPreKeys.bind(this);
|
||||||
const provisioningCipher = new ProvisioningCipher();
|
const provisioningCipher = new ProvisioningCipher();
|
||||||
|
@ -289,8 +288,7 @@ export default class AccountManager extends EventTarget {
|
||||||
// TODO: DESKTOP-2794
|
// TODO: DESKTOP-2794
|
||||||
const keys = await this.generateKeys(
|
const keys = await this.generateKeys(
|
||||||
SIGNED_KEY_GEN_BATCH_SIZE,
|
SIGNED_KEY_GEN_BATCH_SIZE,
|
||||||
UUIDKind.ACI,
|
UUIDKind.ACI
|
||||||
progressCallback
|
|
||||||
);
|
);
|
||||||
await this.server.registerKeys(keys, UUIDKind.ACI);
|
await this.server.registerKeys(keys, UUIDKind.ACI);
|
||||||
await this.confirmKeys(keys, UUIDKind.ACI);
|
await this.confirmKeys(keys, UUIDKind.ACI);
|
||||||
|
@ -677,15 +675,7 @@ export default class AccountManager extends EventTarget {
|
||||||
await store.storeSignedPreKey(ourUuid, key.keyId, key.keyPair, confirmed);
|
await store.storeSignedPreKey(ourUuid, key.keyId, key.keyPair, confirmed);
|
||||||
}
|
}
|
||||||
|
|
||||||
async generateKeys(
|
async generateKeys(count: number, uuidKind: UUIDKind) {
|
||||||
count: number,
|
|
||||||
uuidKind: UUIDKind,
|
|
||||||
providedProgressCallback?: Function
|
|
||||||
) {
|
|
||||||
const progressCallback =
|
|
||||||
typeof providedProgressCallback === 'function'
|
|
||||||
? providedProgressCallback
|
|
||||||
: null;
|
|
||||||
const startId = window.textsecure.storage.get('maxPreKeyId', 1);
|
const startId = window.textsecure.storage.get('maxPreKeyId', 1);
|
||||||
const signedKeyId = window.textsecure.storage.get('signedKeyId', 1);
|
const signedKeyId = window.textsecure.storage.get('signedKeyId', 1);
|
||||||
const ourUuid = window.textsecure.storage.user.getCheckedUuid(uuidKind);
|
const ourUuid = window.textsecure.storage.user.getCheckedUuid(uuidKind);
|
||||||
|
@ -717,9 +707,6 @@ export default class AccountManager extends EventTarget {
|
||||||
keyId: res.keyId,
|
keyId: res.keyId,
|
||||||
publicKey: res.keyPair.pubKey,
|
publicKey: res.keyPair.pubKey,
|
||||||
});
|
});
|
||||||
if (progressCallback) {
|
|
||||||
progressCallback();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue