Enhance error check in CryptoModule decrypt. Add encrypted message hash to error message.
Summary:
This differential addresses crypto sync follow ups described there: https://linear.app/comm/issue/ENG-4886/nse-error-during-notif-decryption-bad-message-mac#comment-7b6b9979. In particular:
- EncryptedData is passed by reference.
- Error checking for olm_max_decrypt_plaintext_length is implemented.
- Hash of encrypted message is calculated before decryption. In the case of failure, hash of the message is appended to error message.
- Notifications Service Extension adds notifications id to error message notification. NOTE: it is NOT id of an entry in notifications table in MariaDB. It is the iosID field of delivery column of an entry in notifications table.
Test Plan:
- Build iOS app,
- Apply this patch to the keyserver code to send each encrypted notification twice: https://gist.github.com/marcinwasowicz/5011d3c1d5418e1a3af06f6be182e739.
- Send notification to iOS device.
- Ensure that the second notification contains the hash and id of the notification received,
Reviewers: kamil, tomek, varun
Reviewed By: kamil
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D9178