Add a method for binding transport keys to a contact.

This commit is contained in:
akwizgran
2018-03-27 17:01:39 +01:00
parent 5bd2092a03
commit 17fe358fd9
11 changed files with 139 additions and 32 deletions

View File

@@ -110,6 +110,12 @@ public interface DatabaseComponent {
KeySetId addTransportKeys(Transaction txn, @Nullable ContactId c,
TransportKeys k) throws DbException;
/**
* Binds the given keys for the given transport to the given contact.
*/
void bindTransportKeys(Transaction txn, ContactId c, TransportId t,
KeySetId k) throws DbException;
/**
* Returns true if the database contains the given contact for the given
* local pseudonym.

View File

@@ -6,7 +6,7 @@ import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.Transaction;
import org.briarproject.bramble.api.plugin.TransportId;
import java.util.Collection;
import java.util.Map;
import javax.annotation.Nullable;
@@ -31,9 +31,15 @@ public interface KeyManager {
* Derives and stores a set of unbound transport keys for each transport
* and returns the key set IDs.
*/
Collection<KeySetId> addUnboundKeys(Transaction txn, SecretKey master,
Map<TransportId, KeySetId> addUnboundKeys(Transaction txn, SecretKey master,
long timestamp, boolean alice) throws DbException;
/**
* Binds the given transport keys to the given contact.
*/
void bindKeys(Transaction txn, ContactId c, Map<TransportId, KeySetId> keys)
throws DbException;
/**
* Returns a {@link StreamContext} for sending a stream to the given
* contact over the given transport, or null if an error occurs or the