Fix a few issues with linking a new Desktop instance
This commit is contained in:
parent
8bff6e24f0
commit
4eb49ff304
5 changed files with 32 additions and 22 deletions
|
@ -544,8 +544,13 @@
|
|||
const identityRecord = this.getIdentityRecord(identifier);
|
||||
|
||||
if (isOurIdentifier) {
|
||||
const existing = identityRecord ? identityRecord.publicKey : null;
|
||||
return equalArrayBuffers(existing, publicKey);
|
||||
if (identityRecord && identityRecord.publicKey) {
|
||||
return equalArrayBuffers(identityRecord.publicKey, publicKey);
|
||||
}
|
||||
window.log.warn(
|
||||
'isTrustedIdentity: No local record for our own identifier. Returning true.'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (direction) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
getUuid() {
|
||||
const uuid = textsecure.storage.get('uuid_id');
|
||||
if (uuid === undefined) return undefined;
|
||||
return textsecure.utils.unencodeNumber(uuid)[0];
|
||||
return textsecure.utils.unencodeNumber(uuid.toLowerCase())[0];
|
||||
},
|
||||
|
||||
getDeviceId() {
|
||||
|
|
|
@ -166,7 +166,7 @@ export default class AccountManager extends EventTarget {
|
|||
.then(async (keys: GeneratedKeysType) =>
|
||||
registerKeys(keys).then(async () => confirmKeys(keys))
|
||||
)
|
||||
.then(async () => registrationDone({ number }));
|
||||
.then(async () => registrationDone());
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -274,9 +274,7 @@ export default class AccountManager extends EventTarget {
|
|||
confirmKeys(keys)
|
||||
)
|
||||
)
|
||||
.then(async () =>
|
||||
registrationDone(provisionMessage)
|
||||
);
|
||||
.then(registrationDone);
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -582,10 +580,23 @@ export default class AccountManager extends EventTarget {
|
|||
);
|
||||
}
|
||||
|
||||
// This needs to be done very early, because it changes how things are saved in the
|
||||
// database. Your identity, for example, in the saveIdentityWithAttributes call
|
||||
// below.
|
||||
const conversationId = window.ConversationController.ensureContactIds({
|
||||
e164: number,
|
||||
uuid,
|
||||
highTrust: true,
|
||||
});
|
||||
|
||||
if (!conversationId) {
|
||||
throw new Error('registrationDone: no conversationId!');
|
||||
}
|
||||
|
||||
// update our own identity key, which may have changed
|
||||
// if we're relinking after a reinstall on the master device
|
||||
await window.textsecure.storage.protocol.saveIdentityWithAttributes(
|
||||
number,
|
||||
uuid || number,
|
||||
{
|
||||
publicKey: identityKeyPair.pubKey,
|
||||
firstUse: true,
|
||||
|
@ -714,20 +725,8 @@ export default class AccountManager extends EventTarget {
|
|||
});
|
||||
}
|
||||
|
||||
async registrationDone({ uuid, number }: { uuid?: string; number?: string }) {
|
||||
async registrationDone() {
|
||||
window.log.info('registration done');
|
||||
|
||||
const conversationId = window.ConversationController.ensureContactIds({
|
||||
e164: number,
|
||||
uuid,
|
||||
highTrust: true,
|
||||
});
|
||||
if (!conversationId) {
|
||||
throw new Error('registrationDone: no conversationId!');
|
||||
}
|
||||
|
||||
window.log.info('dispatching registration event');
|
||||
|
||||
this.dispatchEvent(new Event('registration'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,12 @@ class ProvisioningCipherInner {
|
|||
return window.libsignal.Curve.async
|
||||
.createKeyPair(privKey)
|
||||
.then(keyPair => {
|
||||
window.normalizeUuids(
|
||||
provisionMessage,
|
||||
['uuid'],
|
||||
'ProvisioningCipher.decrypt'
|
||||
);
|
||||
|
||||
const ret: ProvisionDecryptResult = {
|
||||
identityKeyPair: keyPair,
|
||||
number: provisionMessage.number,
|
||||
|
|
|
@ -326,7 +326,7 @@
|
|||
"rule": "jQuery-load(",
|
||||
"path": "js/signal_protocol_store.js",
|
||||
"line": " await ConversationController.load();",
|
||||
"lineNumber": 1019,
|
||||
"lineNumber": 1024,
|
||||
"reasonCategory": "falseMatch",
|
||||
"updated": "2020-06-12T14:20:09.936Z"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue