Add tk CLI commands for keys, users, and policies#19
Add tk CLI commands for keys, users, and policies#19natefikru wants to merge 3 commits intonatefikru/eng-3860-consensus-demo-rustfrom
Conversation
Expose client() and organization_id() on TurnkeySigner. Add keys create/delete, users create/delete, and policies create/delete subcommands that call the Turnkey API via the Rust SDK. All commands output JSON for script consumption. Move turnkey_client, serde_json, hex, and turnkey_api_key_stamper to regular dependencies.
Delete main.rs. Add setup.sh and teardown.sh that use the new tk keys, users, and policies commands. The entire demo now runs through shell scripts and the tk CLI. Update README to document the new flow.
- keys delete: default delete_without_export to false (safe by default) - policies create: reject allow policies with no condition or consensus - setup.sh: write state.json incrementally, exclude private key from state, set umask 077 for agent.env, add ERR trap for partial cleanup - teardown.sh: handle missing state.json and missing fields gracefully, pass --delete-without-export explicitly for key deletion
|
Note: the |
| } | ||
|
|
||
| impl From<AddressFormatArg> for AddressFormat { | ||
| fn from(a: AddressFormatArg) -> Self { |
There was a problem hiding this comment.
Is there a way to add a check to show we are not missing any address formats from the rust-sdk? That way the test will fail when we update the rust-sdk and get new address types
| output["apiPublicKey"] = serde_json::Value::String(pk); | ||
| } | ||
| if let Some(sk) = api_private_key { | ||
| output["apiPrivateKey"] = serde_json::Value::String(sk); |
There was a problem hiding this comment.
we shouldn't be putting private keys in the output
Summary
tk keys create/delete,tk users create/delete,tk policies create/deleteCLI commandsclient()andorganization_id()accessors onTurnkeySignerNew Commands
tk keys create --name <NAME> --curve <ed25519|secp256k1|p256> [--address-format <FORMAT>] [--tag <ID>]tk keys delete --key-id <ID> [--delete-without-export]tk users create --name <NAME> [--email <EMAIL>] [--api-key-name <NAME>] [--api-key-public-key <HEX>]tk users delete --user-id <ID>tk policies create --name <NAME> --effect <allow|deny> [--condition <CEL>] [--consensus <CEL>]tk policies delete --policy-id <ID>Test plan