File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -718,6 +718,9 @@ The `SlowBuffer` class has been removed. Please use
718
718
719
719
<!-- YAML
720
720
changes:
721
+ - version: REPLACEME
722
+ pr-url: https://github.com/nodejs/node/pull/58620
723
+ description: Runtime deprecation.
721
724
- version: v6.12.0
722
725
pr-url: https://github.com/nodejs/node/pull/10116
723
726
description: A deprecation code has been assigned.
@@ -726,10 +729,10 @@ changes:
726
729
description: Documentation-only deprecation.
727
730
-->
728
731
729
- Type: Documentation-only
732
+ Type: Runtime
730
733
731
- The [ ` ecdh.setPublicKey() ` ] [ ] method is now deprecated as its inclusion in the
732
- API is not useful.
734
+ The [ ` ecdh.setPublicKey() ` ] [ ] method is now deprecated as its inclusion in
735
+ the API is not useful.
733
736
734
737
### DEP0032: ` node:domain ` module
735
738
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ const {
46
46
} = require ( 'internal/util/types' ) ;
47
47
48
48
const {
49
+ deprecate,
49
50
lazyDOMException,
50
51
} = require ( 'internal/util' ) ;
51
52
@@ -228,7 +229,9 @@ function ECDH(curve) {
228
229
229
230
ECDH . prototype . computeSecret = DiffieHellman . prototype . computeSecret ;
230
231
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' ) ;
232
235
ECDH . prototype . getPrivateKey = DiffieHellman . prototype . getPrivateKey ;
233
236
234
237
ECDH . prototype . generateKeys = function generateKeys ( encoding , format ) {
Original file line number Diff line number Diff line change
1
+ // Flags: --no-warnings
2
+ 'use strict' ;
3
+
4
+ const common = require ( '../common' ) ;
5
+
6
+ if ( ! common . hasCrypto ) {
7
+ common . skip ( 'missing crypto' ) ;
8
+ }
9
+
10
+ const crypto = require ( 'crypto' ) ;
11
+
12
+ common . expectWarning (
13
+ 'DeprecationWarning' ,
14
+ 'ecdh.setPublicKey() is deprecated.' , 'DEP0031' ) ;
15
+
16
+ const ec = crypto . createECDH ( 'secp256k1' ) ;
17
+ try {
18
+ // This will throw but we don't care about the error,
19
+ // we just want to verify that the deprecation warning
20
+ // is emitted.
21
+ ec . setPublicKey ( Buffer . from ( [ 123 ] ) ) ;
22
+ } catch {
23
+ // Intentionally ignore the error
24
+ }
You can’t perform that action at this time.
0 commit comments