-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sender HMAC to MessageV2 #164
Add sender HMAC to MessageV2 #164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed up a commit to hopefully unblock you. I think adding a test to make sure we can get the shouldPush method like we can with fallbacks would be much appreciated. 🙏
library/src/main/java/org/xmtp/android/library/codecs/ReactionCodec.kt
Outdated
Show resolved
Hide resolved
library/src/main/java/org/xmtp/android/library/messages/MessageV2.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good. Just have some concerns about the cryptography. Also Rich mentioned that this might be missing the method getV2ConversationHmacKeys()
https://github.com/xmtp/xmtp-js/pull/519/files#diff-3f8d138711ab8a38267eef7baab8b362cbe3deee7fda5e18689bae9c2db74bb9
Merging in @kele-leanes #184 to unblock RN looks to have broken a few places in the code. We can revert this PR if there is a better approach to how to support RN. |
library/src/androidTest/java/org/xmtp/android/library/CodecTest.kt
Outdated
Show resolved
Hide resolved
library/src/androidTest/java/org/xmtp/android/library/CodecTest.kt
Outdated
Show resolved
Hide resolved
fun getHmacKeys( | ||
request: Keystore.GetConversationHmacKeysRequest? = null, | ||
): Keystore.GetConversationHmacKeysResponse { | ||
val thirtyDayPeriodsSinceEpoch = (Date().time / 1000 / 60 / 60 / 24 / 30).toInt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason this is different than the previously used value?
Instant.now().epochSecond / 60 / 60 / 24 / 30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just copying how you did it here: https://github.com/xmtp/xmtp-js/pull/519/files#diff-3f8d138711ab8a38267eef7baab8b362cbe3deee7fda5e18689bae9c2db74bb9R306
library/src/main/java/org/xmtp/android/library/Conversations.kt
Outdated
Show resolved
Hide resolved
library/src/main/java/org/xmtp/android/library/messages/DecryptedMessage.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Brendan McMillion <[email protected]>
Co-authored-by: Brendan McMillion <[email protected]>
Co-authored-by: Brendan McMillion <[email protected]>
9d57243
to
5050c30
Compare
added shouldPush to ContentCodec type
added shouldPush method to TextCodec and CompositeCodec
added senderHmac to MessageV2
added encryption methods for calculating HMAC signature