You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/ts/test/test-utils/utils/envelope.ts

32 lines
870 B
TypeScript

import { v4 as uuidv4 } from 'uuid';
import { SignalService } from '../../../protobuf';
import { EnvelopePlus } from '../../../receiver/types';
4 years ago
export function generateEnvelopePlusClosedGroup(groupId: string, sender: string): EnvelopePlus {
const envelope: EnvelopePlus = {
senderIdentity: sender,
receivedAt: Date.now(),
timestamp: Date.now() - 2000,
id: uuidv4(),
type: SignalService.Envelope.Type.CLOSED_GROUP_MESSAGE,
source: groupId,
content: new Uint8Array(),
};
4 years ago
return envelope;
4 years ago
}
export function generateEnvelopePlus(sender: string): EnvelopePlus {
const envelope: EnvelopePlus = {
receivedAt: Date.now(),
timestamp: Date.now() - 2000,
id: uuidv4(),
type: SignalService.Envelope.Type.SESSION_MESSAGE,
source: sender,
senderIdentity: sender,
content: new Uint8Array(),
};
return envelope;
}