]>
Commit | Line | Data |
---|---|---|
9f10b292 | 1 | 'use strict' |
34ca3b52 | 2 | |
f0f5567b C |
3 | const checkErrors = require('./utils').checkErrors |
4 | const logger = require('../../helpers/logger') | |
34ca3b52 | 5 | |
fc51fde0 | 6 | const validatorsRemote = { |
528a9efa C |
7 | dataToDecrypt: dataToDecrypt, |
8 | remoteVideos: remoteVideos, | |
9 | signature: signature | |
9f10b292 | 10 | } |
34ca3b52 | 11 | |
528a9efa C |
12 | function dataToDecrypt (req, res, next) { |
13 | req.checkBody('key', 'Should have a key').notEmpty() | |
14 | req.checkBody('data', 'Should have data').notEmpty() | |
34ca3b52 | 15 | |
528a9efa | 16 | logger.debug('Checking dataToDecrypt parameters', { parameters: { keyLength: req.body.key.length, bodyLength: req.body.data.length } }) |
34ca3b52 | 17 | |
9f10b292 C |
18 | checkErrors(req, res, next) |
19 | } | |
34ca3b52 | 20 | |
528a9efa | 21 | function remoteVideos (req, res, next) { |
528a9efa | 22 | req.checkBody('data').isEachRemoteVideosValid() |
34ca3b52 | 23 | |
aaf61f38 | 24 | logger.debug('Checking remoteVideos parameters', { parameters: req.body }) |
34ca3b52 | 25 | |
9f10b292 C |
26 | checkErrors(req, res, next) |
27 | } | |
34ca3b52 | 28 | |
528a9efa | 29 | function signature (req, res, next) { |
9f10b292 C |
30 | req.checkBody('signature.url', 'Should have a signature url').isURL() |
31 | req.checkBody('signature.signature', 'Should have a signature').notEmpty() | |
c45f7f84 | 32 | |
528a9efa | 33 | logger.debug('Checking signature parameters', { parameters: { signatureUrl: req.body.signature.url } }) |
c45f7f84 | 34 | |
9f10b292 C |
35 | checkErrors(req, res, next) |
36 | } | |
c45f7f84 | 37 | |
9f10b292 | 38 | // --------------------------------------------------------------------------- |
c45f7f84 | 39 | |
fc51fde0 | 40 | module.exports = validatorsRemote |