Skip to content

Commit

Permalink
Default to ES256 and RS256 if pubKeyCredParams is empty (#1387)
Browse files Browse the repository at this point in the history
Default to algorithm -7 ("ES256") and -257 ("RS256") when
options.pubKeyCredParams is empty.

Fixes issue 1383.
  • Loading branch information
nsatragno committed Mar 25, 2020
1 parent a0249af commit a636817
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,16 +1490,25 @@ a numbered step. If outdented, it (today) is rendered as a bullet in the midst o
1. Let |credTypesAndPubKeyAlgs| be a new [=list=] whose [=list/items=] are pairs of {{PublicKeyCredentialType}} and
a {{COSEAlgorithmIdentifier}}.

1. [=list/For each=] |current| of <code>|options|.{{PublicKeyCredentialCreationOptions/pubKeyCredParams}}</code>:

1. If <code>|current|.{{PublicKeyCredentialParameters/type}}</code> does not contain a {{PublicKeyCredentialType}} supported
by this implementation, then [=continue=].
1. Let |alg| be <code>|current|.{{PublicKeyCredentialParameters/alg}}</code>.
1. [=list/Append=] the pair of <code>|current|.{{PublicKeyCredentialParameters/type}}</code> and |alg| to
|credTypesAndPubKeyAlgs|.

1. If |credTypesAndPubKeyAlgs| [=list/is empty=] and <code>|options|.{{PublicKeyCredentialCreationOptions/pubKeyCredParams}}</code>
[=list/is not empty=], return a {{DOMException}} whose name is "{{NotSupportedError}}", and terminate this algorithm.
1. If <code>|options|.{{PublicKeyCredentialCreationOptions/pubKeyCredParams}}</code>'s [=list/size=]
<dl class="switch">
: is zero
:: [=list/Append=] the following pairs of {{PublicKeyCredentialType}} and {{COSEAlgorithmIdentifier}} values to |credTypesAndPubKeyAlgs|:
* {{public-key}} and <code>-7</code> ("ES256").
* {{public-key}} and <code>-257</code> ("RS256").

: is non-zero
:: [=list/For each=] |current| of <code>|options|.{{PublicKeyCredentialCreationOptions/pubKeyCredParams}}</code>:

1. If <code>|current|.{{PublicKeyCredentialParameters/type}}</code> does not contain a {{PublicKeyCredentialType}} supported
by this implementation, then [=continue=].
1. Let |alg| be <code>|current|.{{PublicKeyCredentialParameters/alg}}</code>.
1. [=list/Append=] the pair of <code>|current|.{{PublicKeyCredentialParameters/type}}</code> and |alg| to
|credTypesAndPubKeyAlgs|.

If |credTypesAndPubKeyAlgs| [=list/is empty=], return a {{DOMException}} whose name is
"{{NotSupportedError}}", and terminate this algorithm.
</dl>

1. Let |clientExtensions| be a new [=map=] and let |authenticatorExtensions| be a new [=map=].

Expand Down

0 comments on commit a636817

Please sign in to comment.