From 92d73e458319a0bd3d897ebc795e52f0597392b7 Mon Sep 17 00:00:00 2001 From: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com> Date: Wed, 16 Nov 2022 09:43:49 +0200 Subject: [PATCH] fix: updates for SafePassword API change (#4927) Description --- Minor updates for a corresponding [change](https://github.com/tari-project/tari_utilities/pull/52) to the `SafePassword` API. Motivation and Context --- A pending change in `tari_utilities` to the handling of sensitive data includes a new implementation of `SafePassword`. One change removes derived traits for equality testing in favor of equality testing on references to the underlying passphrase data. This work makes the minor but necessary changes to address this API change. How Has This Been Tested? --- Tests pass after applying the linked `tari_utilities` PR. Note that tests will pass using the current `SafePassword` API as well, as the dependency change PR restricts the API. --- applications/tari_console_wallet/src/init/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/tari_console_wallet/src/init/mod.rs b/applications/tari_console_wallet/src/init/mod.rs index d282bd7134..ed2187b158 100644 --- a/applications/tari_console_wallet/src/init/mod.rs +++ b/applications/tari_console_wallet/src/init/mod.rs @@ -130,7 +130,7 @@ pub async fn change_password( let passphrase = prompt_password("New wallet password: ")?; let confirmed = prompt_password("Confirm new password: ")?; - if passphrase != confirmed { + if passphrase.reveal() != confirmed.reveal() { return Err(ExitError::new(ExitCode::InputError, "Passwords don't match!")); } @@ -376,7 +376,7 @@ pub async fn init_wallet( let password = prompt_password("Create wallet password: ")?; let confirmed = prompt_password("Confirm wallet password: ")?; - if password != confirmed { + if password.reveal() != confirmed.reveal() { return Err(ExitError::new(ExitCode::InputError, "Passwords don't match!")); }