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

Feature/issue 16 #61

Merged
merged 13 commits into from
Jun 7, 2024
Merged

Feature/issue 16 #61

merged 13 commits into from
Jun 7, 2024

Conversation

omibo
Copy link
Collaborator

@omibo omibo commented Apr 13, 2024

This pull request addresses the following issues:

  • Implemented save_to_file functionality for KeyPair.
  • Added corresponding CLI support.

To execute the command, use the following syntax:
capycrypt new_keypair "pw" "owner" -b 256 --output "output.json"

Note: The curve input has been excluded for now as it is not part of the KeyPair::new() method.

@Dustin-Ray
Copy link
Owner

this looks awesome so far, thanks for all of the effort on this! the next step would be to make sure you can open a file, and include a unit test showing a round trip test of some operation involving a keypair like signing and verifying a message, or encrypting and decrypting, existing tests for these already exist in integration tests

@omibo
Copy link
Collaborator Author

omibo commented Apr 21, 2024

@drcapybara
I added integration test for reading from and writing to a file. Also, I implemented deserialization for keypair struct.

@Dustin-Ray
Copy link
Owner

Dustin-Ray commented Apr 22, 2024

@drcapybara I added integration test for reading from and writing to a file. Also, I implemented deserialization for keypair struct.

Perfect! Everything looks great! Thanks so much for this. The last thing to do on this to merge this in is to do the exact same thing for the Message type. All you need to do is:

  • update Cargo.toml, bump version of tiny_ed448_goldilocks = "0.1.8"
  • derive Serialize, Deserialize for the Message type in lib.rs. You also need to add the derive macro to the SecParam type as well.
  • A round trip test: 1. create a new message, 2. create a new keypair 3. save them to a file, 4. load them back into the program, sign the message with key, 5. save the message to a file, 6. load it back into memory 7. verify the signature exactly how you did it with the keypair roundtrip test
  • saving the keypair to a file should always include the public key. it should optionally include the private key. in save keypair to file, include an argument to the function "save_private_key: bool". if true, the private key is saved as Some(key), if false, private key is saved as None.

Then this is ready to merge in! You're doing great work so far!

src/ops.rs Outdated Show resolved Hide resolved
src/ops.rs Outdated Show resolved Hide resolved
src/main.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
Copy link
Owner

@Dustin-Ray Dustin-Ray left a comment

Choose a reason for hiding this comment

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

Looks great, you can merge if you would like! This is a great foundation to introduce the rest of the commands into the library

@omibo omibo merged commit 4befdd8 into Dustin-Ray:main Jun 7, 2024
1 check passed
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