]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/validators/remote/signature.ts
d3937b5150c425a80e36743297c68122e9395d3d
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / remote / signature.ts
1 import { body } from 'express-validator/check'
2 import * as express from 'express'
3
4 import { logger, isHostValid } from '../../../helpers'
5 import { checkErrors } from '../utils'
6
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'),
10
11 (req: express.Request, res: express.Response, next: express.NextFunction) => {
12 logger.debug('Checking signature parameters', { parameters: { signature: req.body.signature } })
13
14 checkErrors(req, res, next)
15 }
16 ]
17
18 // ---------------------------------------------------------------------------
19
20 export {
21 signatureValidator
22 }