Skip to content

Commit

Permalink
feat(ext/crypto): make deriveBits length parameter optional and nulla…
Browse files Browse the repository at this point in the history
…ble (#24426)

Updates SubtleCrypto.prototype.deriveBits as per
w3c/webcrypto#345

(WPT update in web-platform-tests/wpt#43400)
  • Loading branch information
panva committed Jul 4, 2024
1 parent 147411e commit f632b4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ext/crypto/00_crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -1131,10 1131,10 @@ class SubtleCrypto {
* @param {number | null} length
* @returns {Promise<ArrayBuffer>}
*/
async deriveBits(algorithm, baseKey, length) {
async deriveBits(algorithm, baseKey, length = null) {
webidl.assertBranded(this, SubtleCryptoPrototype);
const prefix = "Failed to execute 'deriveBits' on 'SubtleCrypto'";
webidl.requiredArguments(arguments.length, 3, prefix);
webidl.requiredArguments(arguments.length, 2, prefix);
algorithm = webidl.converters.AlgorithmIdentifier(
algorithm,
prefix,
Expand Down
6 changes: 4 additions & 2 deletions tests/wpt/runner/expectation.json
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 909,12 @@
"historical.any.html": false,
"historical.any.worker.html": false,
"idlharness.https.any.html": [
"Window interface: attribute crypto"
"Window interface: attribute crypto",
"SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)"
],
"idlharness.https.any.worker.html": [
"WorkerGlobalScope interface: attribute crypto"
"WorkerGlobalScope interface: attribute crypto",
"SubtleCrypto interface: operation deriveBits(AlgorithmIdentifier, CryptoKey, unsigned long)"
],
"import_export": {
"ec_importKey.https.any.html": [
Expand Down

0 comments on commit f632b4a

Please sign in to comment.