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.
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { SyncMessage } from './SyncMessage';
|
|
import { SignalService } from '../../../../../protobuf';
|
|
import { MessageParams } from '../../Message';
|
|
import { PubKey } from '../../../../types';
|
|
|
|
interface VerifiedSyncMessageParams extends MessageParams {
|
|
padding: Buffer;
|
|
identityKey: Uint8Array;
|
|
destination: PubKey;
|
|
state: SignalService.Verified.State;
|
|
}
|
|
|
|
export abstract class VerifiedSyncMessage extends SyncMessage {
|
|
public readonly state: SignalService.Verified.State;
|
|
public readonly destination: PubKey;
|
|
public readonly identityKey: Uint8Array;
|
|
public readonly padding: Buffer;
|
|
|
|
constructor(params: VerifiedSyncMessageParams) {
|
|
super({ timestamp: params.timestamp, identifier: params.identifier });
|
|
this.state = params.state;
|
|
this.destination = params.destination;
|
|
this.identityKey = params.identityKey;
|
|
this.padding = params.padding;
|
|
}
|
|
|
|
protected syncProto(): SignalService.SyncMessage {
|
|
const syncMessage = super.syncProto();
|
|
syncMessage.verified = new SignalService.Verified();
|
|
syncMessage.verified.state = this.state;
|
|
syncMessage.verified.destination = this.destination.key;
|
|
syncMessage.verified.identityKey = this.identityKey;
|
|
syncMessage.verified.nullMessage = this.padding;
|
|
|
|
return syncMessage;
|
|
}
|
|
}
|