Skip to content
Prev Previous commit
Next Next commit
extractable and algorithm this
  • Loading branch information
panva committed Nov 22, 2022
commit 969d71b648989b56067d0354784ff1b26c8358cb
5 changes: 5 additions & 0 deletions lib/internal/crypto/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const {
ERR_ILLEGAL_CONSTRUCTOR,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_THIS,
}
} = require('internal/errors');

Expand Down Expand Up @@ -661,10 +662,14 @@ class CryptoKey extends JSTransferable {
}

get extractable() {
if (!(this instanceof CryptoKey))
throw new ERR_INVALID_THIS('CryptoKey');
return this[kExtractable];
}

get algorithm() {
if (!(this instanceof CryptoKey))
throw new ERR_INVALID_THIS('CryptoKey');
return this[kAlgorithm];
}

Expand Down
2 changes: 0 additions & 2 deletions test/wpt/status/WebCryptoAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
"Crypto interface: calling getRandomValues(ArrayBufferView) on crypto with too few arguments must throw TypeError",
"CryptoKey interface: existence and properties of interface object",
"CryptoKey interface: existence and properties of interface prototype object",
"CryptoKey interface: attribute extractable",
"CryptoKey interface: attribute algorithm",
"Window interface: attribute crypto"
]
}
Expand Down