Skip to content
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

Merged
merged 31 commits into from
Mar 1, 2024

Conversation

giovasdistillery
Copy link
Contributor

added shouldPush to ContentCodec type
added shouldPush method to TextCodec and CompositeCodec
added senderHmac to MessageV2
added encryption methods for calculating HMAC signature

@giovasdistillery giovasdistillery requested a review from a team as a code owner January 26, 2024 16:40
@giovasdistillery giovasdistillery linked an issue Jan 26, 2024 that may be closed by this pull request
@giovasdistillery giovasdistillery marked this pull request as draft January 26, 2024 16:41
Copy link
Contributor

@nplasterer nplasterer left a 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. 🙏

@giovasdistillery giovasdistillery marked this pull request as ready for review February 8, 2024 08:19
Copy link
Contributor

@nplasterer nplasterer left a 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

@nplasterer nplasterer requested a review from Bren2010 February 13, 2024 19:03
@nplasterer
Copy link
Contributor

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.

fun getHmacKeys(
request: Keystore.GetConversationHmacKeysRequest? = null,
): Keystore.GetConversationHmacKeysResponse {
val thirtyDayPeriodsSinceEpoch = (Date().time / 1000 / 60 / 60 / 24 / 30).toInt()
Copy link

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kele-leanes kele-leanes force-pushed the gg/enhancement/add_sender_hmac_to_message_v2 branch from 9d57243 to 5050c30 Compare February 28, 2024 01:22
@nplasterer nplasterer merged commit 037b85b into main Mar 1, 2024
5 of 6 checks passed
@nplasterer nplasterer deleted the gg/enhancement/add_sender_hmac_to_message_v2 branch March 1, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sender HMAC to MessageV2
6 participants