w3c / w3c/webcrypto

Ambiguity of the Web Crypto API Doc

Open
#310 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
294
Forks
78
PR merge metrics
No merged PRs in 30d

Description

Hi! I was reading the web crypto API spec and I found an unmatched implementation.

Under the importKey() method spec:
Point 2. If format is equal to the string "jwk":

  1. If the keyData parameter passed to the importKey() method is not a JsonWebKey dictionary, throw a **TypeError**.

However, under the RSASSA-PKCS1-v1_5 algorithm section of importKey() method:
If format is "jwk":

  • If keyData is a JsonWebKey dictionary:
    Let jwk equal keyData.
  • Otherwise:
    Throw a **DataError**.

So if the format is "jwk" and keyData is not a JsonWebKey, the general importKey() spec throws a TypeError, but the algorithm-specific spec throws a DataError. It seems like the doc has some inconsistencies in the API Doc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked Web Crypto specification sections for SubtleCrypto.importKey() and the RSASSA-PKCS1-v1_5 importKey operation. Compare the stated exceptions for a non-JsonWebKey dictionary and check the surrounding algorithm-specific rules. Done means the specification consistently defines which exception applies, with the relevant wording updated or the discrepancy resolved.

Written by the indexing model from the issue text.

Assessment

Domain
api, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.