feat: add message-edit and message-delete producers#8
Merged
Conversation
|
|
santiagomed
force-pushed
the
santiagomed/edit-delete-producers
branch
from
July 24, 2026 02:42
e2b989b to
8ad6ddb
Compare
Adds the two producer APIs that let SDK callers edit and delete messages: - encrypt_edit(EncryptEditParams): encrypts a MessageEdit content payload (target sequence id, replacement text, entities) as a regular signed MessageCreateEvent, sendable through the existing message-send channel. The decoded Edit content now also surfaces its entities, which were previously dropped. - prepare_message_delete(MessageDeleteParams): builds and signs the plaintext MessageDeleteEvent action (delete-for-self or delete-for-all over one or more sequence ids), returning the ActionSignature with the encoded event detail, ready to submit alongside a delete request. The 1:1 conversation id is canonicalized to the colon form before signing. All six bindings gain the new surface with matching semantics (wasm/JS, Python, Go, .NET, JVM), docs/API.md tables are updated in lockstep, and each binding's test suite covers the new methods, including exact signature-payload pins and an encrypt-edit decrypt round trip with signature verification. The darwin_arm64 Go prebuilt is regenerated; the linux prebuilts need a machine with cargo-zigbuild (or the prebuilt workflow) before release.
santiagomed
force-pushed
the
santiagomed/edit-delete-producers
branch
from
July 24, 2026 20:54
1c2114d to
08acf69
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Closes the produce-side gap for message edits and deletes. The SDK could already decrypt both (
contentType: 'edit'andEvent::MessageDeleted) but had no way to create them.encrypt_edit(EncryptEditParams)An edit is an encrypted
MessageEditcontent payload — target sequence id, replacement text, and rich-text entities — signed and packaged as a regularMessageCreateEvent, so it ships through the existing message-send channel with a fresh SDK-minted message id. Params mirrorEncryptReactionParams: passtargetEvent(the raw event being edited) and the SDK derives the conversation id and target sequence id, or pass the explicit fields. The conversation key resolves from the opt-in cache; key material is zeroized on drop and redacted from Debug.Consumer fix bundled in: decoded
Editcontent now surfaces itsentities, which were previously parsed off the wire and dropped.prepare_message_delete(MessageDeleteParams)A delete is a plaintext signed event, not an encrypted message. This builds the thrift
MessageDeleteEvent(sequence ids + delete-for-self/delete-for-all), signs the payloadMessageDeleteEvent,{msg_id},{sender_id},{conv_id},{action},{sequence_ids...}and returns an
ActionSignaturecarrying the encoded event detail — the shape receiving clients verify with the existingMessageDeleteEventarm of the signature verifier. The 1:1 conversation id is canonicalized to the colon form before signing.Binding parity
All six surfaces move together per AGENTS.md §2: Rust core, wasm/JS (
encryptEdit/prepareMessageDelete+index.d.tstypes), Python (encrypt_edit/prepare_message_delete+.pyistubs), Go (EncryptEdit/PrepareMessageDelete), .NET, and JVM.docs/API.mdtables updated in lockstep;examples/js/src/chat-core.mjsgains thin passthroughs.Testing
build_event_signature_payloadfor both delete actions (exact payload pins, canonical colon-form id from a hyphen-form input), encoded-detail thrift round trip, empty-sequence_idsrejection, and an encrypt-edit →decrypt_eventround trip asserting verified content with entities.make ciclean (fmt, clippy-D warnings, 554 workspace tests).Notes
cargo-zigbuild(or the prebuilt workflow) before release.MessageEditthrift struct and the delete signs the payload form the verifier already reconstructs.