module Hook::Echo

Defined in:

hook-echo.cr

Constant Summary

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 Method Summary

Class Method Detail

def self.accept(context) #

[View source]
def self.extract_body(context) #

read the request payload (max 1mb) into memory


[View source]
def self.no_unicorns(context) #

generic 404 message


[View source]
def self.route(context) #

simple router that matches:

  1. POST -> /

[View source]
def self.run #

[View source]
def self.signature_mismatch(context) #

specific 403 message when the payload signatures do not match


[View source]
def self.verified?(sig, payload) #

verify the remote signature with our locally calculated signature


[View source]