@nestia/core
Version:
Super-fast validation decorators of NestJS
36 lines • 1.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncryptedController = EncryptedController;
const common_1 = require("@nestjs/common");
const EncryptedConstant_1 = require("./internal/EncryptedConstant");
/**
* Encrypted controller.
*
* `EncryptedController` is an extension of the {@link nest.Controller} class decorator
* function who configures encryption password of the AES-128/256 algorithm. The
* encryption algorithm and password would be used by {@link EncryptedRoute} and
* {@link EncryptedBody} to encrypt the request and response body of the HTTP protocol.
*
* By the way, you can configure the encryption password in the global level by using
* {@link EncryptedModule} instead of the {@link nest.Module} in the module level. In
* that case, you don't need to use this `EncryptedController` more. Just use the
* {@link nest.Controller} without duplicated encryption password definitions.
*
* Of course, if you want to use different encryption password from the
* {@link EncryptedModule}, this `EncryptedController` would be useful again. Therefore,
* I recommend to use this `EncryptedController` decorator function only when you must
* configure different encryption password from the {@link EncryptedModule}.
*
* @param path Path of the HTTP request
* @param password Encryption password or its getter function
* @returns Class decorator
*
* @author Jeongho Nam - https://github.com/samchon
*/
function EncryptedController(path, password) {
return function (target) {
Reflect.defineMetadata(EncryptedConstant_1.ENCRYPTION_METADATA_KEY, password, target);
(0, common_1.Controller)(path)(target);
};
}
//# sourceMappingURL=EncryptedController.js.map