Path of the HTTP request
Encryption password or its getter function
Class decorator
contracts/common.md#principled-implementation The decorator stores the password as metadata on the class and then applies Nest's Controller(path), so the encrypted decorators can find the password by reading the class.
contracts/common.md#clear-and-simple-design One decorator that composes a metadata write with the standard decorator.
contracts/common.md#prohibited-implementation-shortcuts It uses Nest's public Controller decorator and the reflect metadata API.
Encrypted controller.
EncryptedControlleris an extension of the nest.Controller 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 body of the HTTP protocol.By the way, you can configure the encryption password in the global level by using EncryptedModule instead of the nest.Module in the module level. In that case, you don't need to use this
EncryptedControllermore. Just use the nest.Controller without duplicated encryption password definitions.Of course, if you want to use different encryption password from the EncryptedModule, this
EncryptedControllerwould be useful again. Therefore, I recommend to use thisEncryptedControllerdecorator function only when you must configure different encryption password from the EncryptedModule.