pub fn create_group(&self, ciphersuite: &Ciphersuite) -> Result<GroupId, SetupError> {
        // Pick a random group creator.
        let clients = self.clients.borrow();
        let group_creator_id = ((OsRng.next_u32() as usize) % clients.len())
            .to_be_bytes()
            .to_vec();
        let group_creator = clients.get(&group_creator_id).unwrap().borrow();
        let mut groups = self.groups.borrow_mut();
        let group_id = GroupId::from_slice(&groups.len().to_string().into_bytes());

        group_creator.create_group(group_id.clone(), self.default_mgc.clone(), ciphersuite)?;
        let creator_groups = group_creator.groups.borrow();
        let group = creator_groups.get(&group_id).unwrap();
        let public_tree = group.export_ratchet_tree();
        let exporter_secret = group.export_secret(&group_creator.crypto, "test", &[], 32)?;
        let member_ids = vec![(0, group_creator_id)];
        let group = Group {
            group_id: group_id.clone(),
            members: member_ids,
            ciphersuite: ciphersuite.clone(),
            group_config: self.default_mgc.clone(),
            public_tree,
            exporter_secret,
        };
        groups.insert(group_id.clone(), group);
        Ok(group_id)
    }
/// Have a random client create a new group with ciphersuite `ciphersuite`
/// and return the `GroupId`. Only works reliably if all clients support all
/// ciphersuites, as it will throw an error if the randomly chosen client
/// does not support the given ciphersuite. TODO #310: Fix to always work
/// reliably, probably by introducing a mapping from ciphersuite to the set
/// of client ids supporting it.
Have a random client create a new group with ciphersuite `ciphersuite`
and return the `GroupId`. Only works reliably if all clients support all
ciphersuites, as it will throw an error if the randomly chosen client
does not support the given ciphersuite. TODO #310: Fix to always work
reliably, probably by introducing a mapping from ciphersuite to the set
of client ids supporting it.
Have a random client create a new group with ciphersuite ` ciphersuite ` and return the ` GroupId ` . Only works reliably if all clients support all ciphersuites as it will throw an error if the randomly chosen client does not support the given ciphersuite . TODO #310 : Fix to always work reliably probably by introducing a mapping from ciphersuite to the set of client ids supporting it .
pub fn create_group(&self, ciphersuite: &Ciphersuite) -> Result<GroupId, SetupError> {
        // Pick a random group creator.
        let clients = self.clients.borrow();
        let group_creator_id = ((OsRng.next_u32() as usize) % clients.len())
            .to_be_bytes()
            .to_vec();
        let group_creator = clients.get(&group_creator_id).unwrap().borrow();
        let mut groups = self.groups.borrow_mut();
        let group_id = GroupId::from_slice(&groups.len().to_string().into_bytes());
        group_creator.create_group(group_id.clone(), self.default_mgc.clone(), ciphersuite)?;
        let creator_groups = group_creator.groups.borrow();
        let group = creator_groups.get(&group_id).unwrap();
        let public_tree = group.export_ratchet_tree();
        let exporter_secret = group.export_secret(&group_creator.crypto, "test", &[], 32)?;
        let member_ids = vec![(0, group_creator_id)];
        let group = Group {
            group_id: group_id.clone(),
            members: member_ids,
            ciphersuite: ciphersuite.clone(),
            group_config: self.default_mgc.clone(),
            public_tree,
            exporter_secret,
        };
        groups.insert(group_id.clone(), group);
        Ok(group_id)
    }
pub fn create_group ( & self , ciphersuite : & Ciphersuite ) -> Result < GroupId , SetupError > { // Pick a random group creator. let clients = self . clients . borrow ( ) ; let group_creator_id = ( ( OsRng . next_u32 ( ) as usize ) % clients . len ( ) ) . to_be_bytes ( ) . to_vec ( ) ; let group_creator = clients . get ( & group_creator_id ) . unwrap ( ) . borrow ( ) ; let mut groups = self . groups . borrow_mut ( ) ; let group_id = GroupId :: from_slice ( & groups . len ( ) . to_string ( ) . into_bytes ( ) ) ; group_creator . create_group ( group_id . clone ( ) , self . default_mgc . clone ( ) , ciphersuite ) ? ; let creator_groups = group_creator . groups . borrow ( ) ; let group = creator_groups . get ( & group_id ) . unwrap ( ) ; let public_tree = group . export_ratchet_tree ( ) ; let exporter_secret = group . export_secret ( & group_creator . crypto , " " , & [ ] , 32 ) ? ; let member_ids = vec ! [ ( 0 group_creator_id ) ] ; let group = Group { group_id : group_id . clone ( ) , members : member_ids , ciphersuite : ciphersuite . clone ( ) , group_config : self . default_mgc . clone ( ) , public_tree , exporter_secret , } ; groups . insert ( group_id . clone ( ) , group ) ; Ok ( group_id ) }
Have a random client create a new group with ciphersuite `ciphersuite`
and return the `GroupId`.
Have a random client create a new group with ciphersuite ` ciphersuite ` and return the ` GroupId ` .
&self
ciphersuite
&Ciphersuite
&self
ciphersuite
&Ciphersuite