Skip to content

Commit

Permalink
fix(PrivateKeyStore): Include nodeId in scope (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea authored Dec 18, 2023
1 parent 90ccc4e commit 7f89d2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,15 @@ abstract class PrivateKeyStore {
abstract suspend fun deleteKeys(nodeId: String)

/**
* Delete the session keys for the peer identified by [peerId].
* Delete the session keys for node [nodeId] and peer [peerId].
*
* This is a no-op if the peer doesn't exist.
*/
@Throws(KeyStoreBackendException::class)
abstract suspend fun deleteSessionKeysForPeer(peerId: String)
abstract suspend fun deleteBoundSessionKeys(
nodeId: String,
peerId: String,
)

@Throws(KeyStoreBackendException::class)
protected abstract suspend fun retrieveSessionKeySerialized(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ class MockPrivateKeyStore(
sessionKeys.remove(nodeId)
}

override suspend fun deleteSessionKeysForPeer(peerId: String) {
sessionKeys.values.forEach {
it.remove(peerId)
}
override suspend fun deleteBoundSessionKeys(
nodeId: String,
peerId: String,
) {
sessionKeys[nodeId]?.remove(peerId)
}
}

0 comments on commit 7f89d2a

Please sign in to comment.