mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
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.
This commit is contained in:
@@ -31,6 +31,7 @@ import org.briarproject.event.EventModule;
|
||||
import org.briarproject.forum.ForumModule;
|
||||
import org.briarproject.identity.IdentityModule;
|
||||
import org.briarproject.messaging.MessagingModule;
|
||||
import org.briarproject.transport.TransportModule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -57,7 +58,8 @@ public class ConstantsTest extends BriarTestCase {
|
||||
new TestLifecycleModule(), new TestSystemModule(),
|
||||
new ContactModule(), new CryptoModule(), new DatabaseModule(),
|
||||
new DataModule(), new EventModule(), new ForumModule(),
|
||||
new IdentityModule(), new MessagingModule(), new SyncModule());
|
||||
new IdentityModule(), new MessagingModule(), new SyncModule(),
|
||||
new TransportModule());
|
||||
crypto = i.getInstance(CryptoComponent.class);
|
||||
authorFactory = i.getInstance(AuthorFactory.class);
|
||||
privateMessageFactory = i.getInstance(PrivateMessageFactory.class);
|
||||
|
||||
@@ -135,9 +135,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
Author bobAuthor = new Author(bobId, "Bob",
|
||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||
ContactId contactId = contactManager.addContact(bobAuthor, aliceId,
|
||||
true);
|
||||
// Derive and store the transport keys
|
||||
keyManager.addContact(contactId, master, timestamp, true);
|
||||
master, timestamp, true, true);
|
||||
|
||||
// Send Bob a message
|
||||
GroupId groupId = messagingManager.getConversationId(contactId);
|
||||
@@ -206,9 +204,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
Author aliceAuthor = new Author(aliceId, "Alice",
|
||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||
ContactId contactId = contactManager.addContact(aliceAuthor, bobId,
|
||||
true);
|
||||
// Derive and store the transport keys
|
||||
keyManager.addContact(contactId, master, timestamp, false);
|
||||
master, timestamp, false, true);
|
||||
|
||||
// Set up an event listener
|
||||
MessageListener listener = new MessageListener();
|
||||
|
||||
Reference in New Issue
Block a user