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

feat(types)!: use Mnemonic type from crypto.rs #471

Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b2ec73b
add mnemonic type
Alex6323 May 22, 2023
b35b895
try from
Alex6323 May 23, 2023
215e6cd
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 May 23, 2023
4166575
update changelog
Alex6323 May 23, 2023
9d7e0fb
fix doc comment
Alex6323 May 23, 2023
c7ff0bb
move Mnemonic type to mnemonic module; introduce MnemonicLike trait
Alex6323 May 23, 2023
c558eca
format
Alex6323 May 24, 2023
b0640a7
fix ci
Alex6323 May 24, 2023
e1a845b
update changelog
Alex6323 May 24, 2023
fdf033e
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 May 25, 2023
2d69c33
impl MemonicLike for word list
Alex6323 May 25, 2023
a066603
add test
Alex6323 May 31, 2023
4d585b2
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 May 31, 2023
26e43d2
improve test
Alex6323 Jun 1, 2023
9d8b94a
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 1, 2023
1e60246
Mnemonic type in response
Alex6323 Jun 1, 2023
a8de867
giant dynamic museum toddler :sunglasses:
Alex6323 Jun 2, 2023
01477b1
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 2, 2023
8524c5e
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 5, 2023
4ccfe80
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 5, 2023
91ec56d
review suggestions
Alex6323 Jun 5, 2023
0c1c2f0
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 7, 2023
04a123a
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 29, 2023
8723e8b
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jul 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions bindings/core/src/method_handler/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use iota_sdk::{
client::{hex_public_key_to_bech32_address, hex_to_bech32, verify_mnemonic, Client},
client::{hex_public_key_to_bech32_address, hex_to_bech32, secret::mnemonic::Mnemonic, Client},
types::block::{
address::{dto::AddressDto, Address, Ed25519Address},
output::{AliasId, FoundryId, NftId},
Expand All @@ -11,7 +11,6 @@ use iota_sdk::{
Block,
},
};
use zeroize::Zeroize;

use crate::{method::UtilsMethod, response::Response, Result};

Expand All @@ -29,11 +28,9 @@ pub(crate) fn call_utils_method_internal(method: UtilsMethod) -> Result<Response
}
UtilsMethod::ParseBech32Address { address } => Response::ParsedBech32Address(AddressDto::from(address.inner())),
UtilsMethod::IsAddressValid { address } => Response::Bool(Address::is_valid_bech32(&address)),
UtilsMethod::GenerateMnemonic => Response::GeneratedMnemonic(Client::generate_mnemonic()?),
UtilsMethod::MnemonicToHexSeed { mut mnemonic } => {
let response = Response::MnemonicHexSeed(Client::mnemonic_to_hex_seed(&mnemonic)?);
mnemonic.zeroize();
response
UtilsMethod::GenerateMnemonic => Response::GeneratedMnemonic(Client::generate_mnemonic()?.as_str().to_owned()),
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
UtilsMethod::MnemonicToHexSeed { mnemonic } => {
Response::MnemonicHexSeed(Client::mnemonic_to_hex_seed(&mnemonic.try_into()?))
}
UtilsMethod::BlockId { block } => {
let block = Block::try_from_dto_unverified(&block)?;
Expand Down Expand Up @@ -63,9 +60,8 @@ pub(crate) fn call_utils_method_internal(method: UtilsMethod) -> Result<Response
let address = Ed25519Address::try_from(&address)?;
Response::Bool(signature.is_valid(&msg, &address).is_ok())
}
UtilsMethod::VerifyMnemonic { mut mnemonic } => {
verify_mnemonic(&mnemonic)?;
mnemonic.zeroize();
UtilsMethod::VerifyMnemonic { mnemonic } => {
let _ = Mnemonic::try_from(mnemonic)?;
Response::Ok
}
};
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/tests/secrets_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use iota_sdk_bindings_core::{CallMethod, Response, Result, SecretManagerMethod};
#[tokio::test]
async fn generate_addresses() -> Result<()> {
let secret_manager = SecretManager::try_from_mnemonic(
"endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river",
"endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river".to_owned(),
)?;

let method = SecretManagerMethod::GenerateAddresses {
Expand Down
43 changes: 22 additions & 21 deletions cli/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use chrono::{DateTime, NaiveDateTime, Utc};
use clap::Parser;
use dialoguer::{console::Term, theme::ColorfulTheme, Input, Password, Select};
use iota_sdk::{
client::verify_mnemonic,
client::secret::mnemonic::Mnemonic,
wallet::{Account, Wallet},
};
use tokio::{
Expand Down Expand Up @@ -107,7 +107,7 @@ pub async fn bytes_from_hex_or_file(hex: Option<String>, file: Option<String>) -
})
}

pub async fn enter_or_generate_mnemonic() -> Result<String, Error> {
pub async fn enter_or_generate_mnemonic() -> Result<Mnemonic, Error> {
let choices = ["Generate a new mnemonic", "Enter a mnemonic"];
let selected_choice = Select::with_theme(&ColorfulTheme::default())
.with_prompt("Select how to provide a mnemonic")
Expand All @@ -124,7 +124,7 @@ pub async fn enter_or_generate_mnemonic() -> Result<String, Error> {
Ok(mnemnonic)
}

pub async fn generate_mnemonic() -> Result<String, Error> {
pub async fn generate_mnemonic() -> Result<Mnemonic, Error> {
let mnemonic = iota_sdk::client::generate_mnemonic()?;
println_log_info!("Mnemonic has been generated.");
let choices = [
Expand All @@ -141,7 +141,7 @@ pub async fn generate_mnemonic() -> Result<String, Error> {

if [0, 2].contains(&selected_choice) {
println!("YOUR MNEMONIC:");
println!("{}", mnemonic);
println!("{}", mnemonic.as_str());
}
if [1, 2].contains(&selected_choice) {
write_mnemonic_to_file(DEFAULT_MNEMONIC_FILE_PATH, &mnemonic).await?;
Expand All @@ -157,20 +157,22 @@ pub async fn generate_mnemonic() -> Result<String, Error> {
Ok(mnemonic)
}

pub fn enter_mnemonic() -> Result<String, Error> {
pub fn enter_mnemonic() -> Result<Mnemonic, Error> {
loop {
let input = Input::<String>::new()
.with_prompt("Enter your mnemonic")
.interact_text()?;
if verify_mnemonic(&input).is_err() {
println_log_error!("Invalid mnemonic. Please enter a bip-39 conform mnemonic.");
} else {
return Ok(input);

match Mnemonic::try_from(input) {
Err(e) => {
println_log_error!("Invalid mnemonic: {e:?}\nPlease enter a bip-39 conform mnemonic.");
}
Ok(mnemonic) => return Ok(mnemonic),
}
}
}

pub async fn import_mnemonic(path: &str) -> Result<String, Error> {
pub async fn import_mnemonic(path: &str) -> Result<Mnemonic, Error> {
let mut mnemonics = read_mnemonics_from_file(path).await?;
if mnemonics.is_empty() {
println_log_error!("No valid mnemonics found in '{path}'.");
Expand All @@ -194,27 +196,26 @@ pub async fn import_mnemonic(path: &str) -> Result<String, Error> {
}
}

async fn write_mnemonic_to_file(path: &str, mnemonic: &str) -> Result<(), Error> {
async fn write_mnemonic_to_file(path: &str, mnemonic: &Mnemonic) -> Result<(), Error> {
let mut file = OpenOptions::new().create(true).append(true).open(path).await?;
file.write_all(format!("{mnemonic}\n").as_bytes()).await?;
file.write_all(format!("{}\n", mnemonic.as_str()).as_bytes()).await?;

Ok(())
}

async fn read_mnemonics_from_file(path: &str) -> Result<Vec<String>, Error> {
async fn read_mnemonics_from_file(path: &str) -> Result<Vec<Mnemonic>, Error> {
let file = OpenOptions::new().read(true).open(path).await?;
let mut lines = BufReader::new(file).lines();
let mut mnemonics = Vec::new();
let mut line_index = 1;
while let Some(line) = lines.next_line().await? {
// we allow surrounding whitespace in the file
let trimmed = line.trim();
if verify_mnemonic(trimmed).is_ok() {
mnemonics.push(trimmed.to_string());
} else {
return Err(Error::Miscellaneous(format!(
"Invalid mnemonic in file '{path}' at line '{line_index}'."
)));
match Mnemonic::try_from(line) {
Ok(mnemonic) => mnemonics.push(mnemonic),
Err(err) => {
return Err(Error::Miscellaneous(format!(
"Invalid mnemonic in file '{path}' at line '{line_index}':\n{err:?}"
)));
}
}
line_index += 1;
}
Expand Down
1 change: 1 addition & 0 deletions sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Storage and Backup migration;
- `types::block::Error::InvalidFoundryZeroSerialNumber` variant;
- Added `Hrp` type to represent a valid bech32 human-readable part;
- Added `Mnemonic` type to handle mnemonic data more securely by implementing `ZeroizeOnDrop`;

### Changed

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/01_generate_addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn main() -> Result<()> {
.await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

// Generate addresses with default account index and range
let addresses = client.get_addresses(&secret_manager).finish().await?;
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/block/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/block/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let block = client
.block()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async fn main() -> Result<()> {
// Creates a client instance.
let offline_client = Client::builder().finish().await?;
let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

// Generates an address offline.
let address = offline_client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async fn main() -> Result<()> {
dotenvy::dotenv().ok();

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let prepared_transaction_data = read_prepared_transaction_from_file(PREPARED_TRANSACTION_FILE_NAME)?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let addresses = client.get_addresses(&secret_manager).with_range(0..2).finish().await?;
let sender_address = addresses[0];
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/foundry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/micro_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let addresses = client.get_addresses(&secret_manager).with_range(0..2).finish().await?;
let sender_address = addresses[0];
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/native_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let addresses = client.get_addresses(&secret_manager).with_range(0..2).finish().await?;
let sender_address = addresses[0];
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/recursive_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let address = client.get_addresses(&secret_manager).with_range(0..1).finish().await?[0];
println!("{}", request_funds_from_faucet(&faucet_url, &address).await?);
Expand Down
4 changes: 2 additions & 2 deletions sdk/examples/client/participation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn main() -> Result<()> {
}

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
let bech32_address = client.get_addresses(&secret_manager).with_range(0..1).finish().await?[0];

let faucet_url = std::env::var("FAUCET_URL").unwrap();
Expand Down Expand Up @@ -90,7 +90,7 @@ async fn main() -> Result<()> {

async fn participate(client: &Client, event_id: ParticipationEventId) -> Result<()> {
let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;
let rent_structure = client.get_rent_structure().await?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use iota_sdk::client::{Client, Result};
async fn main() -> Result<()> {
let mnemonic = Client::generate_mnemonic()?;

println!("Mnemonic: {mnemonic}");
println!("Mnemonic: {}", mnemonic.as_str());

Ok(())
}
2 changes: 1 addition & 1 deletion sdk/examples/wallet/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<()> {
let client_options = ClientOptions::new().with_node(&std::env::var("NODE_URL").unwrap())?;

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/background_syncing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn main() -> Result<()> {
let client_options = ClientOptions::new().with_node(&std::env::var("NODE_URL").unwrap())?;

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async fn main() -> Result<()> {
let client_options = ClientOptions::new().with_node(&std::env::var("NODE_URL").unwrap())?;

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async fn main() -> Result<()> {
let client_options = ClientOptions::new().with_node(&std::env::var("NODE_URL").unwrap())?;

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/output_consolidation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async fn main() -> Result<()> {
// This example uses secrets in environment variables for simplicity which should not be done in production.
dotenvy::dotenv().ok();

let mnemonic: &str = &std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap();
let mnemonic = std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap();
let mnemonic_secret_manager = MnemonicSecretManager::try_from_mnemonic(mnemonic).unwrap();
let secret_manager = SecretManager::Mnemonic(mnemonic_secret_manager);

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/participation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn main() -> Result<()> {
.with_ignore_node_health();

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<()> {
let client_options = ClientOptions::new().with_node(&std::env::var("NODE_URL").unwrap())?;

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/wallet/pong.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<()> {
let client_options = ClientOptions::new().with_node(&std::env::var("NODE_URL").unwrap())?;

let secret_manager =
MnemonicSecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
MnemonicSecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let wallet = Wallet::builder()
.with_secret_manager(SecretManager::Mnemonic(secret_manager))
Expand Down
Loading