"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "JwtService", {
    enumerable: true,
    get: function() {
        return JwtService;
    }
});
const _jsonwebtoken = require("jsonwebtoken");
const _serverconstants = require("../../server.constants");
class JwtService {
    settingsStore;
    configService;
    constructor({ settingsStore, configService }){
        this.settingsStore = settingsStore;
        this.configService = configService;
    }
    async signJwtToken(userId, username) {
        const { jwtSecret, jwtExpiresIn } = await this.settingsStore.getCredentialSettings();
        return (0, _jsonwebtoken.sign)({
            userId,
            username
        }, jwtSecret, {
            expiresIn: jwtExpiresIn,
            subject: userId.toString(),
            audience: this.configService.get(_serverconstants.AppConstants.OVERRIDE_JWT_AUDIENCE, _serverconstants.AppConstants.DEFAULT_JWT_AUDIENCE),
            issuer: this.configService.get(_serverconstants.AppConstants.OVERRIDE_JWT_ISSUER, _serverconstants.AppConstants.DEFAULT_JWT_ISSUER)
        });
    }
}

//# sourceMappingURL=jwt.service.js.map