mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 07:09:56 +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 {
|
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;
|
Group createGroup(String name, byte[] publicKey) throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ class GroupFactoryImpl implements GroupFactory {
|
|||||||
this.writerFactory = writerFactory;
|
this.writerFactory = writerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Group createGroup(String name) throws IOException {
|
||||||
|
return createGroup(name, null);
|
||||||
|
}
|
||||||
|
|
||||||
public Group createGroup(String name, byte[] publicKey) throws IOException {
|
public Group createGroup(String name, byte[] publicKey) throws IOException {
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
Writer w = writerFactory.createWriter(out);
|
Writer w = writerFactory.createWriter(out);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
|||||||
new Random().nextBytes(secret);
|
new Random().nextBytes(secret);
|
||||||
// Create two groups: one restricted, one unrestricted
|
// Create two groups: one restricted, one unrestricted
|
||||||
GroupFactory groupFactory = i.getInstance(GroupFactory.class);
|
GroupFactory groupFactory = i.getInstance(GroupFactory.class);
|
||||||
group = groupFactory.createGroup("Unrestricted group", null);
|
group = groupFactory.createGroup("Unrestricted group");
|
||||||
CryptoComponent crypto = i.getInstance(CryptoComponent.class);
|
CryptoComponent crypto = i.getInstance(CryptoComponent.class);
|
||||||
KeyPair groupKeyPair = crypto.generateSignatureKeyPair();
|
KeyPair groupKeyPair = crypto.generateSignatureKeyPair();
|
||||||
group1 = groupFactory.createGroup("Restricted group",
|
group1 = groupFactory.createGroup("Restricted group",
|
||||||
|
|||||||
Reference in New Issue
Block a user