Skip to content

Commit a362bfa

Browse files
panvazebreus
authored andcommitted
feat(ext/crypto): make deriveBits length parameter optional and nullable (denoland#24426)
Updates SubtleCrypto.prototype.deriveBits as per w3c/webcrypto#345 (WPT update in web-platform-tests/wpt#43400)
1 parent a3dbff8 commit a362bfa

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ext/crypto/00_crypto.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1131,10 +1131,10 @@ class SubtleCrypto {
11311131
* @param {number | null} length
11321132
* @returns {Promise<ArrayBuffer>}
11331133
*/
1134-
async deriveBits(algorithm, baseKey, length) {
1134+
async deriveBits(algorithm, baseKey, length = null) {
11351135
webidl.assertBranded(this, SubtleCryptoPrototype);
11361136
const prefix = "Failed to execute 'deriveBits' on 'SubtleCrypto'";
1137-
webidl.requiredArguments(arguments.length, 3, prefix);
1137+
webidl.requiredArguments(arguments.length, 2, prefix);
11381138
algorithm = webidl.converters.AlgorithmIdentifier(
11391139
algorithm,
11401140
prefix,

tests/wpt/runner/expectation.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,12 @@
909909
"historical.any.html": false,
910910
"historical.any.worker.html": false,
911911
"idlharness.https.any.html": [
912-
"Window interface: attribute crypto"
912+
"Window interface: attribute crypto",
913+
"SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)"
913914
],
914915
"idlharness.https.any.worker.html": [
915-
"WorkerGlobalScope interface: attribute crypto"
916+
"WorkerGlobalScope interface: attribute crypto",
917+
"SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)"
916918
],
917919
"import_export": {
918920
"ec_importKey.https.any.html": [

0 commit comments

Comments
 (0)