|
|
|
@ -34267,22 +34267,9 @@ var util = (function() {
|
|
|
|
|
'use strict';
|
|
|
|
|
window.libsignal = window.libsignal || {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libsignal.protocol = function(storage_interface) {
|
|
|
|
|
libsignal.protocol = function() {
|
|
|
|
|
var self = {};
|
|
|
|
|
|
|
|
|
|
/***************************
|
|
|
|
|
*** Key/session storage ***
|
|
|
|
|
***************************/
|
|
|
|
|
function getRecord(encodedNumber) {
|
|
|
|
|
return storage_interface.loadSession(encodedNumber).then(function(serialized) {
|
|
|
|
|
if (serialized === undefined) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
return Internal.SessionRecord.deserialize(serialized);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************
|
|
|
|
|
*** Internal Crypto stuff ***
|
|
|
|
|
*****************************/
|
|
|
|
@ -34335,19 +34322,6 @@ libsignal.protocol = function(storage_interface) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.closeOpenSessionForDevice = function(encodedNumber) {
|
|
|
|
|
return getRecord(encodedNumber).then(function(record) {
|
|
|
|
|
if (record !== undefined) {
|
|
|
|
|
if (record.getOpenSession() === undefined) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
record.archiveCurrentState();
|
|
|
|
|
return storage_interface.storeSession(encodedNumber, record.serialize());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.createIdentityKeyRecvSocket = function() {
|
|
|
|
|
var socketInfo = {};
|
|
|
|
|
var keyPair;
|
|
|
|
@ -34392,25 +34366,6 @@ libsignal.protocol = function(storage_interface) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.getRegistrationId = function(encodedNumber) {
|
|
|
|
|
return getRecord(encodedNumber).then(function(record) {
|
|
|
|
|
if (record === undefined) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
return record.registrationId;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
self.hasOpenSession = function(encodedNumber) {
|
|
|
|
|
return getRecord(encodedNumber).then(function(record) {
|
|
|
|
|
if (record === undefined) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return record.haveOpenSession();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
self.startWorker = function(url) {
|
|
|
|
|
Internal.startWorker(url);
|
|
|
|
|
};
|
|
|
|
|