From f520d198e54ca4edc477cc67263c9799be693007 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Tue, 16 Dec 2025 21:24:15 +1100 Subject: [PATCH 1/3] Define "prepare credential requests" algorithm --- index.html | 172 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 162 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index af9beadb..e8253953 100644 --- a/index.html +++ b/index.html @@ -762,24 +762,175 @@

To prepare credential requests given a [=Document=] |document:Document|, a sequence of {{DigitalCredentialGetRequest}} or {{DigitalCredentialCreateRequest}} - |requests|, a {{Promise}} |promise:Promise|, and an optional + objects |requests|, a {{Promise}} |promise:Promise|, and an optional {{AbortSignal}} |signal:AbortSignal|:

-
    -
  1. - +
      +
    1. Let |global| be |document|'s [=relevant global object=]. +
    2. +
    3. If the [=credential request coordinator=] is not in the "[=credential + request coordinator/idle=]" [=credential request coordinator/interaction + state=]: +
        +
      1. [=Queue a global task=] on the [=DOM manipulation task source=] + given |global| to [=reject=] |promise| with an + {{"InvalidStateError"}} {{DOMException}}. +
      2. +
      3. Return. +
      4. +
      +
    4. +
    5. Assert: the [=credential request coordinator=]'s [=credential request + coordinator/active promise=] is `null`. +
    6. +
    7. Set the [=credential request coordinator=]'s [=credential request + coordinator/active promise=] to |promise|. +
    8. +
    9. If |signal| was passed: +
        +
      1. Set the [=credential request coordinator=]'s [=credential request + coordinator/abort signal=] to |signal|. +
      2. +
      3. Let |abortAlgorithm| be the following algorithm: +
          +
        1. If the [=credential request coordinator=]'s [=credential + request coordinator/active promise=] is not |promise|, return. +
        2. +
        3. [=credential request coordinator/Abort the credential + request=] |signal|'s [=AbortSignal/abort reason=]. +
        4. +
        +
      4. +
      5. Set the [=credential request coordinator=]'s [=credential request + coordinator/abort algorithm=] to |abortAlgorithm|. +
      6. +
      7. [=AbortSignal/Add=] |abortAlgorithm| to |signal|. +
      8. +
      +
    10. +
    11. Let |validatedRequests| be a new empty [=list=]. +
    12. +
    13. [=List/For each=] |request| of |requests|: +
        +
      1. Let |protocol| be |request|'s + {{DigitalCredentialGetRequest/protocol}}, if |request| is a + {{DigitalCredentialGetRequest}}, or |request|'s + {{DigitalCredentialCreateRequest/protocol}}, if |request| is a + {{DigitalCredentialCreateRequest}}. +
      2. +
      3. If |protocol| does not equal any [=enumeration value=] in + {{DigitalCredentialProtocol}}, [=iteration/continue=]. +
      4. +
      5. If the [=user agent=] does not allow |protocol|, + [=iteration/continue=]. +
      6. +
      7. Let |validatedRequest| be the result of validating |request|'s + [=digital credential/request data=] according to |request|'s + [=digital credential/presentation protocol=] or other criteria. + Validation requirements are protocol-specific and are outside the + scope of this specification. + +
      8. +
      9. If |validatedRequest| is an [=exception=]: +
          +
        1. [=credential request coordinator/Complete credential request + with=] |promise| and |validatedRequest|. +
        2. +
        3. Return. +
        4. +
        +
      10. +
      11. [=list/Append=] |validatedRequest| to |validatedRequests|. +
      12. +
      +
    14. +
    15. If |validatedRequests| [=list/is empty=]: +
        +
      1. [=credential request coordinator/Complete credential request + with=] |promise| and a newly created {{TypeError}}. +
      2. +
      3. Return. +
      4. +
      +
    16. +
    17. If |signal| was passed and |signal| is [=AbortSignal/aborted=]: +
        +
      1. Let |error| be |signal|'s [=AbortSignal/abort reason=]. +
      2. +
      3. [=credential request coordinator/Complete credential request + with=] |promise| and |error|. +
      4. +
      5. Return. +
      6. +
      +
    18. +
    19. Set the [=credential request coordinator=] [=credential request + coordinator/interaction state=] to "[=credential request + coordinator/requesting=]". +
    20. +
    21. [=credential request coordinator/Present the credential request=] + with |document|, |validatedRequests|, and |signal|. +
    22. +
    23. If |document| stops being [=Document/fully active=], [=credential + request coordinator/Abort the credential request=] an {{"AbortError"}} + {{DOMException}}.

    Abort the credential request

    - To be written. + To abort the + credential request given a [=Document=] |document:Document| and a + JavaScript value |error|:

    +
      +
    1. If the [=credential request coordinator=]'s [=credential request + coordinator/active promise=] is `null`, return. +
    2. +
    3. Let |activePromise| be the [=credential request coordinator=]'s + [=credential request coordinator/active promise=]. +
    4. +
    5. If the [=credential request coordinator=] is in the "[=credential + request coordinator/requesting=]" [=credential request + coordinator/interaction state=]: +
        +
      1. Set the [=credential request coordinator=] [=credential request + coordinator/interaction state=] to "[=credential request + coordinator/aborting=]". +
      2. +
      3. Dismiss the [=credential chooser=] and await confirmation of + dismissal. +
      4. +
      +
    6. +
    7. [=credential request coordinator/Complete credential request with=] + |activePromise| and |error|. +
    8. +

    Complete credential request with error

    @@ -833,7 +984,8 @@

    Present the credential request

    - To be written. + Present the credential + request to be written.

    From fca972dde662a8c296edea17736da3863eb5317b Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 23 Feb 2026 15:53:59 +1100 Subject: [PATCH 2/3] Remove abort algo. Moved --- index.html | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index e8253953..13cdb168 100644 --- a/index.html +++ b/index.html @@ -894,10 +894,6 @@

  2. [=credential request coordinator/Present the credential request=] with |document|, |validatedRequests|, and |signal|.
  3. -
  4. If |document| stops being [=Document/fully active=], [=credential - request coordinator/Abort the credential request=] an {{"AbortError"}} - {{DOMException}}. -

Abort the credential request @@ -908,27 +904,12 @@

JavaScript value |error|:

    -
  1. If the [=credential request coordinator=]'s [=credential request - coordinator/active promise=] is `null`, return. -
  2. -
  3. Let |activePromise| be the [=credential request coordinator=]'s - [=credential request coordinator/active promise=]. -
  4. -
  5. If the [=credential request coordinator=] is in the "[=credential - request coordinator/requesting=]" [=credential request - coordinator/interaction state=]: -
      -
    1. Set the [=credential request coordinator=] [=credential request - coordinator/interaction state=] to "[=credential request - coordinator/aborting=]". -
    2. -
    3. Dismiss the [=credential chooser=] and await confirmation of - dismissal. -
    4. -
    -
  6. -
  7. [=credential request coordinator/Complete credential request with=] - |activePromise| and |error|. +
  8. +

From bba0a19e43957165eb29c22f4dffd9ec41969cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20C=C3=A1ceres?= Date: Thu, 26 Feb 2026 18:34:00 +1100 Subject: [PATCH 3/3] Apply suggestion from @marcoscaceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 13cdb168..ea31d8c7 100644 --- a/index.html +++ b/index.html @@ -774,7 +774,7 @@

  1. [=Queue a global task=] on the [=DOM manipulation task source=] given |global| to [=reject=] |promise| with an - {{"InvalidStateError"}} {{DOMException}}. + {{"NotAllowedError"}} {{DOMException}}.
  2. Return.