mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Call KeyManager#AddContact when restoring contacts
This commit is contained in:
@@ -50,7 +50,8 @@ public interface ContactManager {
|
||||
boolean active) throws DbException;
|
||||
|
||||
ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||
PublicKey handshake, boolean verified) throws DbException;
|
||||
PublicKey handshake, boolean verified)
|
||||
throws DbException, GeneralSecurityException;
|
||||
|
||||
/**
|
||||
* Stores a contact associated with the given local and remote pseudonyms,
|
||||
@@ -212,12 +213,14 @@ public interface ContactManager {
|
||||
/**
|
||||
* Sets the contact's handshake public key
|
||||
*/
|
||||
void setHandshakePublicKey(Transaction txn, ContactId c, PublicKey handshakePublicKey) throws DbException;
|
||||
void setHandshakePublicKey(Transaction txn, ContactId c,
|
||||
PublicKey handshakePublicKey) throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the contact's handshake public key
|
||||
*/
|
||||
void setHandshakePublicKey(ContactId c, PublicKey handshakePublicKey) throws DbException;
|
||||
void setHandshakePublicKey(ContactId c, PublicKey handshakePublicKey)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns true if a contact with this {@code remoteAuthorId} belongs to
|
||||
|
||||
@@ -122,9 +122,12 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
||||
|
||||
@Override
|
||||
public ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||
PublicKey handshake, boolean verified) throws DbException {
|
||||
PublicKey handshake, boolean verified)
|
||||
throws DbException, GeneralSecurityException {
|
||||
ContactId c = db.addContact(txn, remote, local, handshake, verified);
|
||||
Contact contact = db.getContact(txn, c);
|
||||
KeyPair ourKeyPair = identityManager.getHandshakeKeys(txn);
|
||||
keyManager.addContact(txn, c, handshake, ourKeyPair);
|
||||
for (ContactHook hook : hooks) hook.addingContact(txn, contact);
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -95,6 +95,8 @@ public class HandshakeKeyExchangeManagerImpl extends ConversationClientImpl
|
||||
for (Contact c : db.getContacts(txn)) {
|
||||
if (c.getHandshakePublicKey() == null) {
|
||||
sendHandshakePublicKey(txn, c);
|
||||
} else {
|
||||
LOG.info("Have pk for contact " + c.getAuthor().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,6 +196,8 @@ public class HandshakeKeyExchangeManagerImpl extends ConversationClientImpl
|
||||
|
||||
if (c.getHandshakePublicKey() == null) {
|
||||
sendHandshakePublicKey(txn, c);
|
||||
} else {
|
||||
LOG.info("Have pk for contact " + c.getAuthor().getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,6 +184,9 @@ public class RestoreAccountImpl implements RestoreAccount {
|
||||
} catch (DbException e) {
|
||||
LOG.warning("Error adding contacts to database");
|
||||
LOG.warning(e.getMessage());
|
||||
} catch (GeneralSecurityException e) {
|
||||
LOG.warning("Error adding handshake key");
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
LOG.info("Added all contacts");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user