Webhook signature verification for Clavex Identity Platform
Project description
clavex-webhooks (Python)
Webhook signature verification for the Clavex Identity Platform.
Installation
pip install clavex-webhooks
Usage
from clavex_webhooks import Webhook, WebhookVerificationError
wh = Webhook("whsec_your_signing_secret")
# In your HTTP handler:
try:
payload = wh.verify(
body=request.body, # raw bytes or str
signature=request.headers["X-Clavex-Signature"], # sha256=<hex>
)
except WebhookVerificationError as exc:
return Response(str(exc), status=400)
import json
event = json.loads(payload)
print(event["type"]) # e.g. "user.created"
Django / Flask example
# Django
@csrf_exempt
def webhook(request):
wh = Webhook(settings.CLAVEX_WEBHOOK_SECRET)
try:
payload = wh.verify(request.body, request.headers.get("X-Clavex-Signature", ""))
except WebhookVerificationError:
return HttpResponse(status=400)
handle_event(json.loads(payload))
return HttpResponse(status=200)
API
Webhook(secret)
Create a verifier. secret may include the whsec_ prefix — it is stripped automatically.
webhook.verify(body, signature) → bytes
Verify and return the raw body. Raises WebhookVerificationError on failure.
verify(secret, signature, body) → bytes
Convenience one-shot function.
Signature format
Clavex sends X-Clavex-Signature: sha256=<HMAC-SHA256-hex> computed over the raw request body using your webhook secret.
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 clavex_webhooks-1.0.0.tar.gz.
File metadata
- Download URL: clavex_webhooks-1.0.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e621123c57aa6a681c43513130583ecbbea74ff797439279204a62f2d810f20f
|
|
| MD5 |
aa177378ea838a204187cf1ebfd2a189
|
|
| BLAKE2b-256 |
23edcf89bb6360ff7064477590e1a41dae603575343081c492216a7db1b395e8
|
Provenance
The following attestation bundles were made for clavex_webhooks-1.0.0.tar.gz:
Publisher:
release-pypi.yml on clavex-eu/clavex-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clavex_webhooks-1.0.0.tar.gz -
Subject digest:
e621123c57aa6a681c43513130583ecbbea74ff797439279204a62f2d810f20f - Sigstore transparency entry: 2010823966
- Sigstore integration time:
-
Permalink:
clavex-eu/clavex-sdk@2c33bf342b8672812d7d95436a3f862b59afa0f7 -
Branch / Tag:
refs/tags/py-1.0.0 - Owner: https://github.com/clavex-eu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@2c33bf342b8672812d7d95436a3f862b59afa0f7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file clavex_webhooks-1.0.0-py3-none-any.whl.
File metadata
- Download URL: clavex_webhooks-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73d173ac5429a212bd4055891041974881eb6d32a691c8198554ca30ef11dacd
|
|
| MD5 |
a33ea6037c350bd470f657ba83734561
|
|
| BLAKE2b-256 |
c51f60f5f0e5d85f895b839fdb73664d53194db3643fbf77b339962a01438760
|
Provenance
The following attestation bundles were made for clavex_webhooks-1.0.0-py3-none-any.whl:
Publisher:
release-pypi.yml on clavex-eu/clavex-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
clavex_webhooks-1.0.0-py3-none-any.whl -
Subject digest:
73d173ac5429a212bd4055891041974881eb6d32a691c8198554ca30ef11dacd - Sigstore transparency entry: 2010824070
- Sigstore integration time:
-
Permalink:
clavex-eu/clavex-sdk@2c33bf342b8672812d7d95436a3f862b59afa0f7 -
Branch / Tag:
refs/tags/py-1.0.0 - Owner: https://github.com/clavex-eu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@2c33bf342b8672812d7d95436a3f862b59afa0f7 -
Trigger Event:
push
-
Statement type: