/** * @module routes/verifyRoutes */ import { Router } from 'express'; import { asyncHandler, AppError } from '../errors.js'; import { verifyTimestamp, verifyBatch } from '../services/verifyService.js'; export const verifyRoutes = Router(); verifyRoutes.post( '/', asyncHandler(async (req, res) => { const { certificate } = req.body ?? {}; if (!certificate) { throw new AppError('certificate is required', { status: 400, code: 'VALIDATION_ERROR' }); } const result = await verifyTimestamp(req.auth, { certificate }); res.json(result); }), ); verifyRoutes.post( '/batch', asyncHandler(async (req, res) => { const { certificates } = req.body ?? {}; if (!Array.isArray(certificates) || certificates.length === 0) { throw new AppError('certificates array is required', { status: 400, code: 'VALIDATION_ERROR', }); } const result = await verifyBatch(req.auth, { certificates }); res.json(result); }), );