validators.js
1 const { hexValidator } = require("./utils"); 2 const { check } = require("express-validator"); 3 4 module.exports = { 5 subscribe: [ 6 check("signature") 7 .exists() 8 .isLength({ min: 132, max: 132 }) 9 .custom(hexValidator), 10 check("address") 11 .exists() 12 .isLength({ min: 42, max: 42 }) 13 .custom(hexValidator), 14 check("email") 15 .exists() 16 .isEmail(), 17 check("dappId").exists() 18 ], 19 unsubscribe: [ 20 check("signature") 21 .exists() 22 .isLength({ min: 132, max: 132 }) 23 .custom(hexValidator), 24 check("address") 25 .exists() 26 .isLength({ min: 42, max: 42 }) 27 .custom(hexValidator), 28 check("dappId").exists() 29 ], 30 confirm: [check("token").exists()], 31 userExists: [ 32 check("address") 33 .exists() 34 .isLength({ min: 42, max: 42 }) 35 .custom(hexValidator), 36 check("dappId").exists() 37 ] 38 };