graphhook

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graphhook holds the Meta Graph webhook plumbing shared by the Cloud API chat adapters (WhatsApp today, Messenger next): the one-time hub.challenge subscribe handshake and the X-Hub-Signature-256 raw-body HMAC check. Both compare in constant time via hmac.Equal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleVerify

func HandleVerify(w http.ResponseWriter, r *http.Request, verifyToken string)

HandleVerify answers the subscribe handshake: it echoes the raw hub.challenge with a 200 iff hub.mode is "subscribe" and hub.verify_token matches verifyToken (constant time), and replies 403 otherwise.

func ValidSignature

func ValidSignature(header string, body []byte, secret string) bool

ValidSignature checks header = "sha256=" + hex(HMAC-SHA256(body, secret)) in constant time, as Meta signs every webhook POST over the raw body.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL