Clear session store when re-registering
When we re-register, our deviceId might change, which makes our sessions are no longer valid since the recipient will see us as a new device. Fixes #388
This commit is contained in:
parent
a52d35bb1b
commit
80d32103d1
4 changed files with 50 additions and 26 deletions
|
@ -39204,21 +39204,24 @@ var TextSecureServer = (function() {
|
|||
return this.server.confirmCode(
|
||||
number, verificationCode, password, signalingKey, registrationId, deviceName
|
||||
).then(function(response) {
|
||||
textsecure.storage.remove('identityKey');
|
||||
textsecure.storage.remove('signaling_key');
|
||||
textsecure.storage.remove('password');
|
||||
textsecure.storage.remove('registrationId');
|
||||
textsecure.storage.remove('number_id');
|
||||
textsecure.storage.remove('regionCode');
|
||||
return textsecure.storage.axolotl.clearSessionStore().then(function() {
|
||||
textsecure.storage.remove('identityKey');
|
||||
textsecure.storage.remove('signaling_key');
|
||||
textsecure.storage.remove('password');
|
||||
textsecure.storage.remove('registrationId');
|
||||
textsecure.storage.remove('number_id');
|
||||
textsecure.storage.remove('device_name');
|
||||
textsecure.storage.remove('regionCode');
|
||||
|
||||
textsecure.storage.put('identityKey', identityKeyPair);
|
||||
textsecure.storage.put('signaling_key', signalingKey);
|
||||
textsecure.storage.put('password', password);
|
||||
textsecure.storage.put('registrationId', registrationId);
|
||||
textsecure.storage.put('identityKey', identityKeyPair);
|
||||
textsecure.storage.put('signaling_key', signalingKey);
|
||||
textsecure.storage.put('password', password);
|
||||
textsecure.storage.put('registrationId', registrationId);
|
||||
|
||||
textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
|
||||
textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
|
||||
this.server.username = textsecure.storage.get('number_id');
|
||||
textsecure.storage.user.setNumberAndDeviceId(number, response.deviceId || 1, deviceName);
|
||||
textsecure.storage.put('regionCode', libphonenumber.util.getRegionCodeForNumber(number));
|
||||
this.server.username = textsecure.storage.get('number_id');
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
},
|
||||
generateKeys: function (count, progressCallback) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue