EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
auth.js
Go to the documentation of this file.
1const jwt = require('jsonwebtoken');
2
3/**
4 * Verify agent JWT token signed with AGENT_SIGN_KEY
5 * @param {string} token - JWT token from agent
6 * @returns {object|null} - Decoded payload or null if invalid
7 */
8function verifyTenantJwt(token) {
9 if (!token) return null;
10
11 try {
12 const decoded = jwt.verify(token, process.env.AGENT_SIGN_KEY);
13 return decoded;
14 } catch (err) {
15 console.error('JWT verification failed:', err.message);
16 return null;
17 }
18}
19
20module.exports = { verifyTenantJwt };
21