Ensure encrypting device name does not die on empty device name (#3066)

Ran into this on the Contributors guidelines setting up the development env.
registerSingleDevice does not pass a deviceName, so it fail every time.
This commit is contained in:
Bradley Sinclair 2019-01-29 09:39:55 -08:00 committed by Scott Nonnenberg
parent a28f4a9187
commit f968a5db3d
2 changed files with 8 additions and 0 deletions

View file

@ -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());

View file

@ -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', () => {