Passive UUID support

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
Ken Powers 2020-03-05 13:14:58 -08:00 committed by Scott Nonnenberg
parent f64ca0ed21
commit a90246cbe5
49 changed files with 2226 additions and 776 deletions

View file

@ -16,13 +16,33 @@
}
},
setUuidAndDeviceId(uuid, deviceId) {
textsecure.storage.put('uuid_id', `${uuid}.${deviceId}`);
},
getNumber() {
const numberId = textsecure.storage.get('number_id');
if (numberId === undefined) return undefined;
return textsecure.utils.unencodeNumber(numberId)[0];
},
getUuid() {
const uuid = textsecure.storage.get('uuid_id');
if (uuid === undefined) return undefined;
return textsecure.utils.unencodeNumber(uuid)[0];
},
getDeviceId() {
return this._getDeviceIdFromUuid() || this._getDeviceIdFromNumber();
},
_getDeviceIdFromUuid() {
const uuid = textsecure.storage.get('uuid_id');
if (uuid === undefined) return undefined;
return textsecure.utils.unencodeNumber(uuid)[1];
},
_getDeviceIdFromNumber() {
const numberId = textsecure.storage.get('number_id');
if (numberId === undefined) return undefined;
return textsecure.utils.unencodeNumber(numberId)[1];