Module configuration metadata
Encryption password or its getter function
Class decorator
contracts/common.md#principled-implementation A visited set breaks import cycles, the controllers of each visited module get the password as metadata, asynchronous modules are awaited through the same promise Nest awaits, and a forward reference is resolved once its class exists.
contracts/common.md#clear-and-simple-design One decorator whose traversal is a private function; the dynamic-module helper is in the merged namespace.
contracts/common.md#prohibited-implementation-shortcuts The traversal uses the public metadata keys of Nest modules; no module name is special-cased.
Encrypted module.
EncryptedModuleis an extension of the Module class decorator function who configures encryption password of the AES-128/192/256 algorithm. The encryption algorithm and password would be used by EncryptedRoute and EncryptedBody to encrypt the request and response bod of the HTTP protocol.By using this
EncryptedModuledecorator function, all of the Controller controllers configured in the metadata would be automatically changed to the EncryptedController with the password, and so would the controllers of every module it imports: module classes, dynamic modules ({ module, imports, controllers }),forwardRef()s, and promises of them, however deep and even when cyclic. If there're some original EncryptedController decorated classes in the metadata, their encryption password would be kept, as would a subclass's that inherits one.Therefore, if you're planning to place original EncryptedController decorated classes in the metadata, I hope them to have different encryption password from the module level. If not, I recommend you use the Controller decorator function instead.
In addition, the
EncryptedModulesupports a convenient dynamic controller importing function, EncryptedModule.dynamic. If you utilize the function with directory path of the controller classes, it imports and configures the controller classes into theModule, automatically.