From bdb47ee691f0302c05daaf0278b606fbaf319f61 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Fri, 28 Jun 2024 13:38:09 +0200 Subject: Update dependency version Additionally, we start using `ethdigest` instead of the `sha3` crate for doing Keccak-256 hashing and representing digest types in code. --- src/cmd/sign.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/cmd/sign.rs') 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") -} -- cgit v1.2.3