From 0b41ef098306df74b6755d5d5b37fbb5b03f5196 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Tue, 19 Nov 2019 11:13:38 +1100 Subject: [PATCH 1/2] Ensure primaryDevicePubKey is always defined in storage --- js/background.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/background.js b/js/background.js index a4e8623ff..33712bc97 100644 --- a/js/background.js +++ b/js/background.js @@ -305,6 +305,13 @@ storage.put('PoWDifficulty', window.getDefaultPoWDifficulty()); } + // Ensure accounts created prior to 1.0.0-beta8 do have their + // 'primaryDevicePubKey' defined. + const primaryDevicePubKey = storage.get('primaryDevicePubKey', null); + if (!primaryDevicePubKey) { + storage.put('primaryDevicePubKey', textsecure.storage.user.getNumber()); + } + // These make key operations available to IPC handlers created in preload.js window.Events = { getDeviceName: () => textsecure.storage.user.getDeviceName(), From 8850d9bccec56ba581d9d6abe7249fa6ba98135c Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Tue, 19 Nov 2019 12:02:38 +1100 Subject: [PATCH 2/2] Only set when account already created --- js/background.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/background.js b/js/background.js index 33712bc97..61274cd0d 100644 --- a/js/background.js +++ b/js/background.js @@ -307,8 +307,7 @@ // Ensure accounts created prior to 1.0.0-beta8 do have their // 'primaryDevicePubKey' defined. - const primaryDevicePubKey = storage.get('primaryDevicePubKey', null); - if (!primaryDevicePubKey) { + if (Whisper.Registration.isDone() && !storage.get('primaryDevicePubKey', null)) { storage.put('primaryDevicePubKey', textsecure.storage.user.getNumber()); }