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

@ -261,6 +261,8 @@ describe('Backup', () => {
const CONTACT_ONE_NUMBER = '+12025550001';
const CONTACT_TWO_NUMBER = '+12025550002';
const CONVERSATION_ID = 'bdaa7f4f-e9bd-493e-ab0d-8331ad604269';
const toArrayBuffer = nodeBuffer =>
nodeBuffer.buffer.slice(
nodeBuffer.byteOffset,
@ -405,7 +407,7 @@ describe('Backup', () => {
const CONVERSATION_COUNT = 1;
const messageWithAttachments = {
conversationId: CONTACT_ONE_NUMBER,
conversationId: CONVERSATION_ID,
body: 'Totally!',
source: OUR_NUMBER,
received_at: 1524185933350,
@ -493,7 +495,7 @@ describe('Backup', () => {
active_at: 1524185933350,
color: 'orange',
expireTimer: 0,
id: CONTACT_ONE_NUMBER,
id: CONVERSATION_ID,
name: 'Someone Somewhere',
profileAvatar: {
contentType: 'image/jpeg',

View file

@ -21,6 +21,20 @@ describe('Privacy', () => {
});
});
describe('redactUuids', () => {
it('should redact all uuids', () => {
const text =
'This is a log line with a uuid 9e420799-acdf-4bf4-8dee-353d7e2096b4\n' +
'and another one IN ALL UPPERCASE 340727FB-E43A-413B-941B-AADA033B6CA3';
const actual = Privacy.redactUuids(text);
const expected =
'This is a log line with a uuid [REDACTED]b4\n' +
'and another one IN ALL UPPERCASE [REDACTED]A3';
assert.equal(actual, expected);
});
});
describe('redactGroupIds', () => {
it('should redact all group IDs', () => {
const text =

View file

@ -1,4 +1,4 @@
/* global _, textsecure, libsignal, storage */
/* global _, textsecure, libsignal, storage, ConversationController */
'use strict';
@ -8,7 +8,7 @@ describe('SignalProtocolStore', () => {
let identityKey;
let testKey;
before(done => {
before(async () => {
store = textsecure.storage.protocol;
store.hydrateCaches();
identityKey = {
@ -22,7 +22,10 @@ describe('SignalProtocolStore', () => {
storage.put('registrationId', 1337);
storage.put('identityKey', identityKey);
storage.fetch().then(done, done);
await storage.fetch();
ConversationController.reset();
await ConversationController.load();
await ConversationController.getOrCreateAndWait(number, 'private');
});
describe('getLocalRegistrationId', () => {