Skip to content

Commit

Permalink
### What
Browse files Browse the repository at this point in the history
Rename `keys show` to `keys secret`.

### Why

Close #1804
  • Loading branch information
leighmcculloch committed Dec 19, 2024
1 parent e5454e6 commit 3015da6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
8 changes: 4 additions & 4 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ Create and manage identities including keys and addresses
* `generate` — Generate a new identity with a seed phrase, currently 12 words
* `ls` — List identities
* `rm` — Remove an identity
* `show`Given an identity return its private key
* `secret`Output an identity's secret key
* `use` — Set the default identity that will be used on all commands. This allows you to skip `--source-account` or setting a environment variable, while reusing this value in all commands that require it


Expand Down Expand Up @@ -1069,11 +1069,11 @@ Remove an identity



## `stellar keys show`
## `stellar keys secret`

Given an identity return its private key
Output an identity's secret key

**Usage:** `stellar keys show [OPTIONS] <NAME>`
**Usage:** `stellar keys secret [OPTIONS] <NAME>`

###### **Arguments:**

Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Address, Keypair } from "@stellar/stellar-sdk";
import { basicNodeSigner } from "@stellar/stellar-sdk/contract";

const rootKeypair = Keypair.fromSecret(
spawnSync("./soroban", ["keys", "show", "root"], {
spawnSync("./soroban", ["keys", "secret", "root"], {
shell: true,
encoding: "utf8",
}).stdout.trim(),
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl TestEnv {

/// Returns the private key corresponding to the test keys's `hd_path`
pub fn test_show(&self, hd_path: usize) -> String {
self.cmd::<keys::show::Cmd>(&format!("--hd-path={hd_path}"))
self.cmd::<keys::secret::Cmd>(&format!("--hd-path={hd_path}"))
.private_key()
.unwrap()
.to_string()
Expand Down
4 changes: 2 additions & 2 deletions cmd/crates/soroban-test/tests/it/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ fn use_env() {

sandbox
.new_assert_cmd("keys")
.arg("show")
.arg("secret")
.arg("bob")
.assert()
.success()
Expand Down Expand Up @@ -330,7 +330,7 @@ fn config_dirs_precedence() {

sandbox
.new_assert_cmd("keys")
.arg("show")
.arg("secret")
.arg("alice")
.arg("--verbose")
.assert()
Expand Down
6 changes: 3 additions & 3 deletions cmd/crates/soroban-test/tests/it/integration/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async fn invoke() {

let secret_key = sandbox
.new_assert_cmd("keys")
.arg("show")
.arg("secret")
.arg("test")
.assert()
.stdout_as_str();
Expand All @@ -65,7 +65,7 @@ async fn invoke() {
.stdout_as_str();
let secret_key_1 = sandbox
.new_assert_cmd("keys")
.arg("show")
.arg("secret")
.arg("test")
.arg("--hd-path=1")
.assert()
Expand Down Expand Up @@ -115,7 +115,7 @@ async fn invoke() {
assert_eq!(sk_from_file, format!("secret_key = \"{secret_key_1}\"\n"));
let secret_key_1_readin = sandbox
.new_assert_cmd("keys")
.arg("show")
.arg("secret")
.arg("testone")
.assert()
.stdout_as_str();
Expand Down
10 changes: 5 additions & 5 deletions cmd/soroban-cli/src/commands/keys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub mod fund;
pub mod generate;
pub mod ls;
pub mod rm;
pub mod show;
pub mod secret;

#[derive(Debug, Parser)]
pub enum Cmd {
Expand All @@ -30,8 +30,8 @@ pub enum Cmd {
/// Remove an identity
Rm(rm::Cmd),

/// Given an identity return its private key
Show(show::Cmd),
/// Output an identity's secret key
Secret(secret::Cmd),

/// Set the default identity that will be used on all commands.
/// This allows you to skip `--source-account` or setting a environment
Expand Down Expand Up @@ -61,7 +61,7 @@ pub enum Error {
Ls(#[from] ls::Error),

#[error(transparent)]
Show(#[from] show::Error),
Show(#[from] secret::Error),

#[error(transparent)]
Default(#[from] default::Error),
Expand All @@ -76,7 +76,7 @@ impl Cmd {
Cmd::Generate(cmd) => cmd.run(global_args).await?,
Cmd::Ls(cmd) => cmd.run()?,
Cmd::Rm(cmd) => cmd.run()?,
Cmd::Show(cmd) => cmd.run()?,
Cmd::Secret(cmd) => cmd.run()?,
Cmd::Default(cmd) => cmd.run(global_args)?,
};
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub enum Error {

#[derive(Debug, clap::Parser, Clone)]
#[group(skip)]
#[command(name = "secret", alias = "show")]
pub struct Cmd {
/// Name of identity to lookup, default is test identity
pub name: String,
Expand Down

0 comments on commit 3015da6

Please sign in to comment.