crypto: runtime deprecate ECDH.setPublicKey()
It's been "pending" deprecation since 6.12.0. I think that's long enough. PR-URL: https://github.com/nodejs/node/pull/58620 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
parent
308b6bc6de
commit
66632648ba
@ -718,6 +718,9 @@ The `SlowBuffer` class has been removed. Please use
|
||||
|
||||
<!-- YAML
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/58620
|
||||
description: Runtime deprecation.
|
||||
- version: v6.12.0
|
||||
pr-url: https://github.com/nodejs/node/pull/10116
|
||||
description: A deprecation code has been assigned.
|
||||
@ -726,10 +729,10 @@ changes:
|
||||
description: Documentation-only deprecation.
|
||||
-->
|
||||
|
||||
Type: Documentation-only
|
||||
Type: Runtime
|
||||
|
||||
The [`ecdh.setPublicKey()`][] method is now deprecated as its inclusion in the
|
||||
API is not useful.
|
||||
The [`ecdh.setPublicKey()`][] method is now deprecated as its inclusion in
|
||||
the API is not useful.
|
||||
|
||||
### DEP0032: `node:domain` module
|
||||
|
||||
|
@ -46,6 +46,7 @@ const {
|
||||
} = require('internal/util/types');
|
||||
|
||||
const {
|
||||
deprecate,
|
||||
lazyDOMException,
|
||||
} = require('internal/util');
|
||||
|
||||
@ -228,7 +229,9 @@ function ECDH(curve) {
|
||||
|
||||
ECDH.prototype.computeSecret = DiffieHellman.prototype.computeSecret;
|
||||
ECDH.prototype.setPrivateKey = DiffieHellman.prototype.setPrivateKey;
|
||||
ECDH.prototype.setPublicKey = DiffieHellman.prototype.setPublicKey;
|
||||
ECDH.prototype.setPublicKey = deprecate(DiffieHellman.prototype.setPublicKey,
|
||||
'ecdh.setPublicKey() is deprecated.',
|
||||
'DEP0031');
|
||||
ECDH.prototype.getPrivateKey = DiffieHellman.prototype.getPrivateKey;
|
||||
|
||||
ECDH.prototype.generateKeys = function generateKeys(encoding, format) {
|
||||
|
24
test/parallel/test-crypto-ecdh-setpublickey-deprecation.js
Normal file
24
test/parallel/test-crypto-ecdh-setpublickey-deprecation.js
Normal file
@ -0,0 +1,24 @@
|
||||
// Flags: --no-warnings
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
if (!common.hasCrypto) {
|
||||
common.skip('missing crypto');
|
||||
}
|
||||
|
||||
const crypto = require('crypto');
|
||||
|
||||
common.expectWarning(
|
||||
'DeprecationWarning',
|
||||
'ecdh.setPublicKey() is deprecated.', 'DEP0031');
|
||||
|
||||
const ec = crypto.createECDH('secp256k1');
|
||||
try {
|
||||
// This will throw but we don't care about the error,
|
||||
// we just want to verify that the deprecation warning
|
||||
// is emitted.
|
||||
ec.setPublicKey(Buffer.from([123]));
|
||||
} catch {
|
||||
// Intentionally ignore the error
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user