module

Hook::Echo

Constants

MAX_PAYLOAD = 2 ** 20

you should probably always put an upperbound on how much data your application is willing to read into memory

SIGNATURE_HEADER = "X-FP-Webhook-Signature-Hmac-Sha-256"

this is the header that stores the signature flowplayer generates to verify that it hasn't been tampered with in the middle

SIGNING_SECRET = ENV["FLOWPLAYER_WEBHOOK_SECRET"]

fetch the signing secret from environment variables

VERSION = "0.1.0"

Class methods

accept(context)
Source
extract_body(context)

read the request payload (max 1mb) into memory

Source
no_unicorns(context)

generic 404 message

Source
route(context)

simple router that matches:

  1. POST -> /
Source
signature_mismatch(context)

specific 403 message when the payload signatures do not match

Source
verified?(sig, payload)

verify the remote signature with our locally calculated signature

Source