mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Added a factory method for unrestricted groups.
This commit is contained in:
@@ -4,5 +4,9 @@ import java.io.IOException;
|
||||
|
||||
public interface GroupFactory {
|
||||
|
||||
/** Creates an unrestricted group. */
|
||||
Group createGroup(String name) throws IOException;
|
||||
|
||||
/** Creates a restricted group. */
|
||||
Group createGroup(String name, byte[] publicKey) throws IOException;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ class GroupFactoryImpl implements GroupFactory {
|
||||
this.writerFactory = writerFactory;
|
||||
}
|
||||
|
||||
public Group createGroup(String name) throws IOException {
|
||||
return createGroup(name, null);
|
||||
}
|
||||
|
||||
public Group createGroup(String name, byte[] publicKey) throws IOException {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
Writer w = writerFactory.createWriter(out);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
||||
new Random().nextBytes(secret);
|
||||
// Create two groups: one restricted, one unrestricted
|
||||
GroupFactory groupFactory = i.getInstance(GroupFactory.class);
|
||||
group = groupFactory.createGroup("Unrestricted group", null);
|
||||
group = groupFactory.createGroup("Unrestricted group");
|
||||
CryptoComponent crypto = i.getInstance(CryptoComponent.class);
|
||||
KeyPair groupKeyPair = crypto.generateSignatureKeyPair();
|
||||
group1 = groupFactory.createGroup("Restricted group",
|
||||
|
||||
Reference in New Issue
Block a user