Registry / auth-security / gittoken-api-middleware

gittoken-api-middleware

JSON →
library0.2.22jsnpmunverified

Express middleware for validating GitHub webhook payloads using GitToken's Ethereum-based token system (v0.2.x). Provides HMAC signature verification with the webhook secret stored on-chain via ERC20 tokens. Key differentiator: integrates blockchain-based authorization directly into webhook handling, enabling token-gated CI/CD pipelines. Compatible with Express 4.x. Not suitable for non-GitHub webhooks or stateless applications. Release cadence: monthly updates.

npm install gittoken-api-middleware
INSTALL
IMPORT
SIG · GITTOKEN-API-MIDDL
G
gittoken-api-middleware
auth-securityjavascriptv0.2.22
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gittokenApiMiddleware
import gittokenApiMiddleware from 'gittoken-api-middleware'
const gittokenApiMiddleware = require('gittoken-api-middleware').default
ESM default export; require() needs .default

Sets up Express server with GitToken middleware validating GitHub webhooks using on-chain secret.

import express from 'express'; import gittokenApiMiddleware from 'gittoken-api-middleware'; const app = express(); const contractAddress = process.env.GTK_CONTRACT_ADDRESS ?? '0x...'; const accountKey = process.env.GTK_ACCOUNT_KEY ?? ''; app.post('/webhook', express.raw({type: 'application/json'}), gittokenApiMiddleware({ contractAddress, accountKey }), (req, res) => { const payload = JSON.parse(req.body); console.log('Valid webhook:', payload); res.status(200).end(); }); app.listen(3000, () => console.log('Server running'));
Debug
Known issues
gotchaMiddleware requires raw body to be parsed after the middleware, not before
fix
Use express.raw() or body-parser with verify option to keep raw buffer
affects: >=0.1.0
deprecatedVersion 0.x may change API without notice
fix
Pin exact version in package.json
affects: >=0.0.0 <1.0.0
Errors
Common errors & fixes
TypeError: gittokenApiMiddleware is not a function
Default import mismatch when using CommonJS
fix
Use const { default: gittokenApiMiddleware } = require('gittoken-api-middleware');
Invalid webhook signature
Raw body not passed to middleware correctly
fix
Ensure express.raw() is used before middleware and body is JSON
Upgrade
Version history
0.2.22latest on npm
Audit
Dependencies
expressrequiredExpress middleware framework
web3requiredEthereum interaction
Agent activity
12 hits · last 30 days
node
10
Resources
gittoken-api-middleware — npm install gittoken-api-middleware · libregistry