Skip to content

Commit

Permalink
Rename SignerKind::Keychain to SignerKind::SecureStore
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Nov 25, 2024
1 parent 9d07067 commit aeb6517
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub mod show;

#[derive(Debug, Parser)]
pub enum Cmd {
/// Add a new identity (keypair, ledger, macOS keychain)
/// Add a new identity (keypair, ledger, OS specific secure store)
Add(add::Cmd),

/// Given an identity return its address (public key)
Expand Down
12 changes: 4 additions & 8 deletions cmd/soroban-cli/src/config/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use stellar_strkey::ed25519::{PrivateKey, PublicKey};

use crate::{
print::Print,
signer::{self, keyring, ledger, KeychainEntry, LocalKey, Signer, SignerKind},
signer::{self, keyring, ledger, LocalKey, SecureStoreEntry, Signer, SignerKind},
utils,
};

Expand Down Expand Up @@ -39,15 +39,11 @@ pub enum Error {
pub struct Args {
/// Add using `secret_key`
/// Can provide with `SOROBAN_SECRET_KEY`
#[arg(long, conflicts_with_all = ["seed_phrase", "keychain"])]
#[arg(long, conflicts_with = "seed_phrase")]
pub secret_key: bool,
/// Add using 12 word seed phrase to generate `secret_key`
#[arg(long, conflicts_with_all = ["secret_key", "keychain"])]
#[arg(long, conflicts_with = "secret_key")]
pub seed_phrase: bool,

/// Add using `keychain`
#[arg(long, conflicts_with_all = ["seed_phrase", "secret_key"])]
pub keychain: bool,
}

impl Args {
Expand Down Expand Up @@ -166,7 +162,7 @@ impl Secret {
.expect("uszie bigger than u32");
SignerKind::Ledger(ledger(hd_path).await?)
}
Secret::SecureStore { entry_name } => SignerKind::Keychain(KeychainEntry {
Secret::SecureStore { entry_name } => SignerKind::SecureStore(SecureStoreEntry {
name: entry_name.to_string(),
}),
};
Expand Down
10 changes: 5 additions & 5 deletions cmd/soroban-cli/src/signer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ed25519_dalek::ed25519::signature::{self, Signer as _};
use ed25519_dalek::ed25519::signature::Signer as _;
use keyring::StellarEntry;
use sha2::{Digest, Sha256};

Expand Down Expand Up @@ -219,7 +219,7 @@ pub enum SignerKind {
#[cfg(feature = "emulator-tests")]
Ledger(Ledger<stellar_ledger::emulator_test_support::http_transport::EmulatorHttpTransport>),
Lab,
Keychain(KeychainEntry),
SecureStore(SecureStoreEntry),
}

impl Signer {
Expand Down Expand Up @@ -249,7 +249,7 @@ impl Signer {
SignerKind::Local(key) => key.sign_tx_hash(tx_hash)?,
SignerKind::Lab => Lab::sign_tx_env(tx_env, network, &self.print)?,
SignerKind::Ledger(ledger) => ledger.sign_transaction_hash(&tx_hash).await?,
SignerKind::Keychain(entry) => entry.sign_tx_env(tx_env)?,
SignerKind::SecureStore(entry) => entry.sign_tx_env(tx_env)?,
};
let mut sigs = signatures.clone().into_vec();
sigs.push(decorated_signature);
Expand Down Expand Up @@ -373,11 +373,11 @@ impl Lab {
}
}

pub struct KeychainEntry {
pub struct SecureStoreEntry {
pub name: String,
}

impl KeychainEntry {
impl SecureStoreEntry {
pub fn sign_tx_env(&self, tx_env: &TransactionEnvelope) -> Result<DecoratedSignature, Error> {
let entry = StellarEntry::new(&self.name)?;
let signed_tx_env = entry.sign_data(tx_env.to_xdr_base64(Limits::none())?.as_bytes())?;
Expand Down

0 comments on commit aeb6517

Please sign in to comment.