mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-24 00:29:52 +01:00
Fix rebasing mistakes.
This commit is contained in:
@@ -24,7 +24,7 @@ public abstract class ValidatorTestCase extends BrambleMockTestCase {
|
||||
context.mock(MetadataEncoder.class);
|
||||
protected final Clock clock = context.mock(Clock.class);
|
||||
|
||||
protected final Group group = getGroup(getClientId());
|
||||
protected final Group group = getGroup(getClientId(), 123);
|
||||
protected final GroupId groupId = group.getId();
|
||||
protected final byte[] descriptor = group.getDescriptor();
|
||||
protected final Message message = getMessage(groupId);
|
||||
|
||||
@@ -29,7 +29,7 @@ import static org.briarproject.briar.api.introduction.IntroductionConstants.LABE
|
||||
import static org.briarproject.briar.api.introduction.IntroductionConstants.LABEL_BOB_MAC_KEY;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionConstants.LABEL_MASTER_KEY;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionConstants.LABEL_SESSION_ID;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionManager.CLIENT_VERSION;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionManager.MAJOR_VERSION;
|
||||
import static org.briarproject.briar.introduction.IntroduceeSession.Local;
|
||||
|
||||
@Immutable
|
||||
@@ -94,7 +94,7 @@ class IntroductionCryptoImpl implements IntroductionCrypto {
|
||||
LABEL_MASTER_KEY,
|
||||
remoteEphemeralPublicKey,
|
||||
keyPair,
|
||||
new byte[] {CLIENT_VERSION},
|
||||
new byte[] {MAJOR_VERSION},
|
||||
alice ? publicKey : remotePublicKey,
|
||||
alice ? remotePublicKey : publicKey
|
||||
);
|
||||
|
||||
@@ -42,13 +42,11 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||
import static org.briarproject.briar.api.introduction.Role.INTRODUCEE;
|
||||
import static org.briarproject.briar.api.introduction.Role.INTRODUCER;
|
||||
import static org.briarproject.briar.introduction.IntroducerState.START;
|
||||
@@ -66,9 +64,6 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
implements IntroductionManager, Client, ContactHook,
|
||||
ClientVersioningHook {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(IntroductionManagerImpl.class.getName());
|
||||
|
||||
private final ClientVersioningManager clientVersioningManager;
|
||||
private final ContactGroupFactory contactGroupFactory;
|
||||
private final ContactManager contactManager;
|
||||
@@ -83,8 +78,12 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
private final Group localGroup;
|
||||
|
||||
@Inject
|
||||
IntroductionManagerImpl(DatabaseComponent db, ClientHelper clientHelper,
|
||||
ClientVersioningManager clientVersioningManager,MetadataParser metadataParser, MessageTracker messageTracker,
|
||||
IntroductionManagerImpl(
|
||||
DatabaseComponent db,
|
||||
ClientHelper clientHelper,
|
||||
ClientVersioningManager clientVersioningManager,
|
||||
MetadataParser metadataParser,
|
||||
MessageTracker messageTracker,
|
||||
ContactGroupFactory contactGroupFactory,
|
||||
ContactManager contactManager,
|
||||
MessageParser messageParser,
|
||||
@@ -106,7 +105,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
this.crypto = crypto;
|
||||
this.identityManager = identityManager;
|
||||
this.localGroup =
|
||||
contactGroupFactory.createLocalGroup(CLIENT_ID, CLIENT_VERSION);
|
||||
contactGroupFactory.createLocalGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,7 +143,6 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
abortOrRemoveSessionWithIntroducee(txn, c);
|
||||
|
||||
// Remove the contact group (all messages will be removed with it)
|
||||
|
||||
db.removeGroup(txn, getContactGroup(c));
|
||||
}
|
||||
|
||||
@@ -159,7 +157,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
@Override
|
||||
public Group getContactGroup(Contact c) {
|
||||
return contactGroupFactory
|
||||
.createContactGroup(CLIENT_ID, CLIENT_VERSION, c);
|
||||
.createContactGroup(CLIENT_ID, MAJOR_VERSION, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,7 +167,6 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
MessageMetadata meta = messageParser.parseMetadata(bdfMeta);
|
||||
// Look up the session, if there is one
|
||||
SessionId sessionId = meta.getSessionId();
|
||||
|
||||
IntroduceeSession newIntroduceeSession = null;
|
||||
if (sessionId == null) {
|
||||
if (meta.getMessageType() != REQUEST) throw new AssertionError();
|
||||
@@ -410,11 +407,10 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
Contact contact = db.getContact(txn, c);
|
||||
GroupId contactGroupId = getContactGroup(contact).getId();
|
||||
BdfDictionary query = messageParser.getMessagesVisibleInUiQuery();
|
||||
Map<MessageId, BdfDictionary> results = clientHelper.getMessageMetadataAsDictionary(txn, contactGroupId, query);
|
||||
Map<MessageId, BdfDictionary> results = clientHelper
|
||||
.getMessageMetadataAsDictionary(txn, contactGroupId, query);
|
||||
messages = new ArrayList<>(results.size());
|
||||
for (Entry<
|
||||
MessageId ,
|
||||
BdfDictionary > e : results.entrySet()) {
|
||||
for (Entry<MessageId, BdfDictionary> e : results.entrySet()) {
|
||||
MessageId m = e.getKey();
|
||||
MessageMetadata meta =
|
||||
messageParser.parseMetadata(e.getValue());
|
||||
@@ -445,7 +441,8 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
return messages;
|
||||
}
|
||||
|
||||
private IntroductionRequest parseInvitationRequest(Transaction txn, GroupId contactGroupId, MessageId m, MessageMetadata meta,
|
||||
private IntroductionRequest parseInvitationRequest(Transaction txn,
|
||||
GroupId contactGroupId, MessageId m, MessageMetadata meta,
|
||||
MessageStatus status, BdfDictionary bdfSession)
|
||||
throws DbException, FormatException {
|
||||
Role role = sessionParser.getRole(bdfSession);
|
||||
@@ -532,13 +529,13 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
Map<MessageId, BdfDictionary> sessions;
|
||||
try {
|
||||
sessions = clientHelper
|
||||
.getMessageMetadataAsDictionary(txn,
|
||||
localGroup.getId(),
|
||||
.getMessageMetadataAsDictionary(txn, localGroup.getId(),
|
||||
query);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException();
|
||||
}
|
||||
LocalAuthor localAuthor = identityManager.getLocalAuthor(txn);for (Entry<MessageId, BdfDictionary> session : sessions.entrySet()) {
|
||||
LocalAuthor localAuthor = identityManager.getLocalAuthor(txn);
|
||||
for (Entry<MessageId, BdfDictionary> session : sessions.entrySet()) {
|
||||
IntroducerSession s;
|
||||
try {
|
||||
s = sessionParser.parseIntroducerSession(session.getValue());
|
||||
|
||||
@@ -25,12 +25,14 @@ import javax.inject.Inject;
|
||||
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAC_BYTES;
|
||||
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAX_SIGNATURE_BYTES;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
|
||||
import static org.briarproject.bramble.test.TestUtils.getGroup;
|
||||
import static org.briarproject.bramble.test.TestUtils.getRandomBytes;
|
||||
import static org.briarproject.bramble.test.TestUtils.getRandomId;
|
||||
import static org.briarproject.bramble.test.TestUtils.getTransportPropertiesMap;
|
||||
import static org.briarproject.bramble.util.StringUtils.getRandomString;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionConstants.MAX_REQUEST_MESSAGE_LENGTH;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionManager.CLIENT_ID;
|
||||
import static org.briarproject.briar.api.introduction.IntroductionManager.MAJOR_VERSION;
|
||||
import static org.briarproject.briar.introduction.MessageType.ABORT;
|
||||
import static org.briarproject.briar.introduction.MessageType.REQUEST;
|
||||
import static org.briarproject.briar.test.BriarTestUtils.getRealAuthor;
|
||||
@@ -57,8 +59,8 @@ public class MessageEncoderParserIntegrationTest extends BrambleTestCase {
|
||||
private final MessageParser messageParser;
|
||||
private final IntroductionValidator validator;
|
||||
|
||||
private final GroupId groupId = new GroupId(getRandomId());
|
||||
private final Group group = new Group(groupId, CLIENT_ID, getRandomId());
|
||||
private final Group group = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final GroupId groupId = group.getId();
|
||||
private final long timestamp = 42L;
|
||||
private final SessionId sessionId = new SessionId(getRandomId());
|
||||
private final MessageId previousMsgId = new MessageId(getRandomId());
|
||||
|
||||
Reference in New Issue
Block a user