| Crates.io | turnkey_client |
| lib.rs | turnkey_client |
| version | 0.5.0 |
| created_at | 2025-05-10 19:47:08.783642+00 |
| updated_at | 2025-10-17 22:19:22.845629+00 |
| description | A Rust client to interact with the Turnkey API. |
| homepage | https://turnkey.com |
| repository | https://github.com/tkhq/rust-sdk |
| max_upload_size | |
| id | 1668742 |
| size | 529,848 |
turnkey_clientThis crate contains an HTTP client to interact with the Turnkey API (documentation).
To make a request to Turnkey:
use turnkey_client::generated::SignRawPayloadIntentV2;
use turnkey_client::generated::immutable::common::v1::HashFunction;
use turnkey_client::generated::immutable::common::v1::PayloadEncoding;
// You can load your API key from a file or from env
let api_key = turnkey_client::TurnkeyP256ApiKey::from_strings("<private key hex>", None).expect("api key creation failed");
// Create a new client:
let client = turnkey_client::TurnkeyClient::builder().api_key(api_key).build().expect("client builder failed");
// Make a request (for example, a signature request)
let request = client.sign_raw_payload(
"your-turnkey-organization-id".to_string(),
client.current_timestamp(),
SignRawPayloadIntentV2 {
sign_with: "0x123456".to_string(), // Turnkey address
payload: "hello from TKHQ".to_string(),
encoding: PayloadEncoding::TextUtf8,
hash_function: HashFunction::Keccak256, // assuming ETH
},
);
// You can then call `request.await?` to get the signature result
The Turnkey client uses reqwest under the hood. To access the reqwest builder, use the following:
let api_key = turnkey_client::TurnkeyP256ApiKey::generate();
let client = turnkey_client::TurnkeyClient::builder()
.api_key(api_key)
.with_reqwest_builder(|b| b.connection_verbose(true));
Additional reqwest features can be enabled in your Cargo.toml:
[dependencies]
turnkey_client = { version = "0.0.2", features = ["reqwest_native_tls", "reqwest_brotli", "reqwest_zstd", "reqwest_hickory_dns"] }