This PR will integrate the two breaking changes above, plus one additional change needed to make this work.
A consequence of this change is that we'll now need to pass the linked first-party endpoint when importing and deleting a third-party endpoint, so that we know which session keys to delete in case the same third-party endpoint is used by another first-party endpoint.
TODO
Each of the following require updating the respective test suite.
[x] Pass first-party endpoint to every function call inside ThirdPartyEndpoint.delete():
public open suspend fun delete(linkedFirstPartyEndpoint: FirstPartyEndpoint) {
val context = Awala.getContextOrThrow()
context.privateKeyStore.deleteBoundSessionKeys(linkedFirstPartyEndpoint.nodeId, nodeId)
context.sessionPublicKeyStore.delete(linkedFirstPartyEndpoint.nodeId, nodeId)
context.channelManager.delete(linkedFirstPartyEndpoint, this)
}
[x] Replace delete(ThirdPartyEndpoint) in ChannelManager with delete(FirstPartyEndpoint, ThirdPartyEndpoint), and only delete the items for the given first-/third-party endpoint pair. This change is needed by the previous task.
[x] Replace import(ByteArray) in PrivateThirdPartyEndpoint with import(ByteArray, FirstPartyEndpoint), and pass the first-party endpoint to
Due to bugs in the key stores (https://github.com/relaycorp/awala-jvm/pull/306, https://github.com/relaycorp/awala-jvm/pull/310), we were accidentally reusing the same session keys, which the third-party endpoint rightfully refused.
This PR will integrate the two breaking changes above, plus one additional change needed to make this work.
A consequence of this change is that we'll now need to pass the linked first-party endpoint when importing and deleting a third-party endpoint, so that we know which session keys to delete in case the same third-party endpoint is used by another first-party endpoint.
TODO
Each of the following require updating the respective test suite.
[x] Pass first-party endpoint to every function call inside
ThirdPartyEndpoint.delete()
:https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L31-L36
This should look like this, roughly (untested):
delete(ThirdPartyEndpoint)
inChannelManager
withdelete(FirstPartyEndpoint, ThirdPartyEndpoint)
, and only delete the items for the given first-/third-party endpoint pair. This change is needed by the previous task.[x] Replace
import(ByteArray)
inPrivateThirdPartyEndpoint
withimport(ByteArray, FirstPartyEndpoint)
, and pass the first-party endpoint tohttps://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L183
[x] Replace
import(ByteArray)
inPublicThirdPartyEndpoint
withimport(ByteArray, FirstPartyEndpoint)
, and pass the first-party endpoint tohttps://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L249-L252