hmac-cli

Crates.iohmac-cli
lib.rshmac-cli
version0.1.16
sourcesrc
created_at2024-10-31 13:54:57.687864
updated_at2024-10-31 15:38:03.792837
description🛠️ A command-line tool for generating HMAC signatures.
homepage
repository
max_upload_size
id1430054
size62,382
(lvillis)

documentation

README

Table of Contents↗️

hmac-cli

🛠️ A command-line tool for generating HMAC signatures.

crates.io version crates.io version build status say thanks

Example

$ 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
Commit count: 0

cargo fmt