Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (lsat.isExpired()) {
req.logger.debug(
`Request made with expired LSAT for ${req.originalUrl} from ${req.hostname}`
)
res.status(401)
return next({
message: 'Unauthorized: Request made with expired LSAT',
})
}
// verify macaroon
const { SESSION_SECRET } = getEnvVars()
const macaroon = lsat.getMacaroon()
const isValid = verifyFirstPartyMacaroon(
macaroon.serialize(),
SESSION_SECRET,
req.boltwallConfig?.caveatSatisfiers,
req
)
if (!isValid) {
req.logger.debug('Request made with invalid LSAT macaroon')
res.status(401)
return next({
message: 'Unauthorized: LSAT invalid',
})
}
next()
}