Crates.io | hmac-cli |
lib.rs | hmac-cli |
version | 0.1.16 |
source | src |
created_at | 2024-10-31 13:54:57.687864 |
updated_at | 2024-10-31 15:38:03.792837 |
description | 🛠️ A command-line tool for generating HMAC signatures. |
homepage | |
repository | |
max_upload_size | |
id | 1430054 |
size | 62,382 |
hmac-cli
🛠️ A command-line tool for generating HMAC signatures.
$ hmac -h
Usage: hmac.exe [OPTIONS] --url <URL>
Options:
-a, --ak <AK> Access Key ID (can be provided via config file `ak`)
-s, --sk <SK> Secret Key (can be provided via config file `sk`)
-m, --method <METHOD> Request method (default: POST) [default: POST]
-u, --url <URL> Request URL
-b, --body <BODY> Request body (JSON format)
-g, --gateway <GATEWAY> Gateway type (default: traefik) [default: traefik] [possible values: apisix, traefik, higress]
--algorithm <ALGORITHM> HMAC algorithm (default: hmac-sha256) [default: hmac-sha256] [possible values: hmac-sha256, hmac-sha384, hmac-sha512]
-h, --help Print help
-V, --version Print version
# Generate an HMAC signature for a POST request
$ hmac --ak <HMAC_AK> --sk <HMAC_SK> --method POST --url https://exmaple.com/api --body "{\"hello\":\"world\"}" --gateway traefik
# AK\SK can be set as environment variables (HMAC_AK\HMAC_SK)
$ hmac --method POST --url https://exmaple.com/api --body "{\"hello\":\"world\"}" --gateway apisix
# AK\SK can be set in a configuration file (~/.hmac/config.toml)
# vi ~/.hmac/config.toml
# HMAC_AK = "<HMAC_AK>"
# HMAC_SK = "<HMAC_SK>"
$ hmac --method POST --url https://exmaple.com/api --body "{\"hello\":\"world\"}" --gateway higress