Repository navigation
feat(chat-cipher): encrypt and decrypt private group messages and blobs - #1755
Merged
Merged
Conversation
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.
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.
Adds the scheme 2 (
CHAT_KEY_XCHACHA20POLY1305) cipher for private group messages and blobs toChatCipher, 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, outputnonce || ct.sender_idis the rawUserId.value, not a public key.group_cipher.jsonholds fixed vectors for messages, blobs and the group key wrap.scripts/gen_group_cipher.pygenerates them against libsodium rather thanDefaultChatCipher, so the iOS side can match bytes.GroupCipherVectorTestchecksDefaultChatCipheragainst them.FakeChatCiphergets stubs for the new methods.No app or UI code.