All encryption will take place on the browser, using Open PGP standards. The server will see only encrypted data.
You've already lost. If someone can compromise your server, they can serve up a web page containing modified code.
You've already lost. If someone can compromise your server, they can serve up a web page containing modified code.
However, the client-side code will be open source and digitally signed.
It's not perfect, and you shouldn't use it for state secrets, but it's a damn sight better than anything out there right now.