-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow multiple first-party endpoints to communicate with the sam…
…e third-party endpoint (#361) Due to bugs in the key stores (relaycorp/awala-jvm#306, relaycorp/awala-jvm#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): ```kotlin 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 https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L183 - [x] Replace `import(ByteArray)` in `PublicThirdPartyEndpoint` with `import(ByteArray, FirstPartyEndpoint)`, and pass the first-party endpoint to https://github.com/relaycorp/awala-endpoint-android/blob/6ecb5345d67bf29033b0e27a02d91e7d1b35c02a/lib/src/main/java/tech/relaycorp/awaladroid/endpoint/ThirdPartyEndpoint.kt#L249-L252
- Loading branch information
Showing
9 changed files
with
86 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters