@orangecheck/gate / ocGate
Function: ocGate()
function ocGate(opts: GateOptions): (req: MinimalReq, res: MinimalRes, next: (err?: unknown) => void) => Promise<void>;
Defined in: express.ts:23
Express / Connect / Next-pages-API middleware.
import { ocGate } from '@orangecheck/gate';
app.post( '/post', ocGate({ minSats: 100_000, minDays: 30, address: { from: 'header' }, // reads X-OC-Address }), postHandler, );
On block: sends 403 { error: '<reason>', orangecheck: <CheckResult|null> }
unless opts.onBlocked is provided.
Parameters
| Parameter | Type |
|---|---|
opts | GateOptions |
Returns
(req: MinimalReq, res: MinimalRes, next: (err?: unknown) => void) => Promise<void>