Skip to content

feat(chat-cipher): encrypt and decrypt private group messages and blobs - #1755

Merged
bmc08gt merged 1 commit into
code/cashfrom
feat/chat-cipher-group-messages
Oct 11, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
feat/chat-cipher-group-messages

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Adds the scheme 2 (CHAT_KEY_XCHACHA20POLY1305) cipher for private group messages and blobs to ChatCipher, split out of the private groups branch so shared-core can ship it before the app side lands, as with #1745.

  • encryptGroup / decryptGroup: XChaCha20-Poly1305 under the shared group key, aad "flipcash-group-e2ee-v1" || chat_id || sender_id.
  • encryptGroupBlob / decryptGroupBlob: same key, aad "flipcash-group-e2ee-blob-v1" || chat_id || blob_id || sender_id, output nonce || ct.
  • sender_id is the raw UserId.value, not a public key.

group_cipher.json holds fixed vectors for messages, blobs and the group key wrap. scripts/gen_group_cipher.py generates them against libsodium rather than DefaultChatCipher, so the iOS side can match bytes. GroupCipherVectorTest checks DefaultChatCipher against them. FakeChatCipher gets stubs for the new methods.

No app or UI code.

Private groups send scheme 2 (CHAT_KEY_XCHACHA20POLY1305): XChaCha20-Poly1305 under the shared
group key, with aad "flipcash-group-e2ee-v1" || chat_id || sender_id for messages and
"flipcash-group-e2ee-blob-v1" || chat_id || blob_id || sender_id for blobs (nonce || ct).
sender_id is the raw UserId.value, not a public key.

group_cipher.json holds fixed vectors for messages, blobs and the group key wrap, generated by
scripts/gen_group_cipher.py against libsodium rather than DefaultChatCipher, so another
implementation can match bytes.
@bmc08gt bmc08gt self-assigned this Oct 11, 2026
@github-actions github-actions Bot added area: crypto Solana, keys, encryption, signing type: feature New functionality area: network gRPC, connectivity, API, exchange rates labels Oct 11, 2026
@bmc08gt
bmc08gt merged commit fde9c3a into code/cash Oct 11, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: crypto Solana, keys, encryption, signing area: network gRPC, connectivity, API, exchange rates type: feature New functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant