Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,9 @@ The `SlowBuffer` class has been removed. Please use

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/00000
Comment thread
jasnell marked this conversation as resolved.
Outdated
description: Runtime deprecation.
- version: v6.12.0
pr-url: https://github.com/nodejs/node/pull/10116
description: A deprecation code has been assigned.
Expand All @@ -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

Expand Down
5 changes: 4 additions & 1 deletion lib/internal/crypto/diffiehellman.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const {
} = require('internal/util/types');

const {
deprecate,
lazyDOMException,
} = require('internal/util');

Expand Down Expand Up @@ -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) {
Expand Down
24 changes: 24 additions & 0 deletions test/parallel/test-crypto-ecdh-setpublickey-deprecation.js
Original file line number Diff line number Diff line change
@@ -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 emitter.
Comment thread
jasnell marked this conversation as resolved.
Outdated
ec.setPublicKey(Buffer.from([123]));
} catch {
// Intentionally ignore the error
}
Loading