File tree 3 files changed +14
-7
lines changed
3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -1109,14 +1109,18 @@ This can be called many times with new data as it is streamed.
1109
1109
## Class: KeyObject
1110
1110
<!-- YAML
1111
1111
added: v11.6.0
1112
+ changes:
1113
+ - version: REPLACEME
1114
+ pr-url: https://github.com/nodejs/node/pull/26438
1115
+ description: This class is now exported.
1112
1116
-->
1113
1117
1114
- Node.js uses an internal ` KeyObject ` class which should not be accessed
1115
- directly. Instead, factory functions exist to create instances of this class
1116
- in a secure manner, see [ ` crypto.createSecretKey() ` ] [ ] ,
1117
- [ ` crypto.createPublicKey () ` ] [ ] and [ ` crypto.createPrivateKey() ` ] [ ] . A
1118
- ` KeyObject ` can represent a symmetric or asymmetric key, and each kind of key
1119
- exposes different functions .
1118
+ Node.js uses a ` KeyObject ` class to represent a symmetric or asymmetric key,
1119
+ and each kind of key exposes different functions. The
1120
+ [ ` crypto.createSecretKey() ` ] [ ] , [ ` crypto.createPublicKey() ` ] [ ] and
1121
+ [ ` crypto.createPrivateKey () ` ] [ ] methods are used to create ` KeyObject `
1122
+ instances. ` KeyObject ` objects are not to be created directly using the ` new `
1123
+ keyword .
1120
1124
1121
1125
Most applications should consider using the new ` KeyObject ` API instead of
1122
1126
passing keys as strings or ` Buffer ` s due to improved security features.
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ const {
60
60
const {
61
61
createSecretKey,
62
62
createPublicKey,
63
- createPrivateKey
63
+ createPrivateKey,
64
+ KeyObject,
64
65
} = require ( 'internal/crypto/keys' ) ;
65
66
const {
66
67
DiffieHellman,
@@ -191,6 +192,7 @@ module.exports = exports = {
191
192
ECDH ,
192
193
Hash,
193
194
Hmac,
195
+ KeyObject,
194
196
Sign,
195
197
Verify
196
198
} ;
Original file line number Diff line number Diff line change @@ -333,6 +333,7 @@ module.exports = {
333
333
createSecretKey,
334
334
createPublicKey,
335
335
createPrivateKey,
336
+ KeyObject,
336
337
337
338
// These are designed for internal use only and should not be exposed.
338
339
parsePublicKeyEncoding,
You can’t perform that action at this time.
0 commit comments