Skip to content

Add tk private-key list, get, and create - #111

Draft
figitaki wants to merge 4 commits into
mainfrom
carey/private-key-commands
Draft

figitaki wants to merge 4 commits into
mainfrom
carey/private-key-commands

Conversation

@figitaki

@figitaki figitaki commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Adds a tk private-key command group for Go CLI (turnkey private-keys) parity.

  • list (get_private_keys) and get --id (get_private_key; a missing key is not_found).
  • create from flags (--name, --curve, repeatable --address-format, repeatable --tag ID) or --input-json/--input-file (CreatePrivateKeysIntentV2). It goes through submit_activity, so pending and consensus-needed behave like wallet create.
  • --address-format accepts only the short kebab form (ethereum, bitcoin-mainnet-p2pkh) with the possible values exposed to clap. The parser is local to private_keys.rs. Add flag-based input to wallet and sign commands #112 adds case-insensitive, prefix-optional enum parsing for wallets; the two should converge later.
  • privateKeyTags is now ID-normalized in JSON input, so malformed tag IDs fail as invalid_input before credentials load.
  • Regenerated docs/commands.md; added a section to docs/resources.md; added private-key to the cli-convention command list.
  • ssh/keys.rs is untouched: its helpers are Ed25519-specific.

Tests:

  • New live e2e tests/e2e/private_keys.rs (create, get, list, multi-key --input-json). It compiles under clippy/cargo test --no-run but was not run live (no .env.test).
  • tests/private_keys.rs (wiremock) is limited to what the live API can't produce on demand: absent key -> not_found, consensus pending (exact parameters, type, organizationId), exit 2 usage error, invalid local input.
  • Parsing unit tests in src/private_keys.rs.
  • cargo fmt --check, clippy -D warnings, cargo doc pass. cargo test passes except the pre-existing operations::tests::mutation_timeout_is_unknown_and_does_not_leak_body timing flake (also fails on main).

Move kebab-case enum parsing into enum_args so private-key and wallet
commands accept the same spellings. The variant list now fails to
compile when the API adds a variant.

Group the single-key flags in one optional struct, so a name without a
curve cannot reach command code. Say that --tag takes a private key
tag. Build the query client once. Drop the mock pending test, which
the live suite covers.

Co-authored-by: Turnkey <noreply@turnkey.com>
@figitaki
figitaki added this pull request to stack #113 November 5, 2026 21:00
Use the plain path for ALL in the enum macro, rename its test to what
it checks, and label the multi-key example in the resources doc.

Co-authored-by: Turnkey <noreply@turnkey.com>
Comment thread src/enum_args.rs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually we might want to see if we can just import these from rust-sdk, but good enough for now

Comment thread tests/private_keys.rs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just do these as e2e tests, if you need to iterate push to CI. If you can't produce the failures from live API then you shouldnt need to test it

@emostov emostov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI api LGTM 👍

Just would prefer to not have tests that need mocks
Also double check if we can easily import address type enum from rust-sdk, if not, no worries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants