Skip to content

Commit 1f9afe5

Browse files
committed
Merge pull-request #41
2 parents c08b31f + 8aac1e5 commit 1f9afe5

File tree

9 files changed

+511
-65
lines changed

9 files changed

+511
-65
lines changed

Cargo.lock

Lines changed: 39 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api_key_stamper/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ categories = ["cryptography", "authentication", "api-bindings"]
1414
base64 = { version = "0.22.0", default-features = false, features = ["std"] }
1515
hex = { version = "0.4.3", default-features = false, features = ["std"] }
1616
p256 = { version = "0.13.2", default-features = false, features = ["ecdsa"] }
17+
k256 = { version = "0.13", default-features = false, features = ["ecdsa", "pkcs8"] }
1718
rand_core = { version = "0.6.4", default-features = false, features = ["getrandom"] }
1819
serde = { version = "1.0.219", default-features = false, features = ["std", "derive"] }
1920
serde_json = { version = "1.0.140", default-features = false, features = ["std"] }
2021
thiserror = { version = "2.0.12", default-features = false }
2122

2223
[dev-dependencies]
2324
tempfile = { version = "3.19.1", default-features = false }
25+
signature = "2"

api_key_stamper/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ let api_key = TurnkeyP256ApiKey::from_strings(api_private_key, None).expect("loa
2525

2626
If you want to store API keys in `.env` files, use [`dotenvy`](https://docs.rs/dotenvy/latest/dotenvy/).
2727

28-
2928
## Load API keys from files
3029

3130
If you have generated API keys with Turnkey's [command-line tool](https://github.com/tkhq/tkcli) you can load them with:
@@ -44,10 +43,10 @@ let api_key = TurnkeyP256ApiKey::from_files(
4443
The API is straightforward, once you have a handle on an API key, call `stamp`:
4544

4645
```rust
47-
use turnkey_api_key_stamper::TurnkeyP256ApiKey;
46+
use turnkey_api_key_stamper::{TurnkeyP256ApiKey, Stamp};
4847

4948
let api_key = TurnkeyP256ApiKey::generate();
50-
let stamp = api_key.stamp("POST request body goes here");
49+
let stamp = api_key.stamp("POST request body goes here".as_bytes());
5150
```
5251

5352
The stamp produced is a base64-encoded value, ready to be used as a stamp header. See [our documentation](https://docs.turnkey.com/developer-reference/api-overview/stamps#api-keys) for more information.

0 commit comments

Comments
 (0)