Streaming - [Re: CryptoOperation and its life cycle]

> onprogress follows the Progress Events model, in which the client is
> informed of progress. There is always at least one onprogress event
> (which may be due to the final completion of the data), and there is
> always zero or one oncomplete events. At the oncomplete event firing,
> all of the data is available in result.
>
> This was raised as a point of concern by Wan-Teh back on June 20th,
> but it arguably follows the model of what existing APIs (such as File
> API or Streams API) do through their readAsArrayBuffer methods, and
> with how XMLHttpRequest makes data available through progress events.
>
> To be clear: .result contains the data available, and may grow to add
> more data, up and until oncomplete is fired.
>
The specs say : "an interface to support streaming/progressive output 
has also been requested. How such an interface would be implemented, if 
at all, remains TBD."

I assume this is related to the case below, current implementations of 
streaming can do something like :

var H=new Hash('sha1');
H.update(stream1);
var res1=H.digest(stream1);
H.update(stream2);//hash stream1+stream2
var res2=H.digest(stream2);
etc...

Which can become with Webcrypto something like :

var H=(new Hash('sha1')).digest();
H.process(stream);//stream1
H.onprogress=function() {
     console.log(this.result);
     this.process(stream);//stream2
};

Apparently this will return stream1 hash and stream2 hash (not stream1 
hash followed by stream1 + stream2 hash), probably I am misreading 
something because it looks therefore useless to call several time 
"process" for the same CryptoOperation object and the list of pending 
data is only feeded by "process" which empty it, then for now it's not 
really a list (should not the list of pending data be updated when 
process ends ?).

PS : typos in the spec
12.1.2.3bis "Remove data from the list of pending data." --> "Remove 
item from the list of pending data."
19.3.4 "Upon invoking init: " --> what init method ?

-- 
jCore
Email :  avitte@jcore.fr
GitHub : https://www.github.com/Ayms
Web :    www.jcore.fr
Webble : www.webble.it
Extract Widget Mobile : www.extractwidget.com
BlimpMe! : www.blimpme.com

Received on Thursday, 13 December 2012 10:14:01 UTC