Skip to main content

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)

See webhook server example.

Project details


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.8.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

truelayer_signing-0.3.8-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file truelayer_signing-0.3.8.tar.gz.

File metadata

  • Download URL: truelayer_signing-0.3.8.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.18 Linux/6.11.0-1018-azure

File hashes

Hashes for truelayer_signing-0.3.8.tar.gz
Algorithm Hash digest
SHA256 9ddd9a1d963c0f5a87fcba3b7e2b1ab8cc69c1af6c8ca00e0085f2ad82373983
MD5 1b65075c4b68b68bd28e6562f9ca5422
BLAKE2b-256 fd7bc3e4db4c5f9b6dcb7f4a9efeedf094eac02afbd0df7721f5f792947d3e06

See more details on using hashes here.

File details

Details for the file truelayer_signing-0.3.8-py3-none-any.whl.

File metadata

  • Download URL: truelayer_signing-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.18 Linux/6.11.0-1018-azure

File hashes

Hashes for truelayer_signing-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 8b9edd73bb004f4c2ebd0cef68ea67d4ba1d174837cdc40e6c148239027b4ebb
MD5 0d3b1b25573550de6b6c82be03972c04
BLAKE2b-256 fb9f11243f76f107bf61cc76944b90aaa283e7c3c70733887b5ab03917aac30f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page