Ambiguity of the Web Crypto API Doc
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":
- If the keyData parameter passed to the
importKey()method is not aJsonWebKeydictionary,throwa**TypeError**.
However, under the RSASSA-PKCS1-v1_5 algorithm section of importKey() method:
If format is "jwk":
- If keyData is a
JsonWebKeydictionary:
Let jwk equal keyData. - Otherwise:
Throwa**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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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