Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LibXMTP Client Creation #156

Merged
merged 40 commits into from
Jan 26, 2024
Merged

LibXMTP Client Creation #156

merged 40 commits into from
Jan 26, 2024

Conversation

nplasterer
Copy link
Contributor

@nplasterer nplasterer commented Jan 19, 2024

Part of #157

This adds the creation of a V3 client on create of any client. Makes Signing Key extend the FfiInboxOwner so that we can correctly extend and sign. Moved all the group logic to a new branch so that we can land these PRs slowly.

@nplasterer nplasterer self-assigned this Jan 19, 2024
Comment on lines 24 to 25
suspend fun sign(message: String): SignatureOuterClass.Signature?
suspend fun signLegacy(message: String): SignatureOuterClass.Signature?

override fun sign(text: String): ByteArray
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java doesn't allow name shadowing since they both take a String even if they have different return values. To make this change smaller I just renamed the existing sign to signLegacy for now but hopefully we can remove it entirely.

@nplasterer nplasterer changed the title WIP: Group Chat LibXMTP Client Creation Jan 23, 2024
@nplasterer nplasterer marked this pull request as ready for review January 23, 2024 20:10
@nplasterer nplasterer requested a review from a team as a code owner January 23, 2024 20:10
@nplasterer nplasterer requested a review from neekolas January 23, 2024 20:10
@nplasterer
Copy link
Contributor Author

My group continued branch is here: #160

@nplasterer
Copy link
Contributor Author

I think this is getting really close and ready for another round of review.

@@ -23,7 +23,7 @@ android {
compileSdk 33

defaultConfig {
minSdk 22
minSdk 23
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping to 23 should be safe as all our integrators are now on it.

Copy link
Contributor

@richardhuaaa richardhuaaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done on the quick turnaround!

@@ -150,21 +170,61 @@ class Client() {
val clientOptions = options ?: ClientOptions()
val apiClient =
GRPCApiClient(environment = clientOptions.api.env, secure = clientOptions.api.isSecure)
return Client(address = address, privateKeyBundleV1 = bundle, apiClient = apiClient)
val v3Client: FfiXmtpClient? = runBlocking {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm a little unsure about the use of runBlocking here and in the new sign method. ffiXmtpClient() may or may not do a network round-trip, and sign() might require user interaction. I'm not an Android expert though, this is all I was able to find

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing all these create methods to suspend would be a breaking change. I'm totally down with doing it if things seem broken but lets hold off till this is out of alpha.

v3Client?.registerIdentity(null)
} else {
v3Client.textToSign()?.let {
v3Client.registerIdentity(account?.sign(it))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the account param of this function should be non-optional - if there is a text to be signed then we must request it, or the v3 client will be non-functional

@nplasterer
Copy link
Contributor Author

BREAKING CHANGES introduced in this PR for future release notes.

  • minSDKVersion 22 -> 23
  • SigningKey now takes an addition sign method and the previous sign method has been renamed to signLegacy

If you want to try out alpha groups

  • fromBundle now requires a SigningKey
  • all create Client functions require ClientOptions to enableAlphaMls and a appContext

@nplasterer nplasterer merged commit 125cc65 into main Jan 26, 2024
@nplasterer nplasterer deleted the np/group-spike branch January 26, 2024 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants