Reputation: 4428
Learn Next.js mentions "encrypted closures" as an important security mechanism as part of Server Actions, where some of your Next.js app runs on the server instead of in client-side JavaScript.
I know what a closure is and I know what encryption is. However, I have no idea (and can't find any resources about) what "encrypted closures" are. Does anyone know:
I searched google, bing, and ChatGPT for information but couldn't find anything.
Upvotes: 1
Views: 166
Reputation: 4428
Defining a Server Action (the closure) inside a (client-side) component means that any captured variables are sent to the client on page load and then back to the server when the action is invoked. These captured variables may contain sensitive information, so Next.js automatically encrypts them so that the client can't read them.
Upvotes: 1