UNPKG

@duongtrungnguyen/nestro

Version:
70 lines 3.08 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __decorateClass = (decorators, target, key, kind) => { var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result; if (kind && result) __defProp(target, key, result); return result; }; var security_module_exports = {}; __export(security_module_exports, { SecurityModule: () => SecurityModule }); module.exports = __toCommonJS(security_module_exports); var import_common = require("@nestjs/common"); var path = __toESM(require("path")); var import_os = __toESM(require("os")); var import_constants = require("./constants"); var import_services = require("./services"); let SecurityModule = class { static register(options) { const keyServiceOptionsProvider = { provide: import_constants.KEY_SERVICE_OPTIONS, useValue: { initKeys: options?.initKeys ?? false, privateKeyPath: options?.privateKeyPath?.replace(/^~\//, `${import_os.default.homedir()}/`) ?? path.join(__dirname, "private.pem"), publicKeyPath: options?.publicKeyPath?.replace(/^~\//, `${import_os.default.homedir()}/`) ?? path.join(__dirname, "public.pem") } }; return { module: SecurityModule, providers: [keyServiceOptionsProvider, import_services.KeyService], exports: [import_services.KeyService] }; } }; SecurityModule = __decorateClass([ (0, import_common.Module)({}) ], SecurityModule); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { SecurityModule }); //# sourceMappingURL=security.module.js.map