Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add VecSignedMessage type alias #46

Merged
merged 1 commit into from
Apr 9, 2023

Conversation

SimenB
Copy link
Contributor

@SimenB SimenB commented Apr 6, 2023

This provides similar utility as VecBox in dryocsecretbox, allowing the following:

let message: Vec<u8> = some_message_from_somewhere;

let secret_box = VecBox::from_bytes(message).unwrap();

let message = secret_box.decrypt_to_vec(&nonce, &secret_key).unwrap();

let signed_message = VecSignedMessage::from_bytes(&message).unwrap();

signed_message.verify(public_key).unwrap();

let (_signature, message) = signed_message.into_parts();

// use unpacked `message`.

without VecSignedMessage, the from_bytes call on SignedMessage needs type annotations.

(Caveat - while I've used libsodium in javascript before, I'm very new to writing Rust. So this might not make sense 😀)

@netlify
Copy link

netlify bot commented Apr 6, 2023

Deploy Preview for dryoc-docs ready!

Name Link
🔨 Latest commit 846de8a
🔍 Latest deploy log https://app.netlify.com/sites/dryoc-docs/deploys/642efeac76891600084b8cf7
😎 Deploy Preview https://deploy-preview-46--dryoc-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented Apr 9, 2023

Codecov Report

Merging #46 (846de8a) into main (949891e) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #46   +/-   ##
=======================================
  Coverage   65.19%   65.19%           
=======================================
  Files          44       44           
  Lines        3166     3166           
=======================================
  Hits         2064     2064           
  Misses       1102     1102           
Impacted Files Coverage Δ
src/sign.rs 15.78% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@brndnmtthws brndnmtthws merged commit 64b4197 into brndnmtthws:main Apr 9, 2023
@SimenB SimenB deleted the VecSignedMessage branch April 11, 2023 08:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants