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 crypto hmac sha 256 #685

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ewalk153
Copy link
Contributor

@ewalk153 ewalk153 commented Jul 2, 2024

Description of the change

Running crypto functions in Javascript quickly runs out of fuel, which rust is must more efficient at the job. This is a wrapper to expose the rust hmac-sha256 implementation to javy user code.

Why am I making this change?

To conserve fuel when running crypto. As a bonus, the crypto function is not left to end users to get right.

Checklist

  • I've updated the relevant CHANGELOG files if necessary. Changes to javy-cli and javy-core do not require updating CHANGELOG files.
  • I've updated the relevant crate versions if necessary. Versioning policy for library crates
  • I've updated documentation including crate documentation if necessary.

@ewalk153
Copy link
Contributor Author

ewalk153 commented Jul 2, 2024

This code still need a change log entry, on top of any polished suggested during code review.

Copy link
Member

@saulecabrera saulecabrera left a comment

Choose a reason for hiding this comment

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

Looks to be going in a good direction!

crates/javy-config/src/lib.rs Outdated Show resolved Hide resolved
crates/javy/src/config.rs Outdated Show resolved Hide resolved
@saulecabrera
Copy link
Member

The cargo vet failures are expected, since you're introducing new dependencies. We can resolve those once we're getting close to merging this one.

HmacSha256::new_from_slice(&js_string_secret.as_bytes()) =>
 HmacSha256::new_from_slice(js_string_secret.as_bytes())

 No need to pass in address here.

 Same for js_string_message.
Also drop javy_ prefix in anticipation of switching to winter cg.
Ran `cargo fmt -- --check`, and applied suggestions, per ci feedback.
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.

2 participants