Don't save device objects to disk
Generate them from session and identity data. Save/delete pending prekey data in an in-memory store and attach it to outgoing device objects.
This commit is contained in:
parent
f18795a253
commit
43d6efcd9e
3 changed files with 85 additions and 213 deletions
|
@ -198,19 +198,7 @@
|
|||
contact.fetch().always(function() {
|
||||
var sessions = contact.get('sessions') || {};
|
||||
sessions[deviceId] = record;
|
||||
contact.save({sessions: sessions}).always(function() {
|
||||
resolve(textsecure.storage.devices.getDeviceObject(encodedNumber).then(function(device) {
|
||||
if (device === undefined) {
|
||||
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
|
||||
device = { encodedNumber: encodedNumber,
|
||||
//TODO: Remove this duplication
|
||||
identityKey: identityKey
|
||||
};
|
||||
return textsecure.storage.devices.saveDeviceObject(device);
|
||||
});
|
||||
}
|
||||
}));
|
||||
});
|
||||
contact.save({sessions: sessions}).always(resolve);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue