mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Add initial API for rendezvous plugins.
This commit is contained in:
@@ -5,7 +5,7 @@ import org.briarproject.bramble.api.data.BdfList;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An class for managing a particular key agreement listener.
|
||||
* Accepts key agreement connections over a given transport.
|
||||
*/
|
||||
public abstract class KeyAgreementListener {
|
||||
|
||||
|
||||
@@ -36,4 +36,9 @@ public interface PluginManager {
|
||||
* Returns any duplex plugins that support key agreement.
|
||||
*/
|
||||
Collection<DuplexPlugin> getKeyAgreementPlugins();
|
||||
|
||||
/**
|
||||
* Returns any duplex plugins that support rendezvous.
|
||||
*/
|
||||
Collection<DuplexPlugin> getRendezvousPlugins();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import org.briarproject.bramble.api.keyagreement.KeyAgreementListener;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.Plugin;
|
||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||
import org.briarproject.bramble.api.rendezvous.KeyMaterialSource;
|
||||
import org.briarproject.bramble.api.rendezvous.RendezvousHandler;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -40,4 +42,15 @@ public interface DuplexPlugin extends Plugin {
|
||||
@Nullable
|
||||
DuplexTransportConnection createKeyAgreementConnection(
|
||||
byte[] remoteCommitment, BdfList descriptor);
|
||||
|
||||
/**
|
||||
* Returns true if the plugin supports rendezvous connections.
|
||||
*/
|
||||
boolean supportsRendezvous();
|
||||
|
||||
/**
|
||||
* Creates and returns a handler that uses the given key material to
|
||||
* rendezvous with a pending contact.
|
||||
*/
|
||||
RendezvousHandler createRendezvousHandler(KeyMaterialSource k);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.briarproject.bramble.api.rendezvous;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
/**
|
||||
* A source of key material for use in making rendezvous connections.
|
||||
*/
|
||||
@NotNullByDefault
|
||||
public interface KeyMaterialSource {
|
||||
|
||||
/**
|
||||
* Returns the requested amount of key material.
|
||||
*/
|
||||
byte[] getKeyMaterial(int length);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.briarproject.bramble.api.rendezvous;
|
||||
|
||||
public interface RendezvousConstants {
|
||||
|
||||
/**
|
||||
* Label for deriving key material from the master key.
|
||||
*/
|
||||
String KEY_MATERIAL_LABEL =
|
||||
"org.briarproject.bramble.rendezvous/KEY_MATERIAL";
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.briarproject.bramble.api.rendezvous;
|
||||
|
||||
import org.briarproject.bramble.api.crypto.SecretKey;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.TransportId;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface RendezvousCrypto {
|
||||
|
||||
KeyMaterialSource createKeyMaterialSource(SecretKey masterKey,
|
||||
TransportId t);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.briarproject.bramble.api.rendezvous;
|
||||
|
||||
import org.briarproject.bramble.api.properties.TransportProperties;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* An interface for making and accepting rendezvous connections with a pending
|
||||
* contact over a given transport.
|
||||
*/
|
||||
public interface RendezvousHandler {
|
||||
|
||||
/**
|
||||
* Returns a set of transport properties for connecting to the pending
|
||||
* contact.
|
||||
*/
|
||||
TransportProperties getRemoteTransportProperties();
|
||||
|
||||
/**
|
||||
* Closes the handler and releases any resources held by it, such as
|
||||
* network sockets.
|
||||
*/
|
||||
void close() throws IOException;
|
||||
}
|
||||
Reference in New Issue
Block a user