From a9cba1471a5bedceb6ff54907fdf2c35547b83c5 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 21 Jan 2016 19:25:55 -0800 Subject: [PATCH] Update our own key on re-install Previously we would delete our own key from the trust store when re-linking, in case it changed. We can also immediately take one step further and store the new key. Typically this happens in the course of requesting sync info from the master device, except in the case of standalone clients. Closes #596 // FREEBIE --- js/libtextsecure.js | 7 +++++-- libtextsecure/account_manager.js | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index e84ac0aef..016e508d8 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -36740,9 +36740,12 @@ var TextSecureServer = (function() { textsecure.storage.remove('device_name'); textsecure.storage.remove('regionCode'); - // remove 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 - textsecure.storage.axolotl.removeIdentityKey(number); + var putIdentity = textsecure.storage.axolotl.putIdentityKey.bind( + null, number, identityKeyPair.pubKey + ); + textsecure.storage.axolotl.removeIdentityKey(number).then(putIdentity, putIdentity); textsecure.storage.put('identityKey', identityKeyPair); textsecure.storage.put('signaling_key', signalingKey); diff --git a/libtextsecure/account_manager.js b/libtextsecure/account_manager.js index 69a13c608..fe22d5cf6 100644 --- a/libtextsecure/account_manager.js +++ b/libtextsecure/account_manager.js @@ -106,9 +106,12 @@ textsecure.storage.remove('device_name'); textsecure.storage.remove('regionCode'); - // remove 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 - textsecure.storage.axolotl.removeIdentityKey(number); + var putIdentity = textsecure.storage.axolotl.putIdentityKey.bind( + null, number, identityKeyPair.pubKey + ); + textsecure.storage.axolotl.removeIdentityKey(number).then(putIdentity, putIdentity); textsecure.storage.put('identityKey', identityKeyPair); textsecure.storage.put('signaling_key', signalingKey);