Web Crypto API test and key import issues

Version

v20.1.0

Platform

No response

Subsystem

crypto.webcrypto

What steps will reproduce the bug?

No response

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

No response

What do you see instead?

While looking at Node's crypto API, I found some potential issues in the Web Crypto tests:

  • return testWrapping(name, keys);
    In the Wrap-Unwrap tests, the mapping returns the tests instead of adding them to the variations list, this causes the tests in this file to not actually run.
  • Here we import a private EdDsa key with empty usages. Based on the Web Crypto spec this is not allowed, when importing a private key the usages must not be empty. This also indicates a bug in the implementation as the test cases require non-conforming behavior. Based on a brief search of the code, the test-webcrypto-sign-verify-ecdsa.js and test-webcrypto-sign-verify-rsa.js tests may also be affected.
  • Less important, but this should be privateUsages.

@jasnell

Additional information

No response