Function: authenticateServiceAuth()
authenticateServiceAuth(
verifier):MiddlewareHandler<ChiveEnv>
Defined in: src/api/middleware/auth.ts:68
Creates ATProto service auth middleware.
Parameters
verifier
ServiceAuthVerifier
ATProto service auth verifier
Returns
MiddlewareHandler<ChiveEnv>
Hono middleware handler
Remarks
Extracts Bearer token from Authorization header and verifies it as an ATProto service auth JWT. Sets authenticated user in context if valid token present.
By default, authentication is optional - requests without tokens
continue as anonymous. Use requireAuth() for mandatory auth.
Example
const verifier = new ServiceAuthVerifier({
logger,
config: { serviceDid: 'did:web:chive.pub' },
});
app.use('*', authenticateServiceAuth(verifier));