mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Add methods for adding unbound keys.
This commit is contained in:
@@ -50,7 +50,7 @@ class ContactManagerImpl implements ContactManager {
|
||||
|
||||
@Override
|
||||
public ContactId addContact(Transaction txn, Author remote, AuthorId local,
|
||||
SecretKey master,long timestamp, boolean alice, boolean verified,
|
||||
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);
|
||||
|
||||
@@ -104,6 +104,13 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
m.addContact(txn, c, master, timestamp, alice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUnboundKeys(Transaction txn, SecretKey master,
|
||||
long timestamp, boolean alice) throws DbException {
|
||||
for (TransportKeyManager m : managers.values())
|
||||
m.addUnboundKeys(txn, master, timestamp, alice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamContext getStreamContext(ContactId c, TransportId t)
|
||||
throws DbException {
|
||||
|
||||
@@ -17,6 +17,9 @@ interface TransportKeyManager {
|
||||
void addContact(Transaction txn, ContactId c, SecretKey master,
|
||||
long timestamp, boolean alice) throws DbException;
|
||||
|
||||
void addUnboundKeys(Transaction txn, SecretKey master, long timestamp,
|
||||
boolean alice) throws DbException;
|
||||
|
||||
void removeContact(ContactId c);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -172,6 +172,18 @@ class TransportKeyManagerImpl implements TransportKeyManager {
|
||||
@Override
|
||||
public void addContact(Transaction txn, ContactId c, SecretKey master,
|
||||
long timestamp, boolean alice) throws DbException {
|
||||
deriveAndAddKeys(txn, c, master, timestamp, alice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUnboundKeys(Transaction txn, SecretKey master,
|
||||
long timestamp, boolean alice) throws DbException {
|
||||
deriveAndAddKeys(txn, null, master, timestamp, alice);
|
||||
}
|
||||
|
||||
private void deriveAndAddKeys(Transaction txn, @Nullable ContactId c,
|
||||
SecretKey master, long timestamp, boolean alice)
|
||||
throws DbException {
|
||||
lock.lock();
|
||||
try {
|
||||
// Work out what rotation period the timestamp belongs to
|
||||
|
||||
Reference in New Issue
Block a user