UNPKG

@villedemontreal/jwt-validator

Version:
66 lines 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.constants = exports.Constants = void 0; // ========================================== // Application constants // ========================================== const app_root_path_1 = require("app-root-path"); const path = require("path"); /** * Library constants */ class Constants { constructor() { // From the "dist/src/config" folder this.libRoot = path.normalize(path.join(__dirname, '../../..')); this.appRoot = app_root_path_1.path; } /** * Errors related constants */ get errors() { return { codes: { // Main Code INVALID_HEADER: 'invalidHeader', ACCOUNT_ALREADY_EXISTS: 'accountAlreadyExists', ACCOUNT_NOT_FOUND: 'accountNotFound', ACCOUNT_ALREADY_VERIFIED: 'accountAlreadyVerified', INVALID_AUTHORIZATION_HEADER: 'invalidAuthorizationHeader', INVALID_JWT: 'invalidJWT', CODE_NOT_FOUND: 'codeNotFound', CODE_EXPIRED: 'codeExpired', PHONE_NOT_FOUND: 'phoneNotFound', UNABLE_TO_GET_PUBLIC_KEY: 'unableToGetPublicKey', // Value Code NULL_VALUE: 'nullValue', INVALID_VALUE: 'invalidValue', INVALID_EMAIL_VALUE: 'invalidEmailValue', UNAUTHORIZED_ACCESS: 'unauthorizedAccess', // Information Code TEST_REMAINING: 'testRemaining', }, }; } /** * Extra values that we can add to the original Express request. */ get requestExtraVariables() { return { JWT: 'jwt', }; } /** * Default values */ get default() { return { endpoint: '/api/security/v1/keys', fetchKeysParameters: 'state=active&state=revoked&offset=0&limit=25', cacheDuration: 60 * 5, }; } } exports.Constants = Constants; exports.constants = new Constants(); //# sourceMappingURL=constants.js.map