Skip to content
On this page

Function: ocAuthHono()

TypeScript
function ocAuthHono(options?: WithOcAuthOptions): (c: HonoContextLike, next: HonoNextLike) => Promise<unknown>;

Defined in: me-client/src/server.ts:873 (opens in a new tab)

Hono middleware. Attaches the verified session at c.get('ocSession').

import { Hono } from 'hono'; import { ocAuthHono, type OcHonoEnv } from '@orangecheck/me-client/server';

const app = new Hono<OcHonoEnv>(); app.use('*', ocAuthHono());

app.get('/api/profile', (c) => { const session = c.get('ocSession'); if (!session) return c.json({ error: 'sign in' }, 401); return c.json({ address: session.did_oc }); });

ParametersLink to this section

ParameterType
optionsWithOcAuthOptions

ReturnsLink to this section

(c: HonoContextLike, next: HonoNextLike) => Promise<unknown>