{"size": 811, "ext": "js", "max_stars_repo_path": "dist/config/jwtAuth.js", "max_stars_repo_name": "ruza-net/gomoku", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/config/jwtAuth.js", "max_issues_repo_name": "ruza-net/gomoku", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/config/jwtAuth.js", "max_forks_repo_name": "ruza-net/gomoku", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.2608695652, "max_line_length": 85, "alphanum_fraction": 0.6510480888}
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
function jwtAuth(req, res) {
    const token = req.header("auth-token");
    // True if auth-token undefined <== missing auth-token in Request header
    if (!token)
        return res.status(401).send("Access Denied");
    try {
        const verified = jsonwebtoken_1.default.verify(token, process.env.JWTSECRET);
        req.user = verified;
        res.status(200).send(verified);
    }
    catch (err) {
        console.log(err);
        res.send(false);
    }
}
exports.default = jwtAuth;
//# sourceMappingURL=jwtAuth.js.map