Refactor outbound delivery state

This commit is contained in:
Evan Hahn 2021-07-09 16:38:51 -05:00 committed by GitHub
parent 831ec98418
commit 9c48a95eb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 3200 additions and 697 deletions

View file

@ -4,12 +4,39 @@
/* global ConversationController, SignalProtocolStore, Whisper */
describe('KeyChangeListener', () => {
const STORAGE_KEYS_TO_RESTORE = ['number_id', 'uuid_id'];
const oldStorageValues = new Map();
const phoneNumberWithKeyChange = '+13016886524'; // nsa
const addressString = `${phoneNumberWithKeyChange}.1`;
const oldKey = window.Signal.Crypto.getRandomBytes(33);
const newKey = window.Signal.Crypto.getRandomBytes(33);
let store;
before(async () => {
window.ConversationController.reset();
await window.ConversationController.load();
STORAGE_KEYS_TO_RESTORE.forEach(key => {
oldStorageValues.set(key, window.textsecure.storage.get(key));
});
window.textsecure.storage.put('number_id', '+14155555556.2');
window.textsecure.storage.put('uuid_id', `${window.getGuid()}.2`);
});
after(async () => {
await window.Signal.Data.removeAll();
await window.storage.fetch();
oldStorageValues.forEach((oldValue, key) => {
if (oldValue) {
window.textsecure.storage.put(key, oldValue);
} else {
window.textsecure.storage.remove(key);
}
});
});
let convo;
beforeEach(async () => {