aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/remote/signature.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/remote/signature.ts')
-rw-r--r--server/middlewares/validators/remote/signature.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/server/middlewares/validators/remote/signature.ts b/server/middlewares/validators/remote/signature.ts
index eb5c196eb..d3937b515 100644
--- a/server/middlewares/validators/remote/signature.ts
+++ b/server/middlewares/validators/remote/signature.ts
@@ -1,17 +1,19 @@
1import 'express-validator' 1import { body } from 'express-validator/check'
2import * as express from 'express' 2import * as express from 'express'
3 3
4import { logger } from '../../../helpers' 4import { logger, isHostValid } from '../../../helpers'
5import { checkErrors } from '../utils' 5import { checkErrors } from '../utils'
6 6
7function signatureValidator (req: express.Request, res: express.Response, next: express.NextFunction) { 7const signatureValidator = [
8 req.checkBody('signature.host', 'Should have a signature host').isURL() 8 body('signature.host').custom(isHostValid).withMessage('Should have a signature host'),
9 req.checkBody('signature.signature', 'Should have a signature').notEmpty() 9 body('signature.signature').not().isEmpty().withMessage('Should have a signature'),
10 10
11 logger.debug('Checking signature parameters', { parameters: { signature: req.body.signature } }) 11 (req: express.Request, res: express.Response, next: express.NextFunction) => {
12 logger.debug('Checking signature parameters', { parameters: { signature: req.body.signature } })
12 13
13 checkErrors(req, res, next) 14 checkErrors(req, res, next)
14} 15 }
16]
15 17
16// --------------------------------------------------------------------------- 18// ---------------------------------------------------------------------------
17 19