remove completely SignalProtocolStore

This commit is contained in:
Audric Ackermann 2021-02-22 14:10:26 +11:00
parent 4d6fcda668
commit 4f7cb04552
10 changed files with 9 additions and 85 deletions

View file

@ -75,7 +75,6 @@ module.exports = grunt => {
src: [
'libtextsecure/errors.js',
'libtextsecure/libsignal-protocol.js',
'libtextsecure/protocol_wrapper.js',
'libtextsecure/crypto.js',
'libtextsecure/storage.js',
'libtextsecure/storage/user.js',

View file

@ -132,7 +132,6 @@
<script type='text/javascript' src='js/database.js'></script>
<script type='text/javascript' src='js/storage.js'></script>
<script type='text/javascript' src='js/legacy_storage.js'></script>
<script type='text/javascript' src='js/signal_protocol_store.js'></script>
<script type='text/javascript' src='js/libtextsecure.js'></script>
<script type='text/javascript' src='js/libloki.js'></script>

View file

@ -136,7 +136,6 @@
<script type='text/javascript' src='js/database.js'></script>
<script type='text/javascript' src='js/storage.js'></script>
<script type='text/javascript' src='js/legacy_storage.js'></script>
<script type='text/javascript' src='js/signal_protocol_store.js'></script>
<script type='text/javascript' src='js/libtextsecure.js'></script>
<script type='text/javascript' src='js/libloki.js'></script>

View file

@ -1,33 +0,0 @@
/*
global
Backbone,
_,
BlockedNumberController
*/
/* eslint-disable no-proto */
// eslint-disable-next-line func-names
(function() {
'use strict';
function SignalProtocolStore() {}
SignalProtocolStore.prototype = {
constructor: SignalProtocolStore,
async removeAllData() {
await window.Signal.Data.removeAll();
window.storage.reset();
await window.storage.fetch();
window.getConversationController().reset();
BlockedNumberController.reset();
await window.getConversationController().load();
await BlockedNumberController.load();
},
};
_.extend(SignalProtocolStore.prototype, Backbone.Events);
window.SignalProtocolStore = SignalProtocolStore;
})();

View file

@ -19,7 +19,6 @@
<script type="text/javascript" src="../../libtextsecure/helpers.js" data-cover></script>
<script type="text/javascript" src="../../libtextsecure/storage.js" data-cover></script>
<script type="text/javascript" src="../../libtextsecure/libsignal-protocol.js"></script>
<script type="text/javascript" src="../../libtextsecure/protocol_wrapper.js" data-cover></script>
<script type="text/javascript" src="../../libtextsecure/protobufs.js" data-cover></script>
<script type="text/javascript" src="../../libtextsecure/stringview.js" data-cover></script>

View file

@ -1,8 +0,0 @@
/* global window, textsecure, SignalProtocolStore */
// eslint-disable-next-line func-names
(function() {
window.textsecure = window.textsecure || {};
window.textsecure.storage = window.textsecure.storage || {};
textsecure.storage.protocol = new SignalProtocolStore();
})();

View file

@ -21,7 +21,6 @@
<script type="text/javascript" src="../protobufs.js" data-cover></script>
<script type="text/javascript" src="../errors.js" data-cover></script>
<script type="text/javascript" src="../storage.js" data-cover></script>
<script type="text/javascript" src="../protocol_wrapper.js" data-cover></script>
<script type="text/javascript" src="../event_target.js" data-cover></script>
<script type="text/javascript" src="../helpers.js" data-cover></script>

View file

@ -1,37 +0,0 @@
/* global textsecure */
describe('Protocol', () => {
describe('Unencrypted PushMessageProto "decrypt"', () => {
// exclusive
it('works', done => {
localStorage.clear();
const textMessage = new textsecure.protobuf.DataMessage();
textMessage.body = 'Hi Mom';
const serverMessage = {
type: 4, // unencrypted
source: '+19999999999',
timestamp: 42,
message: textMessage.encode(),
};
return textsecure.protocol_wrapper
.handleEncryptedMessage(
serverMessage.source,
serverMessage.source_device,
serverMessage.type,
serverMessage.message
)
.then(message => {
assert.equal(message.body, textMessage.body);
assert.equal(
message.attachments.length,
textMessage.attachments.length
);
assert.equal(textMessage.attachments.length, 0);
})
.then(done)
.catch(done);
});
});
});

View file

@ -288,7 +288,15 @@ describe('Backup', () => {
}
async function clearAllData() {
await textsecure.storage.protocol.removeAllData();
await window.Signal.Data.removeAll();
window.storage.reset();
await window.storage.fetch();
window.getConversationController().reset();
window.BlockedNumberController.reset();
await window.getConversationController().load();
await window.BlockedNumberController.load();
await fse.emptyDir(attachmentsPath);
}

View file

@ -175,7 +175,6 @@
<script type="text/javascript" src="../js/chromium.js" data-cover></script>
<script type="text/javascript" src="../js/database.js" data-cover></script>
<script type="text/javascript" src="../js/storage.js" data-cover></script>
<script type="text/javascript" src="../js/signal_protocol_store.js" data-cover></script>
<script type="text/javascript" src="../js/libtextsecure.js" data-cover></script>
<script type="text/javascript" src="../js/libloki.js" data-cover></script>
<!-- needs the network comms libraries to work -->