]>
Commit | Line | Data |
---|---|---|
b60e5f38 | 1 | import { body } from 'express-validator/check' |
69818c93 C |
2 | import * as express from 'express' |
3 | ||
b60e5f38 | 4 | import { logger, isHostValid } from '../../../helpers' |
65fcc311 | 5 | import { checkErrors } from '../utils' |
34ca3b52 | 6 | |
b60e5f38 C |
7 | const signatureValidator = [ |
8 | body('signature.host').custom(isHostValid).withMessage('Should have a signature host'), | |
9 | body('signature.signature').not().isEmpty().withMessage('Should have a signature'), | |
c45f7f84 | 10 | |
b60e5f38 C |
11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
12 | logger.debug('Checking signature parameters', { parameters: { signature: req.body.signature } }) | |
c45f7f84 | 13 | |
b60e5f38 C |
14 | checkErrors(req, res, next) |
15 | } | |
16 | ] | |
c45f7f84 | 17 | |
9f10b292 | 18 | // --------------------------------------------------------------------------- |
c45f7f84 | 19 | |
65fcc311 C |
20 | export { |
21 | signatureValidator | |
22 | } |