Member-only story
Wrapping Encryption
Don’t you love (and hate) JavaScript? For one, it has little to do with Java, and, for two, it can be a nightmare to test. For testing, we go back to the days when we used to add PRINT statements to test our programs. As it is an interpreted language, we have no guarantee that the code is actually going to run in the browser, that the code will fail gracefully, and that the user will be given no sign that the code has failed. But, JavaScript is wonderful, as we don’t need all those callbacks to the server to perform our code, as we can do it in the browser. This leads to ultrafast code.
In the case of JavaScript, testing is typically done with console.log() statements and within the browser console. In this case, we have a console.log() statement in Chrome that will show the details of an encryption key:
As far as the user can see, the messages in the console do not appear on the rendered page.
To me, cryptography that happens in the browser is just pure magic, and gives us security that right to the point where the user typically interfaces with the Internet. So let’s wrap some keys in the browser.