Skip to main content

google-wallet-webhook-auth

Google Wallet webhook signature verification utilities for Python.

Features

  • Verify Google Wallet webhook signatures according to official documentation
  • Utilities for handling Google Pay cryptographic signature formats
  • Typed and tested Python code

Installation

pip install google-wallet-webhook-auth

Usage

An example with flask :

from flask import Flask, request, jsonify, abort
from google_wallet_webhook_auth import Validator
from google_wallet_webhook_auth.exceptions import SignatureVerificationError


app = Flask(__name__)

@app.route("/webhook/google/events", methods=['POST'])
def event_webhook():
    data = request.get_json()
    try:
        Validator("YOUR_ISSUER_ID").validate(data)
    except SignatureVerificationError:
        abort(401)

if __name__ == '__main__':
    app.run(debug=True)

Usage with cache and django

from rest_framework import permissions
from django.core.cache import cache

from google_wallet_webhook_auth import Validator
from google_wallet_webhook_auth.exceptions import SignatureVerificationError
from google_wallet_webhook_auth.cache import CacheConfig, CacheInterface

class DjangoCacheAdapter(CacheInterface):
    def get(self, key):
        return cache.get(key)

    def set(self, key, value, timeout=None):
        cache.set(key, value, timeout=timeout)

class IsGoogleWebhook(permissions.BasePermission):
    def has_permission(self, request, __view):
        cache_config = CacheConfig(key="google_key", backend=DjangoCacheAdapter())
        try:
            Validator("YOUR_ISSUER_ID", cache_config=cache_config).validate(request.data)
        except SignatureVerificationError:
            return False
        return True

Development

  • Install deps: uv sync --all-extras
  • Run tests: uv run pytest
  • Lint and format: pre-commit run --all-files
  • Before commit: pre-commit install

License

This project is licensed under the GPL-3.0-or-later. See LICENSE for details.

Made with ❤️

Metadata

Release files for google-wallet-webhook-auth 1.0.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 google-wallet-webhook-auth 1.0.0
File Size Uploaded
google_wallet_webhook_auth-1.0.0.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for google-wallet-webhook-auth 1.0.0
File Interpreter ABI Platform
google_wallet_webhook_auth-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / google_wallet_webhook_auth-1.0.0.tar.gz

Download URL google_wallet_webhook_auth-1.0.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1dad44801073b585dd4b01b3dec3a5b8b958a6ebee93aa5eb97c932e82144c26
BLAKE2b-256 checksum
How to use checksums
08d026d6dc96b8451f67d00f8a4c637f646d71503c8c04f29f9175d87933d1cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / google_wallet_webhook_auth-1.0.0-py3-none-any.whl

Download URL google_wallet_webhook_auth-1.0.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6655bed8eb0c0c69e388334cf6c562f0d947e9dbe704c99aee50212d57a2c1ae
BLAKE2b-256 checksum
How to use checksums
e0af84ff4638511e4ac9385028d78cf5bea0b62ce6762058e7cba4a7142727e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

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