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.
		
		
		
		
		
			
		
			
				
	
	
		
			30 lines
		
	
	
		
			849 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			30 lines
		
	
	
		
			849 B
		
	
	
	
		
			TypeScript
		
	
import { PubKey } from '../types';
 | 
						|
import { getConversationController } from '../conversations';
 | 
						|
import { fromHexToArray } from './String';
 | 
						|
 | 
						|
export function getGroupMembers(groupId: PubKey): Array<PubKey> {
 | 
						|
  const groupConversation = getConversationController().get(groupId.key);
 | 
						|
  const groupMembers = groupConversation ? groupConversation.get('members') : undefined;
 | 
						|
 | 
						|
  if (!groupMembers) {
 | 
						|
    return [];
 | 
						|
  }
 | 
						|
 | 
						|
  return groupMembers.map(PubKey.cast);
 | 
						|
}
 | 
						|
 | 
						|
export function isClosedGroup(groupId: PubKey): boolean {
 | 
						|
  const conversation = getConversationController().get(groupId.key);
 | 
						|
 | 
						|
  if (!conversation) {
 | 
						|
    return false;
 | 
						|
  }
 | 
						|
 | 
						|
  return Boolean(conversation.isClosedGroup());
 | 
						|
}
 | 
						|
 | 
						|
export function encodeGroupPubKeyFromHex(hexGroupPublicKey: string | PubKey) {
 | 
						|
  const pubkey = PubKey.cast(hexGroupPublicKey);
 | 
						|
  return fromHexToArray(pubkey.key);
 | 
						|
}
 |