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.
		
		
		
		
		
			
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
| import { SignalService } from '../../../../../protobuf';
 | |
| import { PubKey } from '../../../../types';
 | |
| import { DataMessage } from '../../DataMessage';
 | |
| import { MessageParams } from '../../Message';
 | |
| 
 | |
| export interface ClosedGroupMessageParams extends MessageParams {
 | |
|   groupId: string | PubKey;
 | |
| }
 | |
| 
 | |
| export abstract class ClosedGroupMessage extends DataMessage {
 | |
|   public readonly groupId: PubKey;
 | |
| 
 | |
|   constructor(params: ClosedGroupMessageParams) {
 | |
|     super({
 | |
|       timestamp: params.timestamp,
 | |
|       identifier: params.identifier,
 | |
|     });
 | |
| 
 | |
|     this.groupId = PubKey.cast(params.groupId);
 | |
|     if (!this.groupId || this.groupId.key.length === 0) {
 | |
|       throw new Error('groupId must be set');
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   public static areAdminsMembers(admins: Array<string>, members: Array<string>) {
 | |
|     return admins.every(a => members.includes(a));
 | |
|   }
 | |
| 
 | |
|   public dataProto(): SignalService.DataMessage {
 | |
|     const dataMessage = new SignalService.DataMessage();
 | |
| 
 | |
|     dataMessage.closedGroupControlMessage = new SignalService.DataMessage.ClosedGroupControlMessage();
 | |
| 
 | |
|     return dataMessage;
 | |
|   }
 | |
| }
 |