increase to ttl of 14 days for everything except TypingMessages

pull/1576/head
Audric Ackermann 4 years ago
parent a26c5da6cb
commit 8444c7cbfc
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -3,9 +3,7 @@ import { DAYS, SECONDS } from './utils/Number';
export const TTL_DEFAULT = {
TYPING_MESSAGE: 20 * SECONDS,
REGULAR_MESSAGE: 2 * DAYS,
ENCRYPTION_PAIR_GROUP: 4 * DAYS,
CONFIGURATION_MESSAGE: 4 * DAYS,
TTL_MAX: 14 * DAYS,
};
export const PROTOCOLS = {

@ -1,11 +1,14 @@
import { Message } from '.';
import { SignalService } from '../../../protobuf';
import { TTL_DEFAULT } from '../../constants';
export abstract class ContentMessage extends Message {
public plainTextBuffer(): Uint8Array {
return SignalService.Content.encode(this.contentProto()).finish();
}
public abstract ttl(): number;
public ttl(): number {
return TTL_DEFAULT.TTL_MAX;
}
public abstract contentProto(): SignalService.Content;
}

@ -10,8 +10,4 @@ export abstract class DataMessage extends ContentMessage {
dataMessage: this.dataProto(),
});
}
public ttl(): number {
return TTL_DEFAULT.REGULAR_MESSAGE;
}
}

@ -59,10 +59,6 @@ export class ConfigurationMessage extends ContentMessage {
}
}
public ttl(): number {
return Constants.TTL_DEFAULT.CONFIGURATION_MESSAGE;
}
public contentProto(): SignalService.Content {
return new SignalService.Content({
configurationMessage: this.configurationProto(),

@ -25,10 +25,6 @@ export class ExpirationTimerUpdateMessage extends DataMessage {
this.syncTarget = syncTarget ? PubKey.cast(syncTarget).key : undefined;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
public dataProto(): SignalService.DataMessage {
const data = new SignalService.DataMessage();

@ -34,8 +34,4 @@ export class ClosedGroupAddedMembersMessage extends ClosedGroupMessage {
return dataMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
}

@ -40,8 +40,4 @@ export class ClosedGroupEncryptionPairMessage extends ClosedGroupMessage {
return dataMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.ENCRYPTION_PAIR_GROUP;
}
}

@ -13,8 +13,4 @@ export class ClosedGroupEncryptionPairRequestMessage extends ClosedGroupMessage
return dataMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.ENCRYPTION_PAIR_GROUP;
}
}

@ -12,8 +12,4 @@ export class ClosedGroupMemberLeftMessage extends ClosedGroupMessage {
return dataMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
}

@ -32,8 +32,4 @@ export class ClosedGroupNameChangeMessage extends ClosedGroupMessage {
return dataMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
}

@ -33,8 +33,4 @@ export class ClosedGroupRemovedMembersMessage extends ClosedGroupMessage {
return dataMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
}

@ -14,10 +14,6 @@ export abstract class ReceiptMessage extends ContentMessage {
this.timestamps = timestamps;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
public abstract getReceiptType(): SignalService.ReceiptMessage.Type;
public contentProto(): SignalService.Content {

@ -23,11 +23,6 @@ export class ClosedGroupVisibleMessage extends ClosedGroupMessage {
});
this.chatMessage = params.chatMessage;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
public dataProto(): SignalService.DataMessage {
const dataProto = this.chatMessage.dataProto();

@ -26,10 +26,6 @@ export class GroupInvitationMessage extends DataMessage {
this.expireTimer = params.expireTimer;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
public dataProto(): SignalService.DataMessage {
const groupInvitation = new SignalService.DataMessage.GroupInvitation({
serverAddress: this.serverAddress,

@ -92,10 +92,6 @@ export class VisibleMessage extends DataMessage {
this.syncTarget = params.syncTarget;
}
public ttl(): number {
return Constants.TTL_DEFAULT.REGULAR_MESSAGE;
}
public dataProto(): SignalService.DataMessage {
const dataMessage = new SignalService.DataMessage();

@ -130,7 +130,7 @@ describe('VisibleMessage', () => {
const message = new VisibleMessage({
timestamp: Date.now(),
});
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX);
});
it('has an identifier', () => {

@ -50,7 +50,7 @@ describe('ClosedGroupVisibleMessage', () => {
groupId,
chatMessage,
});
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX);
});
it('has an identifier', () => {

@ -1,5 +1,6 @@
import { expect } from 'chai';
import { ECKeyPair } from '../../../../receiver/keypairs';
import { TTL_DEFAULT } from '../../../../session/constants';
import {
ConfigurationMessage,
@ -65,7 +66,7 @@ describe('ConfigurationMessage', () => {
contacts: [],
};
const configMessage = new ConfigurationMessage(params);
expect(configMessage.ttl()).to.be.equal(4 * 24 * 60 * 60 * 1000);
expect(configMessage.ttl()).to.be.equal(TTL_DEFAULT.TTL_MAX);
});
describe('ConfigurationMessageClosedGroup', () => {

@ -31,7 +31,7 @@ describe('GroupInvitationMessage', () => {
});
it('correct ttl', () => {
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
expect(message.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX);
});
it('has an identifier', () => {

@ -38,8 +38,8 @@ describe('ReceiptMessage', () => {
});
it('correct ttl', () => {
expect(readMessage.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
expect(deliveryMessage.ttl()).to.equal(Constants.TTL_DEFAULT.REGULAR_MESSAGE);
expect(readMessage.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX);
expect(deliveryMessage.ttl()).to.equal(Constants.TTL_DEFAULT.TTL_MAX);
});
it('has an identifier', () => {

Loading…
Cancel
Save