2025-02-14 01:32:03 +01:00
|
|
|
const sessionService = require('../services/sessionService');
|
|
|
|
|
|
|
|
|
|
async function attachPublicKeyMiddleware(req, res, next) {
|
2025-02-14 11:13:18 +01:00
|
|
|
const publicKey = await sessionService.getPublicKeyRelatedToSession(
|
|
|
|
|
req.cookies.sessionUuid
|
|
|
|
|
);
|
|
|
|
|
req.cookies.publicKey = publicKey;
|
2025-02-14 01:32:03 +01:00
|
|
|
|
2025-02-14 11:13:18 +01:00
|
|
|
next();
|
2025-02-14 01:32:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = attachPublicKeyMiddleware;
|