live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/gate


@orangecheck/gate / assertOc

Function: assertOc()

function assertOc(req: MinimalReq, opts: GateOptions): Promise<GateDecision>;

Defined in: core.ts:131

Run the OrangeCheck lookup + threshold comparison for a request, without touching the response. Framework-agnostic. Use this directly in Fastify, Hono, Workers, or anywhere Express middleware doesn't fit.

const decision = await assertOc(req, { minSats: 100_000, address: { from: 'header' } }); if (!decision.ok) return res.status(403).json({ error: decision.reason });

Parameters

ParameterType
reqMinimalReq
optsGateOptions

Returns

Promise&lt;GateDecision>