diff --git a/cmd/soroban-cli/src/config/locator.rs b/cmd/soroban-cli/src/config/locator.rs index c87b1f55e..f72006e2e 100644 --- a/cmd/soroban-cli/src/config/locator.rs +++ b/cmd/soroban-cli/src/config/locator.rs @@ -273,7 +273,7 @@ impl Args { let identity = self.read_identity(name)?; if let Secret::SecureStore { entry_name } = identity { let entry = StellarEntry::new(&entry_name)?; - match entry.delete_password() { + match entry.delete_seed_phrase() { Ok(()) => {} Err(e) => match e { signer::keyring::Error::Keyring(keyring::Error::NoEntry) => { diff --git a/cmd/soroban-cli/src/signer/keyring.rs b/cmd/soroban-cli/src/signer/keyring.rs index 7d8f43bcb..b2359ef30 100644 --- a/cmd/soroban-cli/src/signer/keyring.rs +++ b/cmd/soroban-cli/src/signer/keyring.rs @@ -36,7 +36,7 @@ impl StellarEntry { Ok(self.keyring.get_password()?.parse()?) } - pub fn delete_password(&self) -> Result<(), Error> { + pub fn delete_seed_phrase(&self) -> Result<(), Error> { Ok(self.keyring.delete_credential()?) } @@ -150,23 +150,26 @@ mod test { } #[test] - fn test_delete_password() { + fn test_delete_seed_phrase() { set_default_credential_builder(mock::default_credential_builder()); - // add a keyring entry + //create a seed phrase + let seed_phrase = crate::config::secret::seed_phrase_from_seed(None).unwrap(); + + // create a keyring entry and set the seed_phrase let entry = StellarEntry::new("test").unwrap(); - entry.set_password("test password".as_bytes()).unwrap(); + entry.set_seed_phrase(seed_phrase).unwrap(); // assert it is there - let get_password_result = entry.get_password(); - assert!(get_password_result.is_ok()); + let get_seed_phrase_result = entry.get_seed_phrase(); + assert!(get_seed_phrase_result.is_ok()); // delete the password - let delete_password_result = entry.delete_password(); - assert!(delete_password_result.is_ok()); + let delete_seed_phrase_result = entry.delete_seed_phrase(); + assert!(delete_seed_phrase_result.is_ok()); // confirm the entry is gone - let get_password_result = entry.get_password(); + let get_password_result = entry.get_seed_phrase(); assert!(get_password_result.is_err()); assert!(matches!( get_password_result.unwrap_err(),