Produce & verify TrueLayer API requests signatures
Project description
truelayer-signing
Python package to produce & verify TrueLayer API requests signatures.
Install
pip install truelayer-signing
Generating a signature
tl_signature = sign_with_pem(KID, PRIVATE_KEY) \
.set_method(HttpMethod.POST) \
.set_path(path) \
.add_header("Idempotency-Key", idempotency_key) \
.set_body(body) \
.sign()
See full example.
Verifying webhooks
The verify_with_jwks function may be used to verify webhook Tl-Signature header signatures.
# `jku` field is included in webhook signatures
jws_header = extract_jws_header(webhook_signature).jku
# check `jku` is an allowed TrueLayer url & fetch jwks JSON (not provided by this lib)
ensure_jku_allowed(jku)
jwks = fetch_jwks(jku)
# jwks may be used directly to verify a signature
verify_with_jwks(jwks, jws_header) \
.set_method(HttpMethod.POST) \
.set_path(path) \
.add_headers(headers) \
.set_body(body) \
.verify(tl_signature)
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
truelayer_signing-0.4.0.tar.gz
(10.7 kB
view details)
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 truelayer_signing-0.4.0.tar.gz.
File metadata
- Download URL: truelayer_signing-0.4.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b1fb067b23feb8af1ad3a929bf48b69a9dc357ed60bd56615fecca3b9d8c5aa
|
|
| MD5 |
793587dd9e650b99a447784e41bab51f
|
|
| BLAKE2b-256 |
807e221b0ee24b5a04ecb2f0bf9de18e7a4ee9a513570dff8a96977d8538c407
|
File details
Details for the file truelayer_signing-0.4.0-py3-none-any.whl.
File metadata
- Download URL: truelayer_signing-0.4.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a97ca087bcc3fae64642bab24daafb76cbd2e3af4d30d5550551792629182e0c
|
|
| MD5 |
17b323d391fde5ada5526e13408c7f8c
|
|
| BLAKE2b-256 |
712daaa3742647f71eb6dea320ce7127c8ede8ebe786bb9a039f1c73efabb25b
|