I’m very interested in doing cryptography in the browser for things like end-to-end sealing of data and digital signatures. It’s been possible to do some of these things, but not practical. The W3C’s new Web Cryptography API should change that. I’ve been following its progress with interest, and just discovered that it has been partially implemented in Internet Explorer 11 and Google Chrome 35 (behind an experimental flag). So I’ve started fiddling with it, and I’m going to put notes here in my blog using the webcrypto tag.
var b = new Uint8Array(1024); creates a data structure that can hold one kilobyte. You can work with each byte individually, as in
b = 72; b = b + 1; and so on.
Suppose the asynchronous operation doSomething returns a promise. Then you can do the following:
var p = doSomething(param1, param2);
var p1 = p.then(handleResult, handleError);
A popular way to write this seems to be:
Although I’m considering writing it like this (at least until I know a reason not to):