Skip to main content

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)

See webhook server example.

Metadata

Release files for truelayer-signing 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for truelayer-signing 0.4.0
File Size Uploaded
truelayer_signing-0.4.0.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for truelayer-signing 0.4.0
File Interpreter ABI Platform
truelayer_signing-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / truelayer_signing-0.4.0.tar.gz

Download URL truelayer_signing-0.4.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8b1fb067b23feb8af1ad3a929bf48b69a9dc357ed60bd56615fecca3b9d8c5aa
BLAKE2b-256 checksum
How to use checksums
807e221b0ee24b5a04ecb2f0bf9de18e7a4ee9a513570dff8a96977d8538c407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1018-azure

Release files / truelayer_signing-0.4.0-py3-none-any.whl

Download URL truelayer_signing-0.4.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a97ca087bcc3fae64642bab24daafb76cbd2e3af4d30d5550551792629182e0c
BLAKE2b-256 checksum
How to use checksums
712daaa3742647f71eb6dea320ce7127c8ede8ebe786bb9a039f1c73efabb25b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1018-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page