Skip to content

Commit

Permalink
Ensure encrypting device name does not die on empty device name (#3066)
Browse files Browse the repository at this point in the history
Ran into this on the Contributors guidelines setting up the development env.
registerSingleDevice does not pass a deviceName, so it fail every time.
  • Loading branch information
bruntly authored and scottnonnenberg-signal committed Jan 29, 2019
1 parent a28f4a9 commit f968a5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libtextsecure/account_manager.js
Expand Up @@ -47,6 +47,9 @@
return this.server.requestVerificationSMS(number);
},
async encryptDeviceName(name, providedIdentityKey) {
if (!name) {
return null;
}
const identityKey =
providedIdentityKey ||
(await textsecure.storage.protocol.getIdentityKeyPair());
Expand Down
5 changes: 5 additions & 0 deletions libtextsecure/test/account_manager_test.js
Expand Up @@ -38,6 +38,11 @@ describe('AccountManager', () => {

assert.strictEqual(decrypted, deviceName);
});

it('handles null deviceName', async () => {
const encrypted = await accountManager.encryptDeviceName(null);
assert.strictEqual(encrypted, null);
});
});

it('keeps three confirmed keys even if over a week old', () => {
Expand Down

0 comments on commit f968a5d

Please sign in to comment.