Skip to content
This repository was archived by the owner on May 23, 2026. It is now read-only.

dxxxxy/shoppyhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shoppyhook

Superseded by dxxxxy/hmacverify

A really simple and lightweight shoppy webhook middleware for express.

It will only let webhook requests pass that have a valid signature, meaning that faking purchase webhooks is not possible (provided that you do not leak your secret). The body will then be available as a JSON object in req.body.

Install

npm i shoppyhook

Usage

const shoppyhook = require("shoppyhook")

app.use("/your/shoppy/endpoint", shoppyhook("secret"))

Parser issues

You need to disable any parser you have enabled for the webhook route, otherwise it will not work as it requires the raw unparsed body.

Example: Using json as a global parser through app.use(express.json()), I can simply replace it with this workaround, which applies it globally except for that specific shoppy webhook route.

app.use(req, res, next => req.path != "/your/shoppy/endpoint" ? express.json(req, res, next) : next())

Disclaimer

This is for educational purposes only. I am not responsible for any damage caused by this tool.

License

GPLv3 © dxxxxy

About

A really simple and lightweight shoppy webhook middleware for express. It will only let webhook requests pass that have a valid signature, meaning that faking purchase webhooks is not possible (provided that you do not leak your secret). The body will then be available as a JSON object in req.body.

Topics

Resources

License

Stars

Watchers

Forks

Contributors