Previously, HKDF and PBKDF2 keys went through the HMAC branch and
key.algorithm exposed an empty hash member. These keys have no hash;
their KeyAlgorithm contains only the name.
The issue was introduced in
722e2763 (0.8.0).
case NJS_ALGORITHM_ED25519:
case NJS_ALGORITHM_X25519:
+ case NJS_ALGORITHM_PBKDF2:
+ case NJS_ALGORITHM_HKDF:
break;
case NJS_ALGORITHM_HMAC:
['deriveBits']);
let algorithm = key.algorithm;
- if (algorithm.name !== params.name) {
+ if (Object.keys(algorithm).join() !== 'name'
+ || algorithm.name !== params.name)
+ {
throw Error(`unexpected algorithm: ${JSON.stringify(algorithm)}`);
}