@duongtrungnguyen/nestro
Version:
Service registry for Nest JS
39 lines • 1.42 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
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;
};
import { Module } from "@nestjs/common";
import * as path from "path";
import os from "os";
import { KEY_SERVICE_OPTIONS } from "./constants";
import { KeyService } from "./services";
let SecurityModule = class {
static register(options) {
const keyServiceOptionsProvider = {
provide: KEY_SERVICE_OPTIONS,
useValue: {
initKeys: options?.initKeys ?? false,
privateKeyPath: options?.privateKeyPath?.replace(/^~\//, `${os.homedir()}/`) ?? path.join(__dirname, "private.pem"),
publicKeyPath: options?.publicKeyPath?.replace(/^~\//, `${os.homedir()}/`) ?? path.join(__dirname, "public.pem")
}
};
return {
module: SecurityModule,
providers: [keyServiceOptionsProvider, KeyService],
exports: [KeyService]
};
}
};
SecurityModule = __decorateClass([
Module({})
], SecurityModule);
export {
SecurityModule
};
//# sourceMappingURL=security.module.js.map