summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 8203a5307..ed179a313 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -664,8 +664,13 @@
);
}
- // 3. We only support 96-bit nonce for now.
- if (normalizedAlgorithm.iv.byteLength !== 12) {
+ // 3. We only support 96-bit and 128-bit nonce.
+ if (
+ ArrayPrototypeIncludes(
+ [12, 16],
+ normalizedAlgorithm.iv.byteLength,
+ ) === undefined
+ ) {
throw new DOMException(
"Initialization vector length not supported",
"NotSupportedError",
@@ -3782,8 +3787,13 @@
}
// 2.
- // We only support 96-bit nonce for now.
- if (normalizedAlgorithm.iv.byteLength !== 12) {
+ // We only support 96-bit and 128-bit nonce.
+ if (
+ ArrayPrototypeIncludes(
+ [12, 16],
+ normalizedAlgorithm.iv.byteLength,
+ ) === undefined
+ ) {
throw new DOMException(
"Initialization vector length not supported",
"NotSupportedError",