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.
26 lines
1020 B
TypeScript
26 lines
1020 B
TypeScript
4 years ago
|
import { SignalService } from '../../../../../protobuf';
|
||
|
import { fromHexToArray } from '../../../../utils/String';
|
||
4 years ago
|
import { ClosedGroupEncryptionPairMessage } from './ClosedGroupEncryptionPairMessage';
|
||
|
|
||
|
/**
|
||
|
* On Desktop, we need separate class for message being sent to a closed group or a private chat.
|
||
|
*
|
||
|
* This is because we use the class of the message to know what encryption to use.
|
||
|
* See toRawMessage();
|
||
|
*
|
||
|
* This class is just used to let us send the encryption key par after we receivied a ENCRYPTION_KEYPAIR_REQUEST
|
||
|
* from a member of a group.
|
||
|
* This reply must be sent to this user's pubkey, and so be encoded using sessionProtocol.
|
||
|
*/
|
||
|
export class ClosedGroupEncryptionPairReplyMessage extends ClosedGroupEncryptionPairMessage {
|
||
|
public dataProto(): SignalService.DataMessage {
|
||
|
const dataMessage = super.dataProto();
|
||
|
// tslint:disable: no-non-null-assertion
|
||
|
dataMessage.closedGroupControlMessage!.publicKey = fromHexToArray(
|
||
|
this.groupId.key
|
||
|
);
|
||
|
|
||
|
return dataMessage;
|
||
|
}
|
||
|
}
|