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.
pull/272/head
Bradley Sinclair 6 years ago committed by Scott Nonnenberg
parent a28f4a9187
commit f968a5db3d

@ -47,6 +47,9 @@
return this.server.requestVerificationSMS(number); return this.server.requestVerificationSMS(number);
}, },
async encryptDeviceName(name, providedIdentityKey) { async encryptDeviceName(name, providedIdentityKey) {
if (!name) {
return null;
}
const identityKey = const identityKey =
providedIdentityKey || providedIdentityKey ||
(await textsecure.storage.protocol.getIdentityKeyPair()); (await textsecure.storage.protocol.getIdentityKeyPair());

@ -38,6 +38,11 @@ describe('AccountManager', () => {
assert.strictEqual(decrypted, deviceName); 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', () => { it('keeps three confirmed keys even if over a week old', () => {

Loading…
Cancel
Save