UpSec Webhook signature verification SDK for Python
Project description
upsec-webhook
Official Python SDK for verifying UpSec webhook signatures.
Installation
pip install upsec-webhook
Quick Start
from upsec import verify_signature
is_valid = verify_signature(
payload=request.get_data(),
secret=os.environ["WEBHOOK_SECRET"],
signature=request.headers.get("X-Hub-Signature-256", ""),
)
Flask Decorator
from upsec.middleware import flask_webhook
@app.route("/webhook", methods=["POST"])
@flask_webhook(secret=os.environ["WEBHOOK_SECRET"])
def handle_webhook():
# Signature verified automatically
return {"ok": True}
API
verify_signature(payload, secret, signature, algorithm="sha256")
Returns True if the HMAC signature is valid. Uses constant-time comparison.
sign_payload(payload, secret, algorithm="sha256")
Returns a signed header string like sha256=<hex>. Useful for testing.
flask_webhook(secret, header, algorithm)
Flask decorator that auto-rejects invalid signatures with 401.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file upsec_webhook-1.0.0.tar.gz.
File metadata
- Download URL: upsec_webhook-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
318b1babbdbd53a4e027750eec3b457028f30da1a46614577afab36266c6c9a9
|
|
| MD5 |
40382f2f79e534b8313936d58b1fc4fb
|
|
| BLAKE2b-256 |
49c53561ff56ca25031c5ba3332eee0e970e15749d92eebcb7e8a5f4c4d4a232
|
Provenance
The following attestation bundles were made for upsec_webhook-1.0.0.tar.gz:
Publisher:
publish-python.yml on selmansenol/upsec-594fe05e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
upsec_webhook-1.0.0.tar.gz -
Subject digest:
318b1babbdbd53a4e027750eec3b457028f30da1a46614577afab36266c6c9a9 - Sigstore transparency entry: 1089926006
- Sigstore integration time:
-
Permalink:
selmansenol/upsec-594fe05e@f5f093fb62af6d0f0bdea6ffbd2d86de9d7c5bd1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/selmansenol
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@f5f093fb62af6d0f0bdea6ffbd2d86de9d7c5bd1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file upsec_webhook-1.0.0-py3-none-any.whl.
File metadata
- Download URL: upsec_webhook-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97f9aca968d3215a87923f47bf57530806420cd6bc0c0acf65772d4c7604da28
|
|
| MD5 |
739fc40828f8c14423961f2906d8234b
|
|
| BLAKE2b-256 |
9ef7c0b28c252695c9cfda8cd044dfdeac47a6401af488f9e8656cad87ce2b1b
|
Provenance
The following attestation bundles were made for upsec_webhook-1.0.0-py3-none-any.whl:
Publisher:
publish-python.yml on selmansenol/upsec-594fe05e
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
upsec_webhook-1.0.0-py3-none-any.whl -
Subject digest:
97f9aca968d3215a87923f47bf57530806420cd6bc0c0acf65772d4c7604da28 - Sigstore transparency entry: 1089926026
- Sigstore integration time:
-
Permalink:
selmansenol/upsec-594fe05e@f5f093fb62af6d0f0bdea6ffbd2d86de9d7c5bd1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/selmansenol
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@f5f093fb62af6d0f0bdea6ffbd2d86de9d7c5bd1 -
Trigger Event:
workflow_dispatch
-
Statement type: