-
Notifications
You must be signed in to change notification settings - Fork 47
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
V7 Release #208
Merged
V7 Release #208
Conversation
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
Test beta channel
* feat: negotiated topics * Client maintains both V1 and V2 private key bundles (`keys` vs `legacyKeys`), still publishing V1 only * Client supports reading both V1 and V2 peer contact bundles * Client keeps publishing V1 contact bundle by default (tests can make it publish V2 contact) * MessageV1/V2 classes to support header differences * Both Message classes support `senderAddress()` & `sent`; `recipientAddress` not supported by V2 and should be abandoned (we could make it work in 1:1 convos if we link messages back to their conversations, but it won't work in group chat context) * Stream generalized to support both message versions (streamAllMessages yet to be fixed in a follow up) * ConversationV1/V2 classes to support different semantics * ConversationV2 implements MessageV2 encoding/decoding (Client retains V1 version of that) * listing/streaming conversations reads both the intro and invite topics and creates both kinds of conversations * creating V2 conversation sends invites to both the sender and the recipient * see below for the expanded behavior of `newConversation` BREAKING CHANGE: * `Message` is now `MessageV1 | MessageV2` * `Conversation` is now `ConversationV1 | ConversationV2` * Many of the `Client` methods are now restricted to `MessageV1` only as they are only pertinent to the V1 protocol; analogous V2 functionality can be found on `Conversation(s)` * `Client.publishEnvelope()` is replaced by `Client.publishEnvelopes()` (not meant for general use) * feat: get invites and intros in parallel Co-authored-by: Nicholas Molnar <[email protected]>
Pass bytes as Uint8Array
streamAllMessages Fixes
Sanitize random topics
Add conversation reference to messages
Replace prepare with prepublish
Remove LocalStorageStore
Public API Cleanup
Catch errors with no matching preKey
Beta: Expose ns to Date timestamp converters
Verify encryption signature (merge to beta)
Merge latest from main
Deploying with
|
Latest commit: |
907acb7
|
Status: | ✅ Deploy successful! |
Preview URL: | https://62d8476d.xmtp-js.pages.dev |
Branch Preview URL: | https://beta.xmtp-js.pages.dev |
mkobetic
reviewed
Nov 2, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 🌔
mkobetic
approved these changes
Nov 2, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me.
Add client app version on api requests
🎉 This PR is included in version 7.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version 7.0.0 Release Notes
New Features
Improved participant privacy
In prior versions of the SDK, both the topic names and the message headers of DMs indicated the likely participants. Topic names were of the form
dm-$address1-$address2
. Only the participants in the conversation could verify the authenticity of these messages (they might be invalid messages spoofed by a third party), but a passive attacker could get a reasonable guess as to who was talking to whom and how often.With V7, we have implemented Negotiated Topics. All identifying metadata has been removed from DMs and the conversation topic name is now a 32-byte random alphanumeric string, such as
m-AhUFyewKxM1pxr1JmJJkDK3tDn3gQ0Op
. This is accomplished by first sending an encrypted invitation to a well-known topic for all participants in the conversation which includes the randomly generated topic name and encryption key to be used in subsequent communication.With this change, only the two parties in a DM conversation can know which conversation a given message relates to. Invitations are still publicly associated with known blockchain addresses, although only the participants can decrypt and verify the authenticity of those invitations. As always, message contents are end to end encrypted.
Conversation IDs
A longstanding feature request has been the ability to scope conversations to a particular application or identifier. For example, some developers may want to only display messages coming from their own application and not other apps on the XMTP network. Other developers may want to group messages based on other criteria (for example, an NFT marketplace may want to have messages grouped by NFT ID). Conversation IDs provide the building blocks needed for developers to have multiple conversations with the same blockchain address, grouped by an identifier.
You can learn more about how to use Conversation IDs here.
Conversation Metadata
In addition to conversation IDs, which are used for grouping messages, we also allow you to attach an arbitrary
Map<string, string>
of metadata to any conversation at the time of creation. Maybe you want to give a conversation a title or header image. Maybe you want to include some more information to link a conversation with an entity in your application.Metadata is immutable and can only be set the first time
conversations.newConversation(...)
is run for a unique combination of blockchain address andconversationId
.Migration path
There are now two types of
Conversation
(ConversationV1
andConversationV2
). The APIs are identical to application developers, but onlyConversationV2
receives the privacy benefits outlined above. Applications using SDK Version <7.0.0 can only send/receive messages fromConversationV1
.When
client.conversations.newConversation(...)
is called, you may receive either aConversationV1
orConversationV2
instance depending on the following criteria:conversationId
is specified, we will either find an existing V2 conversation based on the conversation ID/address combination or create a new one if none exist.conversationId
is specified, but there is a pre-existing V1 conversation, we will return that conversationconversationId
is specified and there is no pre-existing V1 conversation, the decision to create a V1 or V2 conversation will depend on whether the address you are attempting to communicate with has ever used a XMTP SDK version of 7.1 or greater. If they have, a V2 conversation will be created. If not, a V1 conversation will be created.This ensures that both parties will be able to see messages sent from >7.x versions of the SDK whenever possible, even as different applications upgrade at different times.
In a future release we may decide to allow one party to upgrade legacy V1 conversations to V2, once v7 adoption of the SDK is sufficiently high.
Breaking Changes
import { Message } from '@xmtp/xmtp-js'
you will need to replace it withimport { DecodedMessage } from '@xmtp/xmtp-js'
. The fields available on this new type are compatible with the previous version, so in most cases you will only need to update your import.DecodedMessage
has replaced many optional fields fromMessage
with required fields with the same name, so you may be able to remove some null checks from your code.client.conversations.list()
may now return multiple conversations with the same blockchain address (but different conversation IDs). To get the same results you would receive with the 6.x version of the SDK, replace any instance ofconst conversations = await client.conversations.list()
withThere will be at most one conversation per blockchain address without a conversation ID.
LocalStorageStore
has been removed. If you have been initializing your SDK with the option{ keyStoreType: KeyStoreType.localStorage }
you will need to replace it with a different store (such asnetworkTopicStoreV1
)Client
class:sendMessage
,publishEnvelope
,encodeMessage
,decodeMessage
,streamIntroductionMessages
,streamConversationMessages
,listMessages
,listConversationMessages
,listIntroductionMessages
. Equivalent functionality can be found usingclient.conversations
.await client.conversations.newConversation(...)
would not perform any network requests and would return almost instantly. In V7 and above that method must check if a pre-existing conversation exists. Because of this change, the method is more expensive/slower. If you are repeatedly creating conversations for the same address usingnewConversation
, you should refactor to re-use the returned conversation instance.