From e8b28fb6241c579e73f9f5d8e822341151fd7be6 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 30 Jun 2025 15:22:01 +1000 Subject: [PATCH 1/5] Refine discoverFromExternalSource --- index.html | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 355b9171..bd1b78c7 100644 --- a/index.html +++ b/index.html @@ -734,6 +734,17 @@

[[\DiscoverFromExternalSource]](origin, options, sameOriginWithAncestors) internal method

+

When invoked, the [[\DiscoverFromExternalSource]](origin, options, @@ -756,7 +767,48 @@

  • Let |requests| be |options|'s {{CredentialRequestOptions/digital}}'s {{DigitalCredentialRequestOptions/requests}} member.
  • -
  • If |requests| is empty, [=exception/throw=] a {{TypeError}}. +
  • If |requests| [=list/is empty=], [=exception/throw=] a {{TypeError}}. +
  • +
  • Let |range| be [=list/get the indices|the indices=] of |requests|. +
  • +
  • Let |validatedRequests| be an empty [=list=]. +
  • +
  • [=Set/For each=] |n| of |range|: +
      +
    1. Let |requestRecord| be the [=list/item=] at |requests|'s |n| + index. +
    2. +
    3. Let |protocol| be |requestRecord|'s + {{DigitalCredentialGetRequest/protocol}}. +
    4. +
    5. If |protocol| is not supported by the user agent, + [=exception/throw=] a {{NotSupportedError}} {{DOMException}}. +
    6. +
    7. If the [=registry/link|specification=] corresponding to + |protocol| defines an IDL {{dictionary}} for [=converted to an idl + value|conversion=]: +
        +
      1. Let |converted| be |requestRecord|'s + {{DigitalCredentialGetRequest/data}} [=converted to an idl + value|converted=] to that dictionary. [=exception/throw|Rethrow=] + any exceptions. +
      2. +
      +
    8. +
    9. Otherwise, let |converted| be |requestRecord|'s + {{DigitalCredentialGetRequest/data}}. +
    10. +
    11. Validate |converted| against any validation rules set forth in + the corresponding [=registry/link|specification=]. If any of + |converted|'s members are invalid, [=exception/throw=] a + {{TypeError}}. +
    12. +
    13. Let |validatedRequest| be an internal representation of the + request using |protocol| and |converted|. +
    14. +
    15. Append |validatedRequest| to |validatedRequests|. +
    16. +
  • [=List/For each=] |request| of |requests|:
      From 9dad7f01179d9b1930642f61dfb22e9688b0cb65 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Wed, 30 Jul 2025 10:44:00 +1000 Subject: [PATCH 2/5] fixup --- index.html | 70 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/index.html b/index.html index bd1b78c7..1a9b4c4d 100644 --- a/index.html +++ b/index.html @@ -773,58 +773,55 @@

    1. Let |validatedRequests| be an empty [=list=].
    2. -
    3. [=Set/For each=] |n| of |range|: +
    4. [=List/For each=] |request| of |requests|:
        -
      1. Let |requestRecord| be the [=list/item=] at |requests|'s |n| - index. +
      2. [=serialize a JavaScript value to a JSON string|Serialize=] + |request| to a JSON string. [=exception/throw|Re-throw=] any + [=exception=].
      3. -
      4. Let |protocol| be |requestRecord|'s +
      5. Let |protocol| be |request|'s {{DigitalCredentialGetRequest/protocol}}.
      6. -
      7. If |protocol| is not supported by the user agent, +
      8. If |protocol| is not allowed by the user agent, [=exception/throw=] a {{NotSupportedError}} {{DOMException}}.
      9. If the [=registry/link|specification=] corresponding to - |protocol| defines an IDL {{dictionary}} for [=converted to an idl + |protocol| defines an IDL [=dictionary=] for [=converted to an idl value|conversion=]:
          -
        1. Let |converted| be |requestRecord|'s +
        2. Let |converted| be |request|'s {{DigitalCredentialGetRequest/data}} [=converted to an idl value|converted=] to that dictionary. [=exception/throw|Rethrow=] any exceptions.
      10. -
      11. Otherwise, let |converted| be |requestRecord|'s +
      12. Otherwise, let |data| be |request|'s {{DigitalCredentialGetRequest/data}}.
      13. -
      14. Validate |converted| against any validation rules set forth in - the corresponding [=registry/link|specification=]. If any of - |converted|'s members are invalid, [=exception/throw=] a - {{TypeError}}. +
      15. Validate |data| against any validation rules set forth in the + corresponding [=registry/link|specification=]. If any of |data|'s + members are invalid, [=exception/throw=] a {{TypeError}}.
      16. Let |validatedRequest| be an internal representation of the - request using |protocol| and |converted|. + request using |protocol| and |data|.
      17. Append |validatedRequest| to |validatedRequests|.
    5. -
    6. [=List/For each=] |request| of |requests|: -
        -
      1. [=serialize a JavaScript value to a JSON string|Serialize=] - |request| to a JSON string. [=exception/throw|Re-throw=] any - [=exception=]. -
      2. -
      +
    7. Let |coordinator| be the [=credential request coordinator=] + associated with |document|'s [=top-level traversable=].
    8. -
    9. - +
    10. Let |signal| be |options|'s {{CredentialRequestOptions/signal}}, if + present. +
    11. +
    12. Let |result| be the result of awaiting the [=present credential + request UI=] algorithm, passing |document|, |requests|, and |signal|. +
    13. +
    14. If |result| is an [=exception=], [=exception/throw=] that exception.
    15. -
    16. Return a {{DigitalCredential}}. +
    17. Return |result|.