Return a contact, encapsulate contact exchange crypto.

This commit is contained in:
akwizgran
2019-05-24 11:40:12 +01:00
parent 5be0e928c4
commit f1e5c2dd66
8 changed files with 164 additions and 70 deletions

View File

@@ -3,7 +3,6 @@ package org.briarproject.bramble.api.contact;
import org.briarproject.bramble.api.crypto.SecretKey;
import org.briarproject.bramble.api.db.ContactExistsException;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.identity.Author;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.plugin.TransportId;
import org.briarproject.bramble.api.plugin.duplex.DuplexTransportConnection;
@@ -16,9 +15,10 @@ public interface ContactExchangeManager {
/**
* Exchanges contact information with a remote peer.
*
* @return The contact's pseudonym
* @param alice Whether the local peer takes the role of Alice
* @return The newly added contact
* @throws ContactExistsException If the contact already exists
*/
Author exchangeContacts(TransportId t, DuplexTransportConnection conn,
Contact exchangeContacts(TransportId t, DuplexTransportConnection conn,
SecretKey masterKey, boolean alice) throws IOException, DbException;
}

View File

@@ -93,6 +93,11 @@ public interface ContactManager {
*/
Contact getContact(ContactId c) throws DbException;
/**
* Returns the contact with the given ID.
*/
Contact getContact(Transaction txn, ContactId c) throws DbException;
/**
* Returns the contact with the given remoteAuthorId
* that was added by the LocalAuthor with the given localAuthorId