From a6756f16477e32278602c46318cbbd628eba1970 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 2 Dec 2024 12:08:09 -0500 Subject: [PATCH] Return error when trying to get Secure Store or Ledger secret --- cmd/soroban-cli/src/config/secret.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/soroban-cli/src/config/secret.rs b/cmd/soroban-cli/src/config/secret.rs index 1281688f9..107bec159 100644 --- a/cmd/soroban-cli/src/config/secret.rs +++ b/cmd/soroban-cli/src/config/secret.rs @@ -32,6 +32,8 @@ pub enum Error { LedgerDoesNotRevealSecretKey, #[error(transparent)] Keyring(#[from] keyring::Error), + #[error("Secure Store does not reveal secret key")] + SecureStoreDoesNotRevealSecretKey, } #[derive(Debug, clap::Args, Clone)] @@ -129,8 +131,12 @@ impl Secret { .private() .0, )?, - Secret::Ledger => panic!("Ledger does not reveal secret key"), - Secret::SecureStore { .. } => panic!("Secure Store does not reveal secret key"), + Secret::Ledger => { + return Err(Error::LedgerDoesNotRevealSecretKey); + } + Secret::SecureStore { .. } => { + return Err(Error::SecureStoreDoesNotRevealSecretKey); + } }) }