]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/remote/signature.ts
Upgrade server packages
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / remote / signature.ts
CommitLineData
b60e5f38 1import { body } from 'express-validator/check'
69818c93
C
2import * as express from 'express'
3
b60e5f38 4import { logger, isHostValid } from '../../../helpers'
65fcc311 5import { checkErrors } from '../utils'
34ca3b52 6
b60e5f38
C
7const 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
20export {
21 signatureValidator
22}