mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
@@ -337,12 +337,12 @@ public class BlogManagerTest {
|
||||
// sharer adds invitee as contact
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// invitee adds sharer back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -362,11 +362,11 @@ public class BlogSharingIntegrationTest extends BriarTestCase {
|
||||
// 1 and 2 are adding each other
|
||||
contactManager1.addContact(author2,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactManager2.addContact(author1,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertEquals(3, blogManager1.getBlogs().size());
|
||||
|
||||
@@ -489,11 +489,11 @@ public class BlogSharingIntegrationTest extends BriarTestCase {
|
||||
// 1 and 2 are adding each other
|
||||
contactManager1.addContact(author2,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactManager2.addContact(author1,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertEquals(3, blogManager1.getBlogs().size());
|
||||
|
||||
@@ -671,24 +671,24 @@ public class BlogSharingIntegrationTest extends BriarTestCase {
|
||||
// sharer adds invitee as contact
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contact1 = contactManager0.getContact(contactId1);
|
||||
// sharer adds second contact
|
||||
contactId2 = contactManager0.addContact(author2,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contact2 = contactManager0.getContact(contactId2);
|
||||
// contacts add sharer back
|
||||
contactId01 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contact01 = contactManager1.getContact(contactId01);
|
||||
contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contact02 = contactManager2.getContact(contactId02);
|
||||
}
|
||||
|
||||
@@ -365,12 +365,12 @@ public class ForumManagerTest {
|
||||
// sharer adds invitee as contact
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// invitee adds sharer back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1091,21 +1091,21 @@ public class ForumSharingIntegrationTest extends BriarTestCase {
|
||||
// sharer adds invitee as contact
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// second sharer does the same
|
||||
contactId21 = contactManager2.addContact(author1,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// invitee adds sharers back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactId2 = contactManager1.addContact(author2,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,20 +164,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
@@ -238,6 +238,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
assertTrue(contactManager2
|
||||
.contactExists(author1.getId(), author2.getId()));
|
||||
|
||||
// make sure that introduced contacts are not verified
|
||||
for (Contact c : contactManager1.getActiveContacts()) {
|
||||
if (c.getAuthor().equals(author2)) {
|
||||
assertFalse(c.isVerified());
|
||||
}
|
||||
}
|
||||
for (Contact c : contactManager2.getActiveContacts()) {
|
||||
if (c.getAuthor().equals(author1)) {
|
||||
assertFalse(c.isVerified());
|
||||
}
|
||||
}
|
||||
|
||||
assertDefaultUiMessages();
|
||||
} finally {
|
||||
stopLifecycles();
|
||||
@@ -256,18 +268,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
@@ -349,18 +361,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||
master, clock.currentTimeMillis(), false, true
|
||||
master, clock.currentTimeMillis(), false, true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), false,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
@@ -437,18 +449,18 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||
master, clock.currentTimeMillis(), false, true
|
||||
master, clock.currentTimeMillis(), false, true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), false,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
@@ -516,11 +528,11 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
|
||||
// Add introducee as contact
|
||||
contactId1 = contactManager0.addContact(author1, author0.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0, author1.getId(),
|
||||
master, clock.currentTimeMillis(), true, true
|
||||
master, clock.currentTimeMillis(), true, true, true
|
||||
);
|
||||
|
||||
// listen to events
|
||||
@@ -573,21 +585,21 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
// Add introducees' authors as contacts
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = null;
|
||||
ContactId contactId01 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), false,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager1.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), false,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
|
||||
// listen to events
|
||||
@@ -667,20 +679,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
@@ -764,20 +776,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
@@ -850,20 +862,20 @@ public class IntroductionIntegrationTest extends BriarTestCase {
|
||||
// Add introducees as contacts
|
||||
contactId1 = contactManager0.addContact(author1,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
contactId2 = contactManager0.addContact(author2,
|
||||
author0.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
// Add introducer back
|
||||
contactId0 = contactManager1.addContact(author0,
|
||||
author1.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
ContactId contactId02 = contactManager2.addContact(author0,
|
||||
author2.getId(), master, clock.currentTimeMillis(), true,
|
||||
true
|
||||
true, true
|
||||
);
|
||||
assertTrue(contactId0.equals(contactId02));
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
Author bobAuthor = new Author(bobId, "Bob",
|
||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||
ContactId contactId = contactManager.addContact(bobAuthor, aliceId,
|
||||
master, timestamp, true, true);
|
||||
master, timestamp, true, true, true);
|
||||
|
||||
// Send Bob a message
|
||||
GroupId groupId = messagingManager.getConversationId(contactId);
|
||||
@@ -146,7 +146,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
Author aliceAuthor = new Author(aliceId, "Alice",
|
||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||
ContactId contactId = contactManager.addContact(aliceAuthor, bobId,
|
||||
master, timestamp, false, true);
|
||||
master, timestamp, false, true, true);
|
||||
|
||||
// Set up an event listener
|
||||
MessageListener listener = new MessageListener();
|
||||
|
||||
@@ -8,13 +8,14 @@ public class Contact {
|
||||
private final ContactId id;
|
||||
private final Author author;
|
||||
private final AuthorId localAuthorId;
|
||||
private final boolean active;
|
||||
private final boolean verified, active;
|
||||
|
||||
public Contact(ContactId id, Author author, AuthorId localAuthorId,
|
||||
boolean active) {
|
||||
boolean verified, boolean active) {
|
||||
this.id = id;
|
||||
this.author = author;
|
||||
this.localAuthorId = localAuthorId;
|
||||
this.verified = verified;
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
@@ -30,6 +31,10 @@ public class Contact {
|
||||
return localAuthorId;
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
return verified;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
@@ -21,16 +21,16 @@ public interface ContactManager {
|
||||
* local and remote pseudonyms, and returns an ID for the contact.
|
||||
*/
|
||||
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||
SecretKey master, long timestamp, boolean alice, boolean active)
|
||||
throws DbException;
|
||||
SecretKey master, long timestamp, boolean alice, boolean verified,
|
||||
boolean active) throws DbException;
|
||||
|
||||
/**
|
||||
* Stores a contact associated with the given local and remote pseudonyms,
|
||||
* and returns an ID for the contact.
|
||||
*/
|
||||
ContactId addContact(Author remote, AuthorId local,
|
||||
SecretKey master, long timestamp, boolean alice, boolean active)
|
||||
throws DbException;
|
||||
SecretKey master, long timestamp, boolean alice, boolean verified,
|
||||
boolean active) throws DbException;
|
||||
|
||||
/** Returns the contact with the given ID. */
|
||||
Contact getContact(ContactId c) throws DbException;
|
||||
|
||||
@@ -62,7 +62,7 @@ public interface DatabaseComponent {
|
||||
* and returns an ID for the contact.
|
||||
*/
|
||||
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||
boolean active) throws DbException;
|
||||
boolean verified, boolean active) throws DbException;
|
||||
|
||||
/**
|
||||
* Stores a group.
|
||||
@@ -423,6 +423,12 @@ public interface DatabaseComponent {
|
||||
*/
|
||||
void removeTransport(Transaction txn, TransportId t) throws DbException;
|
||||
|
||||
/**
|
||||
* Marks the given contact as verified or unverified.
|
||||
*/
|
||||
void setContactVerified(Transaction txn, ContactId c, boolean verified)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Marks the given contact as active or inactive.
|
||||
*/
|
||||
|
||||
@@ -311,7 +311,7 @@ public class ContactExchangeTaskImpl extends Thread
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
contactId = contactManager.addContact(txn, remoteAuthor,
|
||||
localAuthor.getId(), master, timestamp, alice, true);
|
||||
localAuthor.getId(), master, timestamp, alice, true, true);
|
||||
transportPropertyManager.addRemoteProperties(txn, contactId,
|
||||
remoteProperties);
|
||||
txn.setComplete();
|
||||
|
||||
@@ -48,9 +48,9 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
|
||||
|
||||
@Override
|
||||
public ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||
SecretKey master,long timestamp, boolean alice, boolean active)
|
||||
throws DbException {
|
||||
ContactId c = db.addContact(txn, remote, local, active);
|
||||
SecretKey master,long timestamp, boolean alice, boolean verified,
|
||||
boolean active) throws DbException {
|
||||
ContactId c = db.addContact(txn, remote, local, verified, active);
|
||||
keyManager.addContact(txn, c, master, timestamp, alice);
|
||||
Contact contact = db.getContact(txn, c);
|
||||
for (AddContactHook hook : addHooks)
|
||||
@@ -60,13 +60,13 @@ class ContactManagerImpl implements ContactManager, RemoveIdentityHook {
|
||||
|
||||
@Override
|
||||
public ContactId addContact(Author remote, AuthorId local, SecretKey master,
|
||||
long timestamp, boolean alice, boolean active)
|
||||
long timestamp, boolean alice, boolean verified, boolean active)
|
||||
throws DbException {
|
||||
ContactId c;
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
c = addContact(txn, remote, local, master, timestamp, alice,
|
||||
active);
|
||||
verified, active);
|
||||
txn.setComplete();
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
|
||||
@@ -63,8 +63,8 @@ interface Database<T> {
|
||||
* Stores a contact associated with the given local and remote pseudonyms,
|
||||
* and returns an ID for the contact.
|
||||
*/
|
||||
ContactId addContact(T txn, Author remote, AuthorId local, boolean active)
|
||||
throws DbException;
|
||||
ContactId addContact(T txn, Author remote, AuthorId local, boolean verified,
|
||||
boolean active) throws DbException;
|
||||
|
||||
/**
|
||||
* Stores a group.
|
||||
@@ -575,6 +575,12 @@ interface Database<T> {
|
||||
*/
|
||||
void resetExpiryTime(T txn, ContactId c, MessageId m) throws DbException;
|
||||
|
||||
/**
|
||||
* Marks the given contact as verified or unverified.
|
||||
*/
|
||||
void setContactVerified(T txn, ContactId c, boolean verified)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Marks the given contact as active or inactive.
|
||||
*/
|
||||
|
||||
@@ -152,7 +152,8 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
}
|
||||
|
||||
public ContactId addContact(Transaction transaction, Author remote,
|
||||
AuthorId local, boolean active) throws DbException {
|
||||
AuthorId local, boolean verified, boolean active)
|
||||
throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsLocalAuthor(txn, local))
|
||||
@@ -161,7 +162,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
throw new ContactExistsException();
|
||||
if (db.containsContact(txn, remote.getId(), local))
|
||||
throw new ContactExistsException();
|
||||
ContactId c = db.addContact(txn, remote, local, active);
|
||||
ContactId c = db.addContact(txn, remote, local, verified, active);
|
||||
transaction.attach(new ContactAddedEvent(c, active));
|
||||
if (active) transaction.attach(new ContactStatusChangedEvent(c, true));
|
||||
return c;
|
||||
@@ -682,6 +683,16 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
db.removeTransport(txn, t);
|
||||
}
|
||||
|
||||
public void setContactVerified(Transaction transaction, ContactId c,
|
||||
boolean verified) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsContact(txn, c))
|
||||
throw new NoSuchContactException();
|
||||
db.setContactVerified(txn, c, verified);
|
||||
transaction.attach(new ContactStatusChangedEvent(c, verified));
|
||||
}
|
||||
|
||||
public void setContactActive(Transaction transaction, ContactId c,
|
||||
boolean active) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
|
||||
@@ -67,8 +67,8 @@ import static org.briarproject.db.ExponentialBackoff.calculateExpiry;
|
||||
*/
|
||||
abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
private static final int SCHEMA_VERSION = 25;
|
||||
private static final int MIN_SCHEMA_VERSION = 25;
|
||||
private static final int SCHEMA_VERSION = 26;
|
||||
private static final int MIN_SCHEMA_VERSION = 26;
|
||||
|
||||
private static final String CREATE_SETTINGS =
|
||||
"CREATE TABLE settings"
|
||||
@@ -93,6 +93,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
+ " name VARCHAR NOT NULL,"
|
||||
+ " publicKey BINARY NOT NULL,"
|
||||
+ " localAuthorId HASH NOT NULL,"
|
||||
+ " verified BOOLEAN NOT NULL,"
|
||||
+ " active BOOLEAN NOT NULL,"
|
||||
+ " PRIMARY KEY (contactId),"
|
||||
+ " FOREIGN KEY (localAuthorId)"
|
||||
@@ -456,20 +457,21 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
}
|
||||
|
||||
public ContactId addContact(Connection txn, Author remote, AuthorId local,
|
||||
boolean active) throws DbException {
|
||||
boolean verified, boolean active) throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
// Create a contact row
|
||||
String sql = "INSERT INTO contacts"
|
||||
+ " (authorId, name, publicKey, localAuthorId, active)"
|
||||
+ " VALUES (?, ?, ?, ?, ?)";
|
||||
+ " (authorId, name, publicKey, localAuthorId, verified, active)"
|
||||
+ " VALUES (?, ?, ?, ?, ?, ?)";
|
||||
ps = txn.prepareStatement(sql);
|
||||
ps.setBytes(1, remote.getId().getBytes());
|
||||
ps.setString(2, remote.getName());
|
||||
ps.setBytes(3, remote.getPublicKey());
|
||||
ps.setBytes(4, local.getBytes());
|
||||
ps.setBoolean(5, active);
|
||||
ps.setBoolean(5, verified);
|
||||
ps.setBoolean(6, active);
|
||||
int affected = ps.executeUpdate();
|
||||
if (affected != 1) throw new DbStateException();
|
||||
ps.close();
|
||||
@@ -961,7 +963,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
String sql = "SELECT authorId, name, publicKey,"
|
||||
+ " localAuthorId, active"
|
||||
+ " localAuthorId, verified, active"
|
||||
+ " FROM contacts"
|
||||
+ " WHERE contactId = ?";
|
||||
ps = txn.prepareStatement(sql);
|
||||
@@ -972,11 +974,12 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
String name = rs.getString(2);
|
||||
byte[] publicKey = rs.getBytes(3);
|
||||
AuthorId localAuthorId = new AuthorId(rs.getBytes(4));
|
||||
boolean active = rs.getBoolean(5);
|
||||
boolean verified = rs.getBoolean(5);
|
||||
boolean active = rs.getBoolean(6);
|
||||
rs.close();
|
||||
ps.close();
|
||||
Author author = new Author(authorId, name, publicKey);
|
||||
return new Contact(c, author, localAuthorId, active);
|
||||
return new Contact(c, author, localAuthorId, verified, active);
|
||||
} catch (SQLException e) {
|
||||
tryToClose(rs);
|
||||
tryToClose(ps);
|
||||
@@ -990,7 +993,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
String sql = "SELECT contactId, authorId, name, publicKey,"
|
||||
+ " localAuthorId, active"
|
||||
+ " localAuthorId, verified, active"
|
||||
+ " FROM contacts";
|
||||
ps = txn.prepareStatement(sql);
|
||||
rs = ps.executeQuery();
|
||||
@@ -1002,9 +1005,10 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
byte[] publicKey = rs.getBytes(4);
|
||||
Author author = new Author(authorId, name, publicKey);
|
||||
AuthorId localAuthorId = new AuthorId(rs.getBytes(5));
|
||||
boolean active = rs.getBoolean(6);
|
||||
boolean verified = rs.getBoolean(6);
|
||||
boolean active = rs.getBoolean(7);
|
||||
contacts.add(new Contact(contactId, author, localAuthorId,
|
||||
active));
|
||||
verified, active));
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
@@ -2245,6 +2249,23 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
}
|
||||
}
|
||||
|
||||
public void setContactVerified(Connection txn, ContactId c,
|
||||
boolean verified) throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
try {
|
||||
String sql = "UPDATE contacts SET verified = ? WHERE contactId = ?";
|
||||
ps = txn.prepareStatement(sql);
|
||||
ps.setBoolean(1, verified);
|
||||
ps.setInt(2, c.getInt());
|
||||
int affected = ps.executeUpdate();
|
||||
if (affected < 0 || affected > 1) throw new DbStateException();
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
tryToClose(ps);
|
||||
throw new DbException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setContactActive(Connection txn, ContactId c, boolean active)
|
||||
throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
|
||||
@@ -17,6 +17,7 @@ import javax.inject.Inject;
|
||||
|
||||
import static org.briarproject.api.identity.Author.Status.OURSELVES;
|
||||
import static org.briarproject.api.identity.Author.Status.UNKNOWN;
|
||||
import static org.briarproject.api.identity.Author.Status.UNVERIFIED;
|
||||
import static org.briarproject.api.identity.Author.Status.VERIFIED;
|
||||
|
||||
class IdentityManagerImpl implements IdentityManager {
|
||||
@@ -127,10 +128,12 @@ class IdentityManagerImpl implements IdentityManager {
|
||||
for (LocalAuthor a : db.getLocalAuthors(txn))
|
||||
if (a.getId().equals(authorId)) return OURSELVES;
|
||||
// Compare to the IDs of contacts' identities
|
||||
for (Contact c : db.getContacts(txn))
|
||||
if (c.getAuthor().getId().equals(authorId)) return VERIFIED;
|
||||
|
||||
// TODO also handle UNVERIFIED when #261 is implemented
|
||||
for (Contact c : db.getContacts(txn)) {
|
||||
if (c.getAuthor().getId().equals(authorId)) {
|
||||
if (c.isVerified()) return VERIFIED;
|
||||
else return UNVERIFIED;
|
||||
}
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ class IntroduceeManager {
|
||||
localState.getRaw(PUBLIC_KEY));
|
||||
ContactId contactId = contactManager
|
||||
.addContact(txn, remoteAuthor, localAuthorId, secretKey,
|
||||
timestamp, alice, false);
|
||||
timestamp, alice, false, false);
|
||||
|
||||
// Update local state with ContactId, so we know what to activate
|
||||
localState.put(ADDED_CONTACT_ID, contactId.getInt());
|
||||
|
||||
@@ -94,7 +94,7 @@ public class BlogManagerImplTest extends BriarTestCase {
|
||||
Collections.singletonList(contactId);
|
||||
|
||||
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
||||
blog1.getAuthor().getId(), true);
|
||||
blog1.getAuthor().getId(), true, true);
|
||||
final Collection<Contact> contacts = Collections.singletonList(contact);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
@@ -132,7 +132,7 @@ public class BlogManagerImplTest extends BriarTestCase {
|
||||
|
||||
final ContactId contactId = new ContactId(0);
|
||||
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
||||
blog1.getAuthor().getId(), true);
|
||||
blog1.getAuthor().getId(), true, true);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(blogFactory).createPersonalBlog(blog2.getAuthor());
|
||||
|
||||
@@ -111,7 +111,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
transportId = new TransportId("id");
|
||||
maxLatency = Integer.MAX_VALUE;
|
||||
contactId = new ContactId(234);
|
||||
contact = new Contact(contactId, author, localAuthorId, true);
|
||||
contact = new Contact(contactId, author, localAuthorId, true, true);
|
||||
}
|
||||
|
||||
private DatabaseComponent createDatabaseComponent(Database<Object> database,
|
||||
@@ -149,7 +149,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
will(returnValue(false));
|
||||
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
||||
will(returnValue(false));
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true);
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true, true);
|
||||
will(returnValue(contactId));
|
||||
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
||||
oneOf(eventBus).broadcast(with(any(
|
||||
@@ -201,7 +201,8 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
try {
|
||||
db.addLocalAuthor(transaction, localAuthor);
|
||||
assertEquals(contactId,
|
||||
db.addContact(transaction, author, localAuthorId, true));
|
||||
db.addContact(transaction, author, localAuthorId, true,
|
||||
true));
|
||||
assertEquals(Collections.singletonList(contact),
|
||||
db.getContacts(transaction));
|
||||
db.addGroup(transaction, group); // First time - listeners called
|
||||
@@ -519,7 +520,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addContact(transaction, author, localAuthorId, true);
|
||||
db.addContact(transaction, author, localAuthorId, true, true);
|
||||
fail();
|
||||
} catch (NoSuchLocalAuthorException expected) {
|
||||
// Expected
|
||||
@@ -815,7 +816,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
will(returnValue(false));
|
||||
oneOf(database).containsContact(txn, authorId, localAuthorId);
|
||||
will(returnValue(false));
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true);
|
||||
oneOf(database).addContact(txn, author, localAuthorId, true, true);
|
||||
will(returnValue(contactId));
|
||||
oneOf(eventBus).broadcast(with(any(ContactAddedEvent.class)));
|
||||
oneOf(eventBus).broadcast(with(any(
|
||||
@@ -838,7 +839,8 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
try {
|
||||
db.addLocalAuthor(transaction, localAuthor);
|
||||
assertEquals(contactId,
|
||||
db.addContact(transaction, author, localAuthorId, true));
|
||||
db.addContact(transaction, author, localAuthorId, true,
|
||||
true));
|
||||
transaction.setComplete();
|
||||
} finally {
|
||||
db.endTransaction(transaction);
|
||||
@@ -1569,7 +1571,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addContact(transaction, author, localAuthorId, true);
|
||||
db.addContact(transaction, author, localAuthorId, true, true);
|
||||
fail();
|
||||
} catch (ContactExistsException expected) {
|
||||
// Expected
|
||||
@@ -1606,7 +1608,7 @@ public class DatabaseComponentImplTest extends BriarTestCase {
|
||||
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addContact(transaction, author, localAuthorId, true);
|
||||
db.addContact(transaction, author, localAuthorId, true, true);
|
||||
fail();
|
||||
} catch (ContactExistsException expected) {
|
||||
// Expected
|
||||
|
||||
@@ -111,7 +111,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
assertFalse(db.containsContact(txn, contactId));
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
assertTrue(db.containsContact(txn, contactId));
|
||||
assertFalse(db.containsGroup(txn, groupId));
|
||||
db.addGroup(txn, group);
|
||||
@@ -174,7 +174,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -212,7 +212,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and an unvalidated message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, UNKNOWN, true);
|
||||
@@ -267,7 +267,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and an unshared message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, false);
|
||||
@@ -306,7 +306,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -333,7 +333,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
|
||||
@@ -370,7 +370,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -534,7 +534,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
|
||||
@@ -554,7 +554,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
|
||||
// The group is not in the database
|
||||
assertFalse(db.containsVisibleMessage(txn, contactId, messageId));
|
||||
@@ -572,7 +572,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
db.addStatus(txn, contactId, messageId, false, false);
|
||||
@@ -592,7 +592,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
|
||||
// The group should not be visible to the contact
|
||||
@@ -628,7 +628,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and the groups
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
for (Group g : groups) db.addGroup(txn, g);
|
||||
|
||||
// Make the groups visible to the contact
|
||||
@@ -661,7 +661,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add the contact, the transport and the transport keys
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addTransport(txn, transportId, 123);
|
||||
db.addTransportKeys(txn, contactId, keys);
|
||||
|
||||
@@ -723,7 +723,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add the contact, transport and transport keys
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addTransport(txn, transportId, 123);
|
||||
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
||||
|
||||
@@ -759,7 +759,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add the contact, transport and transport keys
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addTransport(txn, transportId, 123);
|
||||
db.updateTransportKeys(txn, Collections.singletonMap(contactId, keys));
|
||||
|
||||
@@ -796,7 +796,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
|
||||
// Add a contact associated with the local author
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
contacts = db.getContacts(txn, localAuthorId);
|
||||
assertEquals(Collections.singletonList(contactId), contacts);
|
||||
|
||||
@@ -818,7 +818,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact - initially there should be no offered messages
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
assertEquals(0, db.countOfferedMessages(txn, contactId));
|
||||
|
||||
// Add some offered messages and count them
|
||||
@@ -1377,7 +1377,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
|
||||
// Add a group and make it visible to the contact
|
||||
db.addGroup(txn, group);
|
||||
@@ -1454,7 +1454,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact and a group
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
|
||||
// The group should not be visible to the contact
|
||||
@@ -1487,8 +1487,10 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
db.addLocalAuthor(txn, localAuthor1);
|
||||
|
||||
// Add the same contact for each local pseudonym
|
||||
ContactId contactId = db.addContact(txn, author, localAuthorId, true);
|
||||
ContactId contactId1 = db.addContact(txn, author, localAuthorId1, true);
|
||||
ContactId contactId =
|
||||
db.addContact(txn, author, localAuthorId, true, true);
|
||||
ContactId contactId1 =
|
||||
db.addContact(txn, author, localAuthorId1, true, true);
|
||||
|
||||
// The contacts should be distinct
|
||||
assertNotEquals(contactId, contactId1);
|
||||
@@ -1508,7 +1510,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact, a group and a message
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addVisibility(txn, contactId, groupId);
|
||||
db.addMessage(txn, message, DELIVERED, true);
|
||||
@@ -1554,7 +1556,7 @@ public class H2DatabaseTest extends BriarTestCase {
|
||||
// Add a contact
|
||||
db.addLocalAuthor(txn, localAuthor);
|
||||
assertEquals(contactId, db.addContact(txn, author, localAuthorId,
|
||||
true));
|
||||
true, true));
|
||||
|
||||
// The contact should be active
|
||||
Contact contact = db.getContact(txn, contactId);
|
||||
|
||||
@@ -115,20 +115,23 @@ public class IntroduceeManagerTest extends BriarTestCase {
|
||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||
AuthorId localAuthorId = new AuthorId(TestUtils.getRandomId());
|
||||
ContactId contactId0 = new ContactId(234);
|
||||
introducer = new Contact(contactId0, author0, localAuthorId, true);
|
||||
introducer =
|
||||
new Contact(contactId0, author0, localAuthorId, true, true);
|
||||
|
||||
AuthorId authorId1 = new AuthorId(TestUtils.getRandomId());
|
||||
Author author1 = new Author(authorId1, "Introducee1",
|
||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
||||
ContactId contactId1 = new ContactId(234);
|
||||
introducee1 = new Contact(contactId1, author1, localAuthorId1, true);
|
||||
introducee1 =
|
||||
new Contact(contactId1, author1, localAuthorId1, true, true);
|
||||
|
||||
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
||||
Author author2 = new Author(authorId2, "Introducee2",
|
||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||
ContactId contactId2 = new ContactId(235);
|
||||
introducee2 = new Contact(contactId2, author2, localAuthorId, true);
|
||||
introducee2 =
|
||||
new Contact(contactId2, author2, localAuthorId, true, true);
|
||||
|
||||
clientId = IntroductionManagerImpl.CLIENT_ID;
|
||||
localGroup1 = new Group(new GroupId(TestUtils.getRandomId()),
|
||||
|
||||
@@ -85,14 +85,16 @@ public class IntroducerManagerTest extends BriarTestCase {
|
||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
||||
ContactId contactId1 = new ContactId(234);
|
||||
introducee1 = new Contact(contactId1, author1, localAuthorId1, true);
|
||||
introducee1 =
|
||||
new Contact(contactId1, author1, localAuthorId1, true, true);
|
||||
|
||||
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
||||
Author author2 = new Author(authorId2, "Introducee2",
|
||||
TestUtils.getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
|
||||
AuthorId localAuthorId2 = new AuthorId(TestUtils.getRandomId());
|
||||
ContactId contactId2 = new ContactId(235);
|
||||
introducee2 = new Contact(contactId2, author2, localAuthorId2, true);
|
||||
introducee2 =
|
||||
new Contact(contactId2, author2, localAuthorId2, true, true);
|
||||
|
||||
localGroup0 = new Group(new GroupId(TestUtils.getRandomId()),
|
||||
getClientId(), new byte[0]);
|
||||
|
||||
@@ -77,14 +77,16 @@ public class IntroductionManagerImplTest extends BriarTestCase {
|
||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||
AuthorId localAuthorId1 = new AuthorId(TestUtils.getRandomId());
|
||||
ContactId contactId1 = new ContactId(234);
|
||||
introducee1 = new Contact(contactId1, author1, localAuthorId1, true);
|
||||
introducee1 =
|
||||
new Contact(contactId1, author1, localAuthorId1, true, true);
|
||||
|
||||
AuthorId authorId2 = new AuthorId(TestUtils.getRandomId());
|
||||
Author author2 = new Author(authorId2, "Introducee2",
|
||||
new byte[MAX_PUBLIC_KEY_LENGTH]);
|
||||
AuthorId localAuthorId2 = new AuthorId(TestUtils.getRandomId());
|
||||
ContactId contactId2 = new ContactId(235);
|
||||
introducee2 = new Contact(contactId2, author2, localAuthorId2, true);
|
||||
introducee2 =
|
||||
new Contact(contactId2, author2, localAuthorId2, true, true);
|
||||
|
||||
ClientId clientId = new ClientId(TestUtils.getRandomId());
|
||||
localGroup0 = new Group(new GroupId(TestUtils.getRandomId()),
|
||||
|
||||
Reference in New Issue
Block a user