Documentation
    Preparing search index...

    Function EncryptedBody

    • Encrypted body decorator.

      EncryptedBody is a decorator function getting application/json typed data from request body which has been encrypted by AES-128/192/256 algorithm. Also, EncryptedBody validates the request body data type through typia using the declared TypeScript type.

      For reference, when the request body data is not following the promised type T, BadRequestException error (status code: 400) would be thrown. Also, This decorator decrypts the request body using these options.

      • AES-128/192/256
      • CBC mode
      • PKCS #5 Padding
      • Base64 Encoding

      Successful validator data becomes the decorated argument, including copies returned by clone validators after decryption and JSON parsing.

      Type Parameters

      • T

      Parameters

      • Optionalvalidator: IRequestBodyValidator<T>

      Returns ParameterDecorator

      Parameter decorator

      Jeongho Nam - https://github.com/samchon

      contracts/common.md#principled-implementation The body must be text/plain ciphertext; it is decrypted with the password of the controller or module, the plain text is parsed as JSON and validated by the transformed validator, and a decryption or parse failure becomes a 400 with one fixed message that does not echo the ciphertext and does not tell the two failures apart; a key or initialization vector the cipher itself refuses is the server's configuration, independent of the request, and is thrown as it is.

      contracts/common.md#clear-and-simple-design One parameter decorator composes shared text reading, password lookup and validator resolution; the successfully resolved data becomes the argument without repeating validation or changing decryption error handling.

      contracts/common.md#prohibited-implementation-shortcuts The algorithm comes from AesPkcs5 of the fetcher, the same one the client uses, and no key is embedded; a missing password is an error rather than a plain pass-through.

      contracts/common.md#meaningful-documentation The comment describes the protocol and the requirement of a password on the controller or module, and the private decode helper documents why every decryption failure collapses into one response.

      contracts/portability.md#os-neutral-implementation Ciphertext parsing, AES decryption and request validation operate on HTTP values, with no native filesystem or subprocess boundary.