mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
16 lines
474 B
JavaScript
16 lines
474 B
JavaScript
import { verifySignature } from '../security'
|
|
const debug = require('debug')('ea:verify')
|
|
|
|
export default async (req, res, next) => {
|
|
debug(`actorId = ${req.body.actor}`)
|
|
// TODO stop if signature validation fails
|
|
if (await verifySignature(`${req.protocol}://${req.hostname}:${req.port}${req.originalUrl}`, req.headers)) {
|
|
debug('verify = true')
|
|
next()
|
|
} else {
|
|
// throw Error('Signature validation failed!')
|
|
debug('verify = false')
|
|
next()
|
|
}
|
|
}
|