From: Dmitry Volyntsev Date: Tue, 17 Nov 2026 02:31:16 +0000 (-0800) Subject: WebCrypto: reject unsupported generateKey() algorithms in njs X-Git-Url: https://git.kaiwu.me/%7Bsubstring-before(@doc,%20'.xml')%7D.html?a=commitdiff_plain;h=6d5b60580333ec0a12fd6b088be695e7a088ea9c;p=njs.git WebCrypto: reject unsupported generateKey() algorithms in njs Previously, generateKey() with an algorithm that has no key generation, such as HKDF, threw InternalError synchronously instead of returning a rejected Promise, unlike every other generateKey() error. Route the error through the common result path, as required by Web Cryptography API section 14.3.6. The issue was introduced in 50e7c9b2 (0.7.10). --- diff --git a/external/njs_webcrypto_module.c b/external/njs_webcrypto_module.c index 8d3fc5ee..8f3e1c13 100644 --- a/external/njs_webcrypto_module.c +++ b/external/njs_webcrypto_module.c @@ -3218,7 +3218,7 @@ njs_ext_generate_key(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs, default: njs_vm_internal_error(vm, "not implemented generateKey" "algorithm: \"%V\"", njs_algorithm_string(alg)); - return NJS_ERROR; + goto fail; } return njs_webcrypto_result(vm, &value, NJS_OK, retval);