Update deps (#768)

* build: update grin submodule to last staging

* build: update grin submodule

* build: remove remove_dir_all dependency

* build: update rpassword

* build: update semver

* build: remove unused deps

* build: update ring

* build: update lock file deps

* build: update rustyline

* build: update ed25519-dalek

* build: update curve25519-dalek

* build: update age

* build: update uuid

* fix: uuid test

* build: update x25519-dalek

* fix: x25519-dalek build

* build: update arti

* build: update grin submodule

* build: update hyper

* fix: initialize rustls provider for tests

* build: update grin submodule

* fix: rustls install provider

* tor: share getting private key

* fix: show an error on node version parse

* cli: renamed prompt password method

* fix: replace into_boxed_slice with try_from

* fix: dalek tests for onion

* config: comment expanded secret key

* fix: import api body for controller

* password: handle prompt error

* wallet: parse node error message

* tests: do not use random values for sign messages

* build: make hook executable

* build: cargo format all

* rustls: do not install provider at tests and globally

* build: update grin submodule

* build: fix api channel from grin submodule

* args: use read_password for piped prompt

* build: remove unused dep

* test: fixed signature

* preserve piped pw input

---------

Co-authored-by: wiesche <wiesche89@googlemail.com>
This commit is contained in:
ardocrat
2026-07-16 20:24:09 +02:00
committed by GitHub
co-authored by wiesche
parent 876ee1c277
commit e9e27f4feb
38 changed files with 1051 additions and 1438 deletions
+14 -4
View File
@@ -42,11 +42,21 @@ where
// This will also cache the node version info for calls to foreign API check middleware
if let Some(v) = node_client.clone().get_version_info() {
if Version::parse(&v.node_version) < Version::parse(MIN_COMPAT_NODE_VERSION) {
println!("The Grin Node in use (version {}) is outdated and incompatible with this wallet version.", v.node_version);
let node_version = Version::parse(&v.node_version);
let min_version = Version::parse(MIN_COMPAT_NODE_VERSION).ok();
if let Ok(v) = node_version {
if Some(v.clone()) < min_version {
println!("The Grin Node in use (version {}) is outdated and incompatible with this wallet version.", v);
println!(
"Please update the node to version {} or later and try again.",
MIN_COMPAT_NODE_VERSION
);
return 1;
}
} else {
println!(
"Please update the node to version {} or later and try again.",
MIN_COMPAT_NODE_VERSION
"Can not parse node version {}. Minimal compatible node version: {}",
v.node_version, MIN_COMPAT_NODE_VERSION
);
return 1;
}
+38 -21
View File
@@ -12,13 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/// Argument parsing and error handling for wallet commands
use crate::api::TLSConfig;
use crate::cli::command_loop;
use crate::config::GRIN_WALLET_DIR;
use crate::util::file::get_first_line;
use crate::util::secp::key::SecretKey;
use crate::util::{Mutex, ZeroingString};
/// Argument parsing and error handling for wallet commands
use clap::ArgMatches;
use grin_core as core;
use grin_core::core::amount_to_hr_string;
@@ -33,6 +34,7 @@ use linefeed::terminal::Signal;
use linefeed::{Interface, ReadResult};
use rpassword;
use std::convert::TryFrom;
use std::io::{IsTerminal, Write};
use std::path::{Path, PathBuf};
use std::sync::Arc;
@@ -67,25 +69,39 @@ impl From<std::io::Error> for ParseError {
}
}
fn prompt_password_stdout(prompt: &str) -> ZeroingString {
ZeroingString::from(rpassword::prompt_password_stdout(prompt).unwrap())
fn prompt_password_internal(prompt: &str) -> Result<ZeroingString, Error> {
print!("{}", prompt);
std::io::stdout().flush().unwrap();
let stdin = std::io::stdin();
let password = if stdin.is_terminal() {
rpassword::read_password()
} else {
rpassword::read_password_with_config(
rpassword::ConfigBuilder::new()
.input_reader(stdin)
.output_discard()
.build(),
)
}
.map_err(|e| Error::GenericError(format!("{}", e)))?;
Ok(ZeroingString::from(password))
}
pub fn prompt_password(password: &Option<ZeroingString>) -> ZeroingString {
pub fn prompt_password(password: &Option<ZeroingString>) -> Result<ZeroingString, Error> {
match password {
None => prompt_password_stdout("Password: "),
Some(p) => p.clone(),
None => Ok(prompt_password_internal("Password: ")?),
Some(p) => Ok(p.clone()),
}
}
fn prompt_password_confirm() -> ZeroingString {
fn prompt_password_confirm() -> Result<ZeroingString, Error> {
let mut first = ZeroingString::from("first");
let mut second = ZeroingString::from("second");
while first != second {
first = prompt_password_stdout("Password: ");
second = prompt_password_stdout("Confirm Password: ");
first = prompt_password_internal("Password: ")?;
second = prompt_password_internal("Confirm Password: ")?;
}
first
Ok(first)
}
fn prompt_recovery_phrase<L, C, K>(
@@ -333,7 +349,7 @@ pub fn parse_init_args<L, C, K>(
g_args: &command::GlobalArgs,
args: &ArgMatches,
_test_mode: bool,
) -> Result<command::InitArgs, ParseError>
) -> Result<command::InitArgs, Error>
where
DefaultWalletImpl<C>: WalletInst<'static, L, C, K>,
L: WalletLCProvider<'static, C, K>,
@@ -345,7 +361,9 @@ where
true => 16,
};
let recovery_phrase = match args.is_present("recover") {
true => Some(prompt_recovery_phrase(wallet)?),
true => {
Some(prompt_recovery_phrase(wallet).map_err(|e| Error::GenericError(e.to_string()))?)
}
false => None,
};
@@ -355,10 +373,11 @@ where
println!("Please enter a password for your new wallet");
}
let password = g_args
.password
.clone()
.unwrap_or_else(|| prompt_password_confirm());
let password = if let Some(p) = g_args.password.clone() {
p
} else {
prompt_password_confirm()?
};
Ok(command::InitArgs {
list_length,
@@ -369,12 +388,10 @@ where
})
}
pub fn parse_recover_args(
g_args: &command::GlobalArgs,
) -> Result<command::RecoverArgs, ParseError>
pub fn parse_recover_args(g_args: &command::GlobalArgs) -> Result<command::RecoverArgs, Error>
where
{
let passphrase = prompt_password(&g_args.password);
let passphrase = prompt_password(&g_args.password)?;
Ok(command::RecoverArgs { passphrase })
}
@@ -1073,7 +1090,7 @@ where
let lc = wallet_lock.lc_provider()?;
let mask = lc.open_wallet(
None,
prompt_password(&global_wallet_args.password),
prompt_password(&global_wallet_args.password)?,
false,
false,
)?;