diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2024-06-28 13:38:09 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2024-06-28 13:38:13 +0200 |
| commit | bdb47ee691f0302c05daaf0278b606fbaf319f61 (patch) | |
| tree | 3c414c0adbcfa8a76255502e9d5d38bdbb31d5d0 /src/cmd/sign.rs | |
| parent | 0f523a185ff67848e890156c04b95f765969051d (diff) | |
Update dependency version
Additionally, we start using `ethdigest` instead of the `sha3` crate for
doing Keccak-256 hashing and representing digest types in code.
Diffstat (limited to 'src/cmd/sign.rs')
| -rw-r--r-- | src/cmd/sign.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/cmd/sign.rs b/src/cmd/sign.rs index d3005ea..75cc2bc 100644 --- a/src/cmd/sign.rs +++ b/src/cmd/sign.rs @@ -1,14 +1,15 @@ //! Module implementing the `sign` subcommand for generating ECDSA signatures. use crate::cmd::{self, AccountOptions}; -use anyhow::{ensure, Context as _, Result}; +use anyhow::{ensure, Result}; use clap::Parser; +use ethdigest::Digest; use hdwallet::{ message::EthereumMessage, transaction::{LegacyTransaction, Transaction}, typeddata::TypedData, }; -use std::{convert::TryInto, path::PathBuf}; +use std::path::PathBuf; #[derive(Debug, Parser)] pub struct Options { @@ -58,8 +59,8 @@ enum Input { /// Sign a raw data. Raw { /// The 32 byte message to sign specified as a hexadecimal string. - #[clap(name = "BYTES", value_parser = permissive_hex_digest)] - message: [u8; 32], + #[clap(name = "BYTES")] + message: Digest, }, } @@ -101,9 +102,3 @@ pub fn run(options: Options) -> Result<()> { } Ok(()) } - -fn permissive_hex_digest(s: &str) -> Result<[u8; 32]> { - cmd::permissive_hex(s)?[..] - .try_into() - .context("message for signing must be exactly 32 bytes long") -} |
