Skip to content

[Web API type definition issue] crypto.subtle.importKey does not support jwk as a key format #2252

@Ethan-Dankiw

Description

@Ethan-Dankiw

Summary

crypto.subtle.importKey does not support jwk as a key format

Expected vs. Actual Behavior

This is the current specification for the usage of the browser crypto import key format.
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey
https://w3c.github.io/webcrypto/#SubtleCrypto-method-importKey

According to the rule TS2769, crypto.subtle.importKey does not support the key format of "jwk" despite it being explicitly allowed as a format in the MDN provided in the above link.

I would expect this to be an error as the behavior I experienced differs from what is described in the developer docs.

Usage of the code causing the error
Image

Described error in my IDE at the format line variable inside the importKey function call
Image

Playground Link

Not 100% sure how useful this will be

Typescript Lang Playground

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

Currently using typescript version 5.9.3

Terminal Output

❯ tsc --version
Version 5.9.3

Currently using @types/web version 0.0.294

❯ pnpm list @types/web
Legend: production dependency, optional only, dev only

<omitted>

devDependencies:
@types/web 0.0.294

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions