async def create_batch_and_listen(cls, is_secure: bool, number: int) -> Tuple[BasicHost, ...]: key_pairs = [generate_new_rsa_identity() for _ in range(number)] swarms = await asyncio.gather(*[ SwarmFactory.create_and_listen(is_secure, key_pair) for key_pair in key_pairs ]) return tuple( BasicHost(key_pair.public_key, swarm) for key_pair, swarm in zip(key_pairs, swarms))
def default_key_pair_factory() -> KeyPair: return generate_new_rsa_identity()
def swarm_factory(is_secure: bool): key_pair = generate_new_rsa_identity() sec_opt = security_transport_factory(is_secure, key_pair) return initialize_default_swarm(key_pair, sec_opt=sec_opt)
def SwarmFactory(is_secure: bool, muxer_opt: TMuxerOptions = None) -> Swarm: key_pair = generate_new_rsa_identity() sec_opt = security_transport_factory(is_secure, key_pair) return initialize_default_swarm(key_pair, sec_opt=sec_opt, muxer_opt=muxer_opt)