Skip to main content

A library to verify Carbon webhook events

Project description

Carbon Webhooks Python Library

carbon_webhooks_python is a Python library designed to verify Carbon webhook events. This library provides a simple way to validate webhook signatures and ensure the authenticity of incoming requests.

Features

  • Generate Signature: Generate HMAC SHA256 signatures for webhook payloads.
  • Validate Signature: Validate incoming webhook signatures to ensure they match the expected signature.
  • Extract Signature Header: Parse and extract components from the Carbon-Signature header.

Installation

You can install the library using pip:

pip install carbon_webhooks

WebhookVerifier

__init__(signing_key: str)

  • signing_key: Your Carbon webhook signing key.

generate_signature(timestamp: str, json_payload: str) -> str

Generates a signature for the given timestamp and JSON payload.

  • timestamp: The timestamp of the webhook event.
  • json_payload: The JSON payload of the webhook event.

Returns the generated signature.

validate_signature(received_sig: str, timestamp: str, payload: str) -> bool

Validates the received signature against the generated signature.

  • received_sig: The received signature to validate.
  • timestamp: The timestamp of the webhook event.
  • payload: The JSON payload of the webhook event.

Returns true if the signature is valid, otherwise false.

extract_signature_header(header: str) -> Any

Extracts the timestamp and signature from the Carbon-Signature header.

  • header: The Carbon-Signature header.

Returns an object with the extracted signature parts.

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

carbon_verifier-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

carbon_verifier-0.1.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file carbon_verifier-0.1.1.tar.gz.

File metadata

  • Download URL: carbon_verifier-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for carbon_verifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 116a74becea2ac1115b22e2771dbbefc68d2004fa599d447de02cd3f8db6f9db
MD5 a8a2ed88f34b6ec499847721944ae1e2
BLAKE2b-256 779b155e7bf2940fdc365065a1a6a642bf367c92cc09843724d5e7ae792c2c17

See more details on using hashes here.

File details

Details for the file carbon_verifier-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for carbon_verifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5272448f990cc4929b4c92c134c3fd74a49aaeebf44350e27b2972468953f3dc
MD5 bce31be757a83430c3a58c6981c91f81
BLAKE2b-256 d460fe880fca88ee58488dc7b17a11579e18947c43776e89e587dd205031cc2d

See more details on using hashes here.

Supported by

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