crypto: runtime deprecate Hash constructor

PR-URL: https://github.com/nodejs/node/pull/51880
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Marco Ippolito authored and GitHub committed 2024-03-12 07:58:03 +00:00
1 parent 0b4cdb4b42
commit de0602d190
3 files changed
+15 -2

No files matched your search

+4 -1
View File
@@ -3563,12 +3563,15 @@ release lines. Please use [`dirent.parentPath`][] instead.
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/51880
description: Runtime deprecation.
- version: v21.5.0
pr-url: https://github.com/nodejs/node/pull/51077
description: Documentation-only deprecation.
-->
Type: Documentation-only
Type: Runtime
Calling `Hash` class directly with `Hash()` or `new Hash()` is
deprecated due to being internals, not intended for public use.
+1 -1
View File
@@ -231,7 +231,7 @@ module.exports = {
DiffieHellman,
DiffieHellmanGroup,
ECDH,
Hash,
Hash: deprecate(Hash, 'crypto.Hash constructor is deprecated.', 'DEP0179'),
Hmac,
KeyObject,
Sign,
+10
View File
@@ -276,3 +276,13 @@ assert.throws(
assert.strictEqual(a.digest('hex'), b.digest('hex'));
assert.strictEqual(c.digest('hex'), d.digest('hex'));
}
{
crypto.Hash('sha256');
common.expectWarning({
DeprecationWarning: [
['crypto.Hash constructor is deprecated.',
'DEP0179'],
]
});
}