Skip to content

CryptoKey global already practiced but not defined. #296

Closed
@panva

Description

@panva

Every single browser implementation attaches the CryptoKey constructor to window or worker global scope. This is very useful for defensive programming when building libraries / code around web crypto, e.g. to fail early on invalid user input (when key is not an instanceof CryptoKey and wanting to offer a useful and consistent error message (unlike the implementation specific ones that often come with no information whatsoever).

I think https://w3c.github.io/webcrypto/#crypto-interface should get updated to reflect what's already the practice today and add CryptoKey alongside of the readonly crypto to WindowOrWorkerGlobalScope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions