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

#4318 forc-crypto plugin exposing a CLI for common-use cryptographic operations #5153

Merged
merged 22 commits into from
Oct 28, 2023

Commits on Oct 28, 2023

  1. Add forc-crypto plugin exposing a CLI for common-use cryptographic op…

    …erations
    
    Fixes #4318
    
    Supported algorithms:
    * [x] keccak256
    * [x] sha256
    * [x] bech32-to-hex
    * [x] hex-to-bech32
    * [x] new-key
    * [x] new-parse secret
    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    0ba11b2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f5ec66b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4850633 View commit details
    Browse the repository at this point in the history
  4. Add a better naming

    It's either a file path *or* a binary (that may be encoded as a hex
    string otherwise it is a valid UTF-8 string).
    
    File content is always treated as a binary file, as is.
    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    5597cc1 View commit details
    Browse the repository at this point in the history
  5. Simplify HashArgs

    Added HashArgs which takes no or 1 argument.
    
    The usage is as follows:
      1. Zero or one argument is accepted
      2. If no argument is passed, `stdin` is being read
      3. The argument will be checked to be a file path, if it is the content
         will be loaded from the file
      4. Otherwise, the content is treated as a string
      5. If the string is "-", `stdin` is being read
      6. If the string starts with "0x", it will be treated as a hex string. Only
         fully valid hex strings are accepted.
      7. Any other string, or any malformed hex string will be treated as a
         vector of bytes
    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    810d08c View commit details
    Browse the repository at this point in the history
  6. Fixed clippy issues

    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    981dcb3 View commit details
    Browse the repository at this point in the history
  7. Move args related code to their own file

    Added unit tests to the argument parsing logic
    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    a5b7752 View commit details
    Browse the repository at this point in the history
  8. Fixed clippy issue

    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    0ea2170 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    7951ae4 View commit details
    Browse the repository at this point in the history
  10. Print secret message to tty, normal message otherwise

    Port 586ff3e547feddb782dde3d8dde7e45842df92ba from FuelLabs/fuel-core#1426
    
    Context: FuelLabs/fuel-core#1426 (comment)
    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    3756de5 View commit details
    Browse the repository at this point in the history
  11. Update forc-plugins/forc-crypto/Cargo.toml

    Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
    cr-fuel and JoshuaBatty committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    84a0f65 View commit details
    Browse the repository at this point in the history
  12. Update forc-plugins/forc-crypto/Cargo.toml

    Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
    cr-fuel and JoshuaBatty committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    035c2ee View commit details
    Browse the repository at this point in the history
  13. Update forc-plugins/forc-crypto/Cargo.toml

    Co-authored-by: Joshua Batty <joshpbatty@gmail.com>
    cr-fuel and JoshuaBatty committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    599d6b0 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    b154b73 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    3a8da24 View commit details
    Browse the repository at this point in the history
  16. Update forc-plugins/forc-crypto/src/keygen/new_key.rs

    Co-authored-by: Sophie Dankel <47993817+sdankel@users.noreply.github.com>
    cr-fuel and sdankel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    034c4c0 View commit details
    Browse the repository at this point in the history
  17. Have a better way to print to stdout

    Each handler will return a serde_json::Value instead of printing
    themselves
    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    57ecabc View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    1a5ae28 View commit details
    Browse the repository at this point in the history
  19. Add doc-comments

    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    a7eca67 View commit details
    Browse the repository at this point in the history
  20. Cargo fmt

    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    c79d7da View commit details
    Browse the repository at this point in the history
  21. Update test

    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    1583fe5 View commit details
    Browse the repository at this point in the history
  22. Addressed suggestions

    cr-fuel committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    d22eab0 View commit details
    Browse the repository at this point in the history