An open API service indexing awesome lists of open source software.

https://github.com/lvillis/hmac-cli

🛠️ A command-line tool for generating HMAC signatures.
https://github.com/lvillis/hmac-cli

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

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

```bash
$ hmac -h
Usage: hmac.exe [OPTIONS] --url

Options:
-a, --ak Access Key ID (can be provided via config file `ak`)
-s, --sk Secret Key (can be provided via config file `sk`)
-m, --method Request method (default: POST) [default: POST]
-u, --url Request URL
-b, --body Request body (JSON format)
-g, --gateway Gateway type (default: traefik) [default: traefik] [possible values: apisix, traefik, higress]
--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
```

```bash
# Generate an HMAC signature for a POST request
$ hmac --ak --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_SK = ""
$ hmac --method POST --url https://exmaple.com/api --body "{\"hello\":\"world\"}" --gateway higress
```