Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Dec 11, 2024
1 parent f6b0b6e commit f23b649
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func printCreate(ctx client.Context, cmd *cobra.Command, k *keyring.Record, show
return fmt.Errorf("failed to print mnemonic: %w", err)
}
} else {
if err = printDiscreetly(ctx, cmd.ErrOrStderr(), "**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.", mnemonic); err != nil {
if err = printDiscreetly(cmd.ErrOrStderr(), "**Important** write this mnemonic phrase in a safe place.\nIt is the only way to recover your account if you ever forget your password.", mnemonic); err != nil {
return fmt.Errorf("failed to print mnemonic: %w", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/keys/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func exportUnsafeUnarmored(ctx client.Context, cmd *cobra.Command, uid string, b
cmd.Println(hexPrivKey)
return nil
}
if err = printDiscreetly(ctx, cmd.ErrOrStderr(), "**Important** Do not share this private key.", hexPrivKey); err != nil {
if err = printDiscreetly(cmd.ErrOrStderr(), "**Important** Do not share this private key.", hexPrivKey); err != nil {
return fmt.Errorf("failed to print private key: %w", err)
}
cmd.Println("Export private key successfully")
Expand Down
3 changes: 1 addition & 2 deletions client/keys/mnemonic.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/cosmos/go-bip39"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/input"
)

Expand Down Expand Up @@ -69,7 +68,7 @@ func MnemonicKeyCommand() *cobra.Command {
}
indiscreet, _ := cmd.Flags().GetBool(flagIndiscreet)
if !indiscreet {
return printDiscreetly(client.GetClientContextFromCmd(cmd), cmd.ErrOrStderr(), "**Important** write this mnemonic phrase in a safe place. Do not share it to anyone.", mnemonic)
return printDiscreetly(cmd.ErrOrStderr(), "**Important** write this mnemonic phrase in a safe place. Do not share it to anyone.", mnemonic)
}
cmd.Println(mnemonic)
return nil
Expand Down
2 changes: 1 addition & 1 deletion client/keys/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func printTextRecords(w io.Writer, kos []KeyOutput) error {
}

// printDiscreetly Print a secret string to an alternate screen, so the string isn't printed to the terminal.
func printDiscreetly(clientCtx client.Context, w io.Writer, promptMsg, secretMsg string) error {
func printDiscreetly(w io.Writer, promptMsg, secretMsg string) error {
output := termenv.NewOutput(w)
output.AltScreen()
defer output.ExitAltScreen()
Expand Down

0 comments on commit f23b649

Please sign in to comment.