- From: Aymeric Vitte <vitteaymeric@gmail.com>
- Date: Thu, 05 Sep 2013 18:41:13 +0200
- To: "public-webcrypto@w3.org" <public-webcrypto@w3.org>
- CC: Arun Ranganathan <arun@mozilla.com>
Hi, I have tried to WebCryptofy something I am currently working on, it's here : https://gist.github.com/Ayms/6451926 This is using Webcrypto, File API, indexedDB, createObjectURL and Workers, the target is to load a file from you disk, encrypt it, calculate the hash of the encrypted file and store the results in indexedDB, I have tried to keep the code minimal which is not very difficult since the combination of the different APIs is really great (despite of some details, see below) Ideally we should not need workers if the File API was able to produce delta results on progress while reading a file instead of incremental data (comment made on the webapps list and apparently everybody agree/already knew that partial Blob as defined today are not usefull, ccing Arun who just put a ticket to remove partial Blob data in the API) But if we forget this, at least this is an example using Workers (there are none in the docs) without loading the worker code from the outside (security consideration), for the WebCrypto workers code you will notice a 'workersubtle' invention since it's not defined yet. The Worker is slicing and encrypting the file, the hash is calculated on delta postMessage results, of course there are different ways of doing this (the hash could be inside the worker too), I choosed that one for the example. Unless I am using them incorrectly, Promises seem not to be very usefull here (until other APIs use it too probably) and despite of the fact that 'done' has been removed from the latest Promises specs, I am using it since I don't see the point of using 'then' for non chained operations (but again maybe wrongly) For your review to check if it is in line with the specs/conform with the WebCrypto expected use, corrections/modifications and consideration if you find an interest to reference it in the docs. Regards, Aymeric -- jCore Email : avitte@jcore.fr Peersm : http://www.peersm.com iAnonym : http://www.ianonym.com node-Tor : https://www.github.com/Ayms/node-Tor GitHub : https://www.github.com/Ayms Web : www.jcore.fr Extract Widget Mobile : www.extractwidget.com BlimpMe! : www.blimpme.com
Received on Thursday, 5 September 2013 16:41:50 UTC