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.3.9.tar.gz
(10.8 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.3.9.tar.gz.
File metadata
- Download URL: truelayer_signing-0.3.9.tar.gz
- Upload date:
- Size: 10.8 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 |
a4e30fbb7894d6590be997d8c0ff5d251970212895ab72db79231d1e75a6340c
|
|
| MD5 |
e3f8664f01f060734407e92f4a9e3857
|
|
| BLAKE2b-256 |
95c9711b9f8aeb41fc200f8b48bad69269d1e2af74fdc603c11bc32bb81bc501
|
File details
Details for the file truelayer_signing-0.3.9-py3-none-any.whl.
File metadata
- Download URL: truelayer_signing-0.3.9-py3-none-any.whl
- Upload date:
- Size: 14.0 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 |
6826f1de44e094903af93be2b8aafc3eade37e1a0ba0e5bf1473ad7b6e84cddf
|
|
| MD5 |
0c112a1abed2ad2826ce0340dcb30352
|
|
| BLAKE2b-256 |
2790e7822869d80f399b435ff0a82699189e125d5acc294981a1ac1d9b19b128
|