8000 Passkey Read by nplasterer · Pull Request #389 · xmtp/xmtp-android · GitHub
[go: up one dir, main page]

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

Passkey Read #389

Merged
merged 23 commits into from
Mar 7, 2025
Merged

Passkey Read #389

merged 23 commits into from
Mar 7, 2025

Conversation

nplasterer
Copy link
Contributor
@nplasterer nplasterer commented Feb 28, 2025
  • Make sure addWallet is blocking reassignment for the ffi function as well
  • Adds new identity for all places where addresses were used
  • Changes addMember, removeMember, createGroup, and newConversation to default to InboxId
  • Enforces type on inboxId so address can't accidentally be passed.

@nplasterer nplasterer self-assigned this Feb 28, 2025
@@ -39,15 +41,16 @@ data class ClientOptions(
)
}

@JvmInline
value class InboxId(val value: String)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this a value class so that it would error if people pass an address instead of an inboxId into certain methods. If you pass an address instead of a inboxId you get this error: xmtp/libxmtp#1693

There are less aggressive ways to do typing like a typealias... but it wouldn't give clear in line coding warnings which is what I think is necessary here with this level of a change. Open to thoughts though.

Copy link
Contributor

Choose a reason for hiding this comment

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

yea this was the first thing I checked - I think this is perfect for providing the lint warning and compile error on existing code that strings need to be InboxId 👍

Maybe we can put a descriptive comment here for integrators who have only ever dealt with address who have the question, what is an InboxId, how to do find someone's inboxId etc.

// InboxId is the constant unique identifier for all XMTP users. 
// To find an inboxId from a `PublicIdentifier`, (Ethereum Address, Passkey), see `inboxIdFromIdentity()`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I walked this change back because it felt too heavy. Long term I want the SDK to be a bit more light. InboxIds should just be a typealias around a string. I'm waffling on which direction is more right. Maybe another kotlin perspective from @mchenani ?

Copy link

Choose a reason for hiding this comment

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

I agree too, also I would say we need to do it more and more, also we're doing it in rust more often.

}

suspend fun addMembers(addresses: List<String>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Big breaking change here is addMembers now takes a inboxId instead of a address... but because they are both strings it will blow up only after it's been hit in the code.

suspend fun newConversationWithInboxId(
peerInboxId: String,
suspend fun newConversation(
peerInboxId: InboxId,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Big breaking change here is newConversation and new Group now takes a inboxId instead of a address... but because they are both strings it will blow up only after it's been hit in the code.

@nplasterer nplasterer marked this pull request as ready for review March 7, 2025 06:20
@nplasterer nplasterer requested a review from a team as a code owner March 7, 2025 06:20
Copy link
Contributor
@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

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

looking great!

@cameronvoell cameronvoell self-requested a review March 7, 2025 16:42
Copy link
Contributor
@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

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

Noticed something odd, testCannotStartGroupWithSelf started failing in this branch, looks good on main

looks like no error thrown when you start a group with yourself 🤔

GroupTest.kt:483

@Test
    fun testCannotStartGroupWithSelf() {
        assertThrows("Recipient is sender", XMTPException::class.java) {
            runBlocking { boClient.conversations.newGroup(listOf(boClient.inboxId)) }
        }
    }

@nplasterer
Copy link
Contributor Author

Ahh ya I thought I fixed the self dms error. But honestly this should probably be enforced in libxmtp. I'll look into making the fix in the lower level.

@nplasterer nplasterer merged commit 4cd62b9 into main Mar 7, 2025
4 of 5 checks passed
@nplasterer nplasterer deleted the np/passkey-read branch March 7, 2025 20:32
@nplasterer nplasterer restored the np/passkey-read branch March 7, 2025 20:35
@nplasterer nplasterer deleted the np/passkey-read branch March 7, 2025 20: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.

3 participants
0