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);
|
const identityRecord = this.getIdentityRecord(identifier);
|
||||||
|
|
||||||
if (isOurIdentifier) {
|
if (isOurIdentifier) {
|
||||||
const existing = identityRecord ? identityRecord.publicKey : null;
|
if (identityRecord && identityRecord.publicKey) {
|
||||||
return equalArrayBuffers(existing, publicKey);
|
return equalArrayBuffers(identityRecord.publicKey, publicKey);
|
||||||
|
}
|
||||||
|
window.log.warn(
|
||||||
|
'isTrustedIdentity: No local record for our own identifier. Returning true.'
|
||||||
|
);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
getUuid() {
|
getUuid() {
|
||||||
const uuid = textsecure.storage.get('uuid_id');
|
const uuid = textsecure.storage.get('uuid_id');
|
||||||
if (uuid === undefined) return undefined;
|
if (uuid === undefined) return undefined;
|
||||||
return textsecure.utils.unencodeNumber(uuid)[0];
|
return textsecure.utils.unencodeNumber(uuid.toLowerCase())[0];
|
||||||
},
|
},
|
||||||
|
|
||||||
getDeviceId() {
|
getDeviceId() {
|
||||||
|
|
|
@ -166,7 +166,7 @@ export default class AccountManager extends EventTarget {
|
||||||
.then(async (keys: GeneratedKeysType) =>
|
.then(async (keys: GeneratedKeysType) =>
|
||||||
registerKeys(keys).then(async () => confirmKeys(keys))
|
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)
|
confirmKeys(keys)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then(async () =>
|
.then(registrationDone);
|
||||||
registrationDone(provisionMessage)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -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
|
// update our own identity key, which may have changed
|
||||||
// if we're relinking after a reinstall on the master device
|
// if we're relinking after a reinstall on the master device
|
||||||
await window.textsecure.storage.protocol.saveIdentityWithAttributes(
|
await window.textsecure.storage.protocol.saveIdentityWithAttributes(
|
||||||
number,
|
uuid || number,
|
||||||
{
|
{
|
||||||
publicKey: identityKeyPair.pubKey,
|
publicKey: identityKeyPair.pubKey,
|
||||||
firstUse: true,
|
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');
|
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'));
|
this.dispatchEvent(new Event('registration'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,12 @@ class ProvisioningCipherInner {
|
||||||
return window.libsignal.Curve.async
|
return window.libsignal.Curve.async
|
||||||
.createKeyPair(privKey)
|
.createKeyPair(privKey)
|
||||||
.then(keyPair => {
|
.then(keyPair => {
|
||||||
|
window.normalizeUuids(
|
||||||
|
provisionMessage,
|
||||||
|
['uuid'],
|
||||||
|
'ProvisioningCipher.decrypt'
|
||||||
|
);
|
||||||
|
|
||||||
const ret: ProvisionDecryptResult = {
|
const ret: ProvisionDecryptResult = {
|
||||||
identityKeyPair: keyPair,
|
identityKeyPair: keyPair,
|
||||||
number: provisionMessage.number,
|
number: provisionMessage.number,
|
||||||
|
|
|
@ -326,7 +326,7 @@
|
||||||
"rule": "jQuery-load(",
|
"rule": "jQuery-load(",
|
||||||
"path": "js/signal_protocol_store.js",
|
"path": "js/signal_protocol_store.js",
|
||||||
"line": " await ConversationController.load();",
|
"line": " await ConversationController.load();",
|
||||||
"lineNumber": 1019,
|
"lineNumber": 1024,
|
||||||
"reasonCategory": "falseMatch",
|
"reasonCategory": "falseMatch",
|
||||||
"updated": "2020-06-12T14:20:09.936Z"
|
"updated": "2020-06-12T14:20:09.936Z"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue