From 252ff084cd6ecc91ff711c73cce17266a739b69e Mon Sep 17 00:00:00 2001
From: Daniel Huigens
+ The IterableOfBufferSources type represents objects that conform to the iterable interface, and produce {{BufferSource}} values when iterated over.
+ The AsyncIterableOfBufferSources type represents objects that conform to the async iterable interface, and produce {{BufferSource}} values when asynchronously iterated over.
+ This is checked by the calling functions rather than by Web IDL.
+
@@ -1254,7 +1267,7 @@
- Let |data| be the result of
- [= get a copy of the buffer source |
- getting a copy of the bytes held by =] the `data` parameter passed to the
+ Let |data| be the `data` parameter passed to the
{{SubtleCrypto/digest()}} method.
Serialization and deserialization steps
+ Iterable interfaces
+
+typedef object IterableOfBufferSources;
+typedef object AsyncIterableOfBufferSources;
+
+ SubtleCrypto interface
SubtleCrypto interface
);
Promise<ArrayBuffer> digest(
AlgorithmIdentifier algorithm,
- BufferSource data
+ (BufferSource or IterableOfBufferSources or AsyncIterableOfBufferSources) data
);
Promise<(CryptoKey or CryptoKeyPair)> generateKey(
@@ -1828,9 +1841,7 @@ The digest method
The digest method
Let |promise| be a new Promise.
+ Let |bytes| be the result of + [= get a copy of the buffer source | + getting a copy of the bytes held by =] |data|. +
++ Let |bytes| be an empty [= byte sequence =]. +
+
+ Let |iterator| be the result of calling
+ GetIterator(|data|, ASYNC)
.
+
+ If an error occurred, return a Promise rejected with + |iterator|. +
++ [= Queue a microtask =] to perform the remaining steps. +
+
+ While |iterator|.[[\Done]]
is false:
+
+ Let |value| be the result of calling
+ IteratorStepValue(|iterator|)
.
+
+ If an error occurred, reject |promise| with + |value| and then terminate these steps. +
+
+ Let |value| be the result of calling
+ Await(|value|)
.
+
+ If an error occurred, reject |promise| with + |value| and then terminate these steps. +
+
+ If |value| is not a {{BufferSource}},
+ reject |promise| with the result of calling
+ AsyncIteratorClose
+ with |iterator| and a {{TypeError}},
+ and then terminate these steps.
+
+ Append the result of [= get a copy of the buffer source | + getting a copy of the bytes held by =] |value| + to |bytes|. +
+
+ If the |iterator| returned by GetIterator(|data|, ASYNC)
+ is the iterator defined by {{ReadableStream}},
+ the implementation may wish to optimize the steps
+ above, for example by reading the stream directly,
+ and/or transferring
+ the stream to the [= in parallel | parallel =] steps below.
+
+ Return a Promise rejected with a {{TypeError}}. +
+Return |promise| and perform the remaining steps [= in parallel =]. @@ -1873,11 +1990,29 @@
+ Wait until the microtask queued above (if any) completes. +
++ The implementation may wish to compute the hash digest + incrementally, instead of waiting until all data is + available, in order to conserve memory. +
++ If |promise| was rejected with an error, + [= terminate the algorithm =]. +
+Let |digest| be the result of performing the digest operation specified by |normalizedAlgorithm| using - |algorithm|, with |data| + |algorithm|, with |bytes| as |message|.