mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Merge branch 'add-contact-transaction' into 'master'
Add contact and transport keys in the same transaction This avoids a potential problem where the app crashes after adding the contact but before adding the transport keys, leaving the contact unusable. See merge request !112
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.api.contact;
|
||||
|
||||
import org.briarproject.api.crypto.SecretKey;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.identity.Author;
|
||||
@@ -19,8 +20,8 @@ public interface ContactManager {
|
||||
* Stores a contact associated with the given local and remote pseudonyms,
|
||||
* and returns an ID for the contact.
|
||||
*/
|
||||
ContactId addContact(Author remote, AuthorId local, boolean active)
|
||||
throws DbException;
|
||||
ContactId addContact(Author remote, AuthorId local, SecretKey master,
|
||||
long timestamp, boolean alice, boolean active) throws DbException;
|
||||
|
||||
/** Returns the contact with the given ID. */
|
||||
Contact getContact(ContactId c) throws DbException;
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.briarproject.api.transport;
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.crypto.SecretKey;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
|
||||
/**
|
||||
* Responsible for managing transport keys and recognising the pseudo-random
|
||||
@@ -16,8 +18,8 @@ public interface KeyManager {
|
||||
* {@link StreamContext StreamContexts} for the contact can be created
|
||||
* after this method has returned.
|
||||
*/
|
||||
void addContact(ContactId c, SecretKey master, long timestamp,
|
||||
boolean alice);
|
||||
void addContact(Transaction txn, ContactId c, SecretKey master,
|
||||
long timestamp, boolean alice) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a {@link StreamContext} for sending a stream to the given
|
||||
|
||||
Reference in New Issue
Block a user