Initial import of verae-middleware from zapier monorepo

This commit is contained in:
George Lambert 2026-09-11 15:35:55 -04:00
commit 3390a9a8c0
67 changed files with 6630 additions and 0 deletions

View file

@ -0,0 +1,36 @@
/**
* @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);
}),
);