Rename key manager methods for clarity.

This commit is contained in:
akwizgran
2019-05-14 10:57:48 +01:00
parent f9b928c12a
commit 0b30a0786e
9 changed files with 54 additions and 49 deletions

View File

@@ -70,7 +70,8 @@ class ContactManagerImpl implements ContactManager {
SecretKey rootKey, long timestamp, boolean alice, boolean verified,
boolean active) throws DbException {
ContactId c = db.addContact(txn, remote, local, verified);
keyManager.addContact(txn, c, rootKey, timestamp, alice, active);
keyManager.addContactWithRotationKeys(txn, c, rootKey, timestamp,
alice, active);
Contact contact = db.getContact(txn, c);
for (ContactHook hook : hooks) hook.addingContact(txn, contact);
return c;

View File

@@ -89,26 +89,28 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
}
@Override
public Map<TransportId, KeySetId> addContact(Transaction txn,
ContactId c, SecretKey rootKey, long timestamp, boolean alice,
boolean active) throws DbException {
public Map<TransportId, KeySetId> addContactWithRotationKeys(
Transaction txn, ContactId c, SecretKey rootKey, long timestamp,
boolean alice, boolean active) throws DbException {
Map<TransportId, KeySetId> ids = new HashMap<>();
for (Entry<TransportId, TransportKeyManager> e : managers.entrySet()) {
TransportId t = e.getKey();
TransportKeyManager m = e.getValue();
ids.put(t, m.addContact(txn, c, rootKey, timestamp, alice, active));
ids.put(t, m.addContactWithRotationKeys(txn, c, rootKey, timestamp,
alice, active));
}
return ids;
}
@Override
public Map<TransportId, KeySetId> addContact(Transaction txn,
ContactId c, SecretKey rootKey, boolean alice) throws DbException {
public Map<TransportId, KeySetId> addContactWithHandshakeKeys(
Transaction txn, ContactId c, SecretKey rootKey, boolean alice)
throws DbException {
Map<TransportId, KeySetId> ids = new HashMap<>();
for (Entry<TransportId, TransportKeyManager> e : managers.entrySet()) {
TransportId t = e.getKey();
TransportKeyManager m = e.getValue();
ids.put(t, m.addContact(txn, c, rootKey, alice));
ids.put(t, m.addContactWithHandshakeKeys(txn, c, rootKey, alice));
}
return ids;
}

View File

@@ -16,11 +16,12 @@ interface TransportKeyManager {
void start(Transaction txn) throws DbException;
KeySetId addContact(Transaction txn, ContactId c, SecretKey rootKey,
long timestamp, boolean alice, boolean active) throws DbException;
KeySetId addContactWithRotationKeys(Transaction txn, ContactId c,
SecretKey rootKey, long timestamp, boolean alice, boolean active)
throws DbException;
KeySetId addContact(Transaction txn, ContactId c, SecretKey rootKey,
boolean alice) throws DbException;
KeySetId addContactWithHandshakeKeys(Transaction txn, ContactId c,
SecretKey rootKey, boolean alice) throws DbException;
KeySetId addPendingContact(Transaction txn, PendingContactId p,
SecretKey rootKey, boolean alice) throws DbException;

View File

@@ -207,8 +207,9 @@ class TransportKeyManagerImpl implements TransportKeyManager {
}
@Override
public KeySetId addContact(Transaction txn, ContactId c, SecretKey rootKey,
long timestamp, boolean alice, boolean active) throws DbException {
public KeySetId addContactWithRotationKeys(Transaction txn, ContactId c,
SecretKey rootKey, long timestamp, boolean alice, boolean active)
throws DbException {
lock.lock();
try {
// Work out what time period the timestamp belongs to
@@ -230,8 +231,8 @@ class TransportKeyManagerImpl implements TransportKeyManager {
}
@Override
public KeySetId addContact(Transaction txn, ContactId c, SecretKey rootKey,
boolean alice) throws DbException {
public KeySetId addContactWithHandshakeKeys(Transaction txn, ContactId c,
SecretKey rootKey, boolean alice) throws DbException {
lock.lock();
try {
// Work out what time period we're in