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.7.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.7-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: truelayer_signing-0.3.7.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.10.17 Linux/6.11.0-1012-azure

File hashes

Hashes for truelayer_signing-0.3.7.tar.gz
Algorithm Hash digest
SHA256 3068be4febd1785ad41cbbcac5250d44b41ad9262677986632624d98926c22c8
MD5 cb468678aa9c75cfd6e11699c3fc982d
BLAKE2b-256 e66abc235de23142f44fc42a603c2bcaa54befa4fdf2937041ebe3f03517588d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for truelayer_signing-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ca7576494a8b88630ed142b3cff7fcaa730ff874003140e53e6fbcbe3bc7ad68
MD5 0cefc778a59fc0c5ab6cf597697973dd
BLAKE2b-256 8bc7781b56c3daf402cd2e1e12fd4a703eac360805dafb9ce10dbd0e6adddc72

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