mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
test,crypto: update WebCryptoAPI WPT
PR-URL: https://github.com/nodejs/node/pull/54925 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
028c586478
commit
3da465a815
2
test/fixtures/wpt/README.md
vendored
2
test/fixtures/wpt/README.md
vendored
@ -32,7 +32,7 @@ Last update:
|
|||||||
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
|
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
|
||||||
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
|
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
|
||||||
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
|
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
|
||||||
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/6748a0a246/WebCryptoAPI
|
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/272064ebf9/WebCryptoAPI
|
||||||
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions
|
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions
|
||||||
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/e97fac4791/webmessaging/broadcastchannel
|
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/e97fac4791/webmessaging/broadcastchannel
|
||||||
- webstorage: https://github.com/web-platform-tests/wpt/tree/9dafa89214/webstorage
|
- webstorage: https://github.com/web-platform-tests/wpt/tree/9dafa89214/webstorage
|
||||||
|
@ -5,7 +5,8 @@ function run_test(algorithmNames, slowTest) {
|
|||||||
setup({explicit_timeout: true});
|
setup({explicit_timeout: true});
|
||||||
|
|
||||||
// These tests check that generateKey successfully creates keys
|
// These tests check that generateKey successfully creates keys
|
||||||
// when provided any of a wide set of correct parameters.
|
// when provided any of a wide set of correct parameters
|
||||||
|
// and that they can be exported afterwards.
|
||||||
//
|
//
|
||||||
// There are a lot of combinations of possible parameters,
|
// There are a lot of combinations of possible parameters,
|
||||||
// resulting in a very large number of tests
|
// resulting in a very large number of tests
|
||||||
@ -68,9 +69,32 @@ function run_test(algorithmNames, slowTest) {
|
|||||||
} else {
|
} else {
|
||||||
assert_goodCryptoKey(result, algorithm, extractable, usages, "secret");
|
assert_goodCryptoKey(result, algorithm, extractable, usages, "secret");
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
assert_unreached("Threw an unexpected error: " + err.toString());
|
assert_unreached("generateKey threw an unexpected error: " + err.toString());
|
||||||
});
|
})
|
||||||
|
.then(async function (result) {
|
||||||
|
if (resultType === "CryptoKeyPair") {
|
||||||
|
await Promise.all([
|
||||||
|
subtle.exportKey('jwk', result.publicKey),
|
||||||
|
subtle.exportKey('spki', result.publicKey),
|
||||||
|
result.publicKey.algorithm.name.startsWith('RSA') ? undefined : subtle.exportKey('raw', result.publicKey),
|
||||||
|
...(extractable ? [
|
||||||
|
subtle.exportKey('jwk', result.privateKey),
|
||||||
|
subtle.exportKey('pkcs8', result.privateKey),
|
||||||
|
] : [])
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
if (extractable) {
|
||||||
|
await Promise.all([
|
||||||
|
subtle.exportKey('raw', result),
|
||||||
|
subtle.exportKey('jwk', result),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, function(err) {
|
||||||
|
assert_unreached("exportKey threw an unexpected error: " + err.toString());
|
||||||
|
})
|
||||||
}, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
|
}, testTag + ": generateKey" + parameterString(algorithm, extractable, usages));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
test/fixtures/wpt/versions.json
vendored
2
test/fixtures/wpt/versions.json
vendored
@ -88,7 +88,7 @@
|
|||||||
"path": "wasm/webapi"
|
"path": "wasm/webapi"
|
||||||
},
|
},
|
||||||
"WebCryptoAPI": {
|
"WebCryptoAPI": {
|
||||||
"commit": "6748a0a24614b01ce6527493a19ef846738bee3a",
|
"commit": "272064ebf9a3d313a2d4db8bb9ce2790648aa162",
|
||||||
"path": "WebCryptoAPI"
|
"path": "WebCryptoAPI"
|
||||||
},
|
},
|
||||||
"webidl/ecmascript-binding/es-exceptions": {
|
"webidl/ecmascript-binding/es-exceptions": {
|
||||||
|
Loading…
Reference in New Issue
Block a user