tkhq / tkcli

Command line tool to interact with Turnkey
Apache License 2.0
18 stars 5 forks source link

Set defaults for private key generation #29

Open andrewkmin opened 1 year ago

andrewkmin commented 1 year ago

Private key generation via cli is quite verbose:

turnkey pk create --key-name some-key --address-format ADDRESS_FORMAT_ETHEREUM --curve CURVE_SECP256K1 --name some-name

We should consider making --address-format and --curve optional, with defaults set to ADDRESS_FORMAT_ETHEREUM and CURVE_SECP256K1 respectively.

Furthermore, we could probably flesh out the flags:

private-keys interacts with private keys

Usage:
  turnkey private-keys [command]

Aliases:
  private-keys, pk

Available Commands:
  create      create a new private key
  list        list private keys for the organization

Flags:
  -h, --help   help for private-keys

Global Flags:
  -k, --key-name string       name of API key with which to interact with the Turnkey API service (default "default")
  -d, --keys-folder string    directory in which to locate keys (default "/Users/andrew/Library/Application Support/turnkey/keys")
      --organization string   organization ID to be used
  -o, --output string         output format (default "json")

Use "turnkey private-keys [command] --help" for more information about a command.
andrewkmin commented 1 year ago

While we're at it, I wonder if it might be worthwhile supporting changes to these defaults (which would be particularly relevant to the --keys-folder flag)

And making sure that pk create works

./turnkey pk create --address-format ADDRESS_FORMAT_ETHEREUM --curve CURVE_SECP256K1 --name queueing-key --keys-folder="/Users/andrew/.config/turnkey/keys" --key-name queueing
{
   "error": "failed to create API client: failed to load API key: failed to read from \"/Users/andrew/Library/Application Support/turnkey/keys/queueing.private\": open /Users/andrew/Library/Application Support/turnkey/keys/queueing.private: no such file or directory"
}