crypto: runtime deprecate ECDH.setPublicKey() · nodejs/node@6663264 · GitHub
Skip to content

Commit 6663264

Browse files
authored
crypto: runtime deprecate ECDH.setPublicKey()
It's been "pending" deprecation since 6.12.0. I think that's long enough. PR-URL: #58620 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 308b6bc commit 6663264

3 files changed

Lines changed: 34 additions & 4 deletions

File tree

doc/api/deprecations.md

Lines changed: 6 additions & 3 deletions

lib/internal/crypto/diffiehellman.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const {
4646
} = require('internal/util/types');
4747

4848
const {
49+
deprecate,
4950
lazyDOMException,
5051
} = require('internal/util');
5152

@@ -228,7 +229,9 @@ function ECDH(curve) {
228229

229230
ECDH.prototype.computeSecret = DiffieHellman.prototype.computeSecret;
230231
ECDH.prototype.setPrivateKey = DiffieHellman.prototype.setPrivateKey;
231-
ECDH.prototype.setPublicKey = DiffieHellman.prototype.setPublicKey;
232+
ECDH.prototype.setPublicKey = deprecate(DiffieHellman.prototype.setPublicKey,
233+
'ecdh.setPublicKey() is deprecated.',
234+
'DEP0031');
232235
ECDH.prototype.getPrivateKey = DiffieHellman.prototype.getPrivateKey;
233236

234237
ECDH.prototype.generateKeys = function generateKeys(encoding, format) {
Lines changed: 24 additions & 0 deletions

0 commit comments

Comments
 (0)