Thank you for your clear answer.
Then, is it possible to use this process to keep the code confidential ?
1. The user buy his own ESP32
2. He download a binary loader app I provide(code not encrypted)
3. He burn the ESP32 with this binary (using esptool-js)
4. Then after restarting ESP32, the binary loader connect to internet, download the encrypted app and install it OTA, with encryption.
No. It is impossible from a theoretical cryptographic level as you do not have a root of trust. For instance, with your scheme above, the binary loader can be modified to skip over the encryption step. You'd flash the modified loader to an ESP32, let it download and install the OTA, then simply read out the flash. Alternatively, someone could run the binary loader in an emulator, let it do its thing, then use the emulator debug features to dump the firmware.
Generally, the 1st step of whatever process you need to come up with involves flashing a binary that you provide into the ESP32, and that binary must be unencrypted and cannot be verified as being not tampered with by the ESP32 it's flashed to. Because of that, it's pretty easy to reverse engineer it and modify it. That means that you can change it to skip verification and encryption of any step after it as well. An attacker can simply keep doing that until they reached your actual firmware, then dump that.
The only way around that that I can imagine is to not have the actual important bits of whatever you are making in the firmware. If you do that on a server on the Internet, you can make sure that only one license has access to that at one time. If someone copies your firmware then, without a license they still cannot do the thing they intended. Downside is that this requires always-on WiFi (meaning the thing you're making won't work when there's no Internet connectivity), and the things you do on the server must not be so trivial that someone can easily create a replacement server from scratch.