Repository navigation
Add conversation key fetch and send-problem recovery - #108
Merged
Merged
Conversation
|
|
…bob key cache in tests
…evplatform/chat-xdk into cursor/conversation-keys-1d8a
…n JVM ConversationKeysTest
…evplatform/chat-xdk into cursor/conversation-keys-1d8a
…evplatform/chat-xdk into cursor/conversation-keys-1d8a
kyletruong
approved these changes
Dec 4, 2026
tcaldwell-x
self-requested a review
December 5, 2026 01:39
… wrappers across all bindings
…thon example encrypt_reply
…e per-conversation decrypt auto-fetch
…ld-cache lookup, and target_event fallback
Accept historical pre-v6 conversation key changes in add_conversation_keys for decrypt-only backfill (matching x-android and inline decrypt_events), while keeping v6+ strict for sending and recover_send: - Track send_eligible per cached key entry so decrypt-only pre-v6 keys are never selected for sends, needs_conversation_key, or high-water advancement. - Verify pre-v6 1:1 key changes against stored signing keys and reject tampered/untrusted signatures; keep pre-v6 group key changes decrypt-only. - Track per-conversation earliest verified sequence_id per v6+ signature_version (populated from both inline decrypt_events and add_conversation_keys / recover_send) to reject newer-sequence signature-version downgrades across batches while allowing older backfill. - Add regression tests for pre-v6 group and 1:1 backfill, send/recovery exclusion, and downgrade floor enforcement.
- Remove stale, lineage, banner, and narrating comments across core, FFI, Go, Python, and WASM bindings and tests. - Add symmetric JSDoc comments across async send/file/group helpers in crates/wasm/js/chat.js and document intentional fallback suppression in crates/pyo3/python/chat_xdk/__init__.py.
This file contains hidden or 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
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.
Summary
Lets an app that sends without loading message history get the conversation key from
GET /2/chat/conversations/:id/keys, and recover when a send fails because that key is out of date or a recipient's key changed. This is in Rust, JS/WASM (browser and server), Python, Go, JVM, .NET, and Ruby.What the app does
set_resolve_conversation_keys(createChat({ resolveConversationKeys })in JS,ResolveConversationKeysin .NET). The SDK calls it with a REST conversation id (100-200for 1:1,g…for groups) and the key versions it needs ([]means latest).add_conversation_keys. The SDK checks each signedencoded_eventbefore it caches the key.decrypt_eventsuse that hook to fetch the missing key. In JS and .NET this is the async send path, for exampleencryptMessageAsync.recover_sendafter a send problem:conversation_key_out_of_date: loads a newer conversation key and returnsreencrypt, so the app re-encrypts and retries.recipient_key_changed: refreshes participant public keys, prepares a rotated key change, and returnsrotate_keywithkey_changeto publish before retrying.Example (JavaScript)