diff --git a/spec/Overview.html b/spec/Overview.html index 7ae6339..ec606c0 100644 --- a/spec/Overview.html +++ b/spec/Overview.html @@ -27,7 +27,7 @@ github: "https://github.com/w3c/webcrypto", shortName: "WebCryptoAPI", group: "webappsec", - xref: ['html', 'dom', 'webidl', 'infra', 'encoding'], + xref: ['html', 'dom', 'webidl', 'infra', 'encoding', 'streams'], localBiblio: { "JWA": { aliasOf: "RFC7518" @@ -1220,6 +1220,19 @@

Serialization and deserialization steps

+
+

Iterable interfaces

+

+ 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. +

+
+typedef object IterableOfBufferSources;
+typedef object AsyncIterableOfBufferSources;
+        
+
+

SubtleCrypto interface

@@ -1254,7 +1267,7 @@

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

  • - 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.

  • @@ -1858,6 +1869,112 @@

    The digest method

    Let |promise| be a new Promise.

    +
  • +
    +
    If |data| is a {{BufferSource}}:
    +
    +

    + Let |bytes| be the result of + [= get a copy of the buffer source | + getting a copy of the bytes held by =] |data|. +

    +
    +
    + Otherwise, if |data| conforms to the + iterable interface or + async iterable interface: +
    +
    +
      +
    1. +

      + Let |bytes| be an empty [= byte sequence =]. +

      +
    2. +
    3. +

      + Let |iterator| be the result of calling + GetIterator(|data|, ASYNC). +

      +
    4. +
    5. +

      + If an error occurred, return a Promise rejected with + |iterator|. +

      +
    6. +
    7. +

      + [= Queue a microtask =] to perform the remaining steps. +

      +
    8. +
    9. +

      + While |iterator|.[[\Done]] is false: +

      +
        +
      1. +

        + Let |value| be the result of calling + IteratorStepValue(|iterator|). +

        +
      2. +
      3. +

        + If an error occurred, reject |promise| with + |value| and then terminate these steps. +

        +
      4. +
      5. +

        + Let |value| be the result of calling + Await(|value|). +

        +
      6. +
      7. +

        + If an error occurred, reject |promise| with + |value| and then terminate these steps. +

        +
      8. +
      9. +

        + If |value| is not a {{BufferSource}}, + reject |promise| with the result of calling + AsyncIteratorClose + with |iterator| and a {{TypeError}}, + and then terminate these steps. +

        +
      10. +
      11. +

        + Append the result of [= get a copy of the buffer source | + getting a copy of the bytes held by =] |value| + to |bytes|. +

        +
      12. +
      +
    10. +
    +
    +

    + 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. +

    +
    +
    +
    Otherwise:
    +
    +

    + Return a Promise rejected with a {{TypeError}}. +

    +
    +
    +
  • Return |promise| and perform the remaining steps [= in parallel =]. @@ -1873,11 +1990,29 @@

    The digest method

    and then [= terminate the algorithm =].

  • +
  • +

    + 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|.