summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2021-08-14 02:50:44 +0530
committerGitHub <noreply@github.com>2021-08-13 23:20:44 +0200
commit71f79097c69958ba94e8600430394bbb21fa90f3 (patch)
tree5b325910b70f3ea832aff736c8c695f1a78e009f /ext/crypto/00_crypto.js
parent0c9d6cbb2adc4a0903b18e3c290e9b2c8c8b4e91 (diff)
fix(ext/crypto): importKey() SecurityError on non-extractable keys (#11662)
Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index b341aabe7..c3107c288 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -491,6 +491,14 @@
throw new DOMException("Invalid key usages", "SyntaxError");
}
+ // https://github.com/denoland/deno/pull/9614#issuecomment-866049433
+ if (!extractable) {
+ throw new DOMException(
+ "Non-extractable keys are not supported",
+ "SecurityError",
+ );
+ }
+
switch (normalizedAlgorithm.name) {
// https://w3c.github.io/webcrypto/#hmac-operations
case "HMAC": {