pyreqsign
HMAC-based API request signing with environment-bound key derivation for microservices.
Installation
pip install pyreqsign
Quick Start
from pyreqsign import derive_key, sign, verify, sign_request
# Derive a machine-bound signing key from your secret
key = derive_key("my-api-key")
# Sign a canonical message
signature = sign(key, b"POST\n/users\n1714300000\n")
# → base64url signature string
# Verify on the server side
is_valid = verify(key, b"POST\n/users\n1714300000\n", signature)
# Or sign an entire HTTP request (returns headers ready to attach)
headers = sign_request("my-api-key", "POST", "https://api.example.com/v1/data",
json_body={"action": "update"})
# → {"Authorization": "EnvSign ES-v2:...", "X-EnvSign-Timestamp": "1714300000", ...}
Why EnvSign?
Standard HMAC signing only binds the secret key. EnvSign additionally binds the signing environment — the derived key depends on both the secret AND the machine fingerprint, making it ideal for:
- Microservice-to-microservice auth where each service instance has a unique identity
- API gateway request validation with replay protection via timestamp binding
- Webhook verification where the sender environment is part of the trust chain
API
Core Signing
All cryptographic operations are implemented in the native extension
pyreqsign._native; the Python layer is a thin re-export.
| Function | Description |
|---|---|
derive_key(secret) |
Derive a 256-bit machine-bound signing key (sha256(md5(hostname)+secret)) |
sign(key, message, ...) |
Sign a message, returns base64url signature string |
verify(key, message, sig) |
Verify signature (constant-time comparison) |
sign_request(secret, method, url, ...) |
Sign full HTTP request, returns auth headers |
es_hmac(key, message, ...) |
Low-level ES-HMAC primitive |
generate_key_id(api_key) |
Generate a machine-bound key identifier |
Config Helpers
| Function | Description |
|---|---|
get_env(key, default) |
Read string env var |
parse_bool(key, default) |
Parse boolean (true/1/yes/on) |
parse_int(key, default) |
Parse integer, silent fallback |
parse_list(key, sep, default) |
Parse comma-separated list |
load_config(prefix) |
Collect all vars matching prefix |
License
MIT
Metadata
Release files for pyreqsign 1.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyreqsign-1.3.4-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| pyreqsign-1.3.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| pyreqsign-1.3.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| pyreqsign-1.3.4-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 3.1 MB
Release files / pyreqsign-1.3.4-cp38-abi3-win_amd64.whl
| Download URL | pyreqsign-1.3.4-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 736.3 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
76df6ecd14133eef22d78d531c5cf68f57d3b737691ee126a3d8d664909522b1
|
|
BLAKE2b-256 checksum How to use checksums |
707fc859ad025c7e3407688be2bc45ff5fbbf94d6a197980b8153cfe6e4b9621
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / pyreqsign-1.3.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyreqsign-1.3.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 835.0 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c6914689fa6201ddaa9de68ab1e03c6cf102a2324eb9ca670dbc4afe0b1142cf
|
|
BLAKE2b-256 checksum How to use checksums |
99717a42a87396a169a2fde02d02689caf910a8316a6b32d118076c8afb96442
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / pyreqsign-1.3.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyreqsign-1.3.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 784.1 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
76b8c1d98b75e910a1664e90dd09575181cc78a0dc56f55e17b7d62ed46eb8ff
|
|
BLAKE2b-256 checksum How to use checksums |
d8d2fe911af36d7ccad0731ad3d87e108aaefc49d40dd1c036990da78936d46d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / pyreqsign-1.3.4-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | pyreqsign-1.3.4-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 713.7 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
cea1bdff3a2525fd698bf134301fa3923256beb6ae7c473510e72032c2bce3e4
|
|
BLAKE2b-256 checksum How to use checksums |
5f638008a9299a6c2b38cccb84ed4e8d18066341f4853bea534e07039c7e9a5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for pyreqsign 1.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.