diff --git a/cmd/soroban-cli/src/config/secret.rs b/cmd/soroban-cli/src/config/secret.rs index cd3bc908a..8f0ee8673 100644 --- a/cmd/soroban-cli/src/config/secret.rs +++ b/cmd/soroban-cli/src/config/secret.rs @@ -38,11 +38,25 @@ pub enum Error { pub struct Args { /// Add using `secret_key` /// Can provide with `SOROBAN_SECRET_KEY` - #[arg(long, conflicts_with = "seed_phrase")] + #[arg(long, conflicts_with = "seed_phrase", conflicts_with = "secure_store")] pub secret_key: bool, + /// Add using 12 word seed phrase to generate `secret_key` - #[arg(long, conflicts_with = "secret_key")] + #[arg(long, conflicts_with = "secret_key", conflicts_with = "secure_store")] pub seed_phrase: bool, + + /// Add using secure store entry + #[arg( + long, + requires = "entry_name", + conflicts_with = "seed_phrase", + conflicts_with = "secret_key" + )] + pub secure_store: bool, + + /// Name of the secure store entry + #[arg(long, requires = "secure_store")] + pub entry_name: Option, } impl Args { @@ -71,6 +85,17 @@ impl Args { .collect::>() .join(" "), }) + } else if self.secure_store { + let entry_name_with_prefix = format!( + "{}{}-{}", + keyring::SECURE_STORE_ENTRY_PREFIX, + keyring::SECURE_STORE_ENTRY_SERVICE, + self.entry_name.as_ref().unwrap() + ); + + Ok(Secret::SecureStore { + entry_name: entry_name_with_prefix, + }) } else { Err(Error::PasswordRead {}) }