Skip to content

Commit 95fc883

Browse files
committed
fixup! crypto: add keyObject.asymmetricKeyDetails for asymmetric keys
1 parent 2efd015 commit 95fc883

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

doc/api/crypto.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -1290,21 +1290,16 @@ added: REPLACEME
12901290
-->
12911291

12921292
* {Object}
1293+
* `modulusLength`: {number} Key size in bits (RSA, DSA).
1294+
* `publicExponent`: {number} Public exponent (RSA).
1295+
* `divisorLength`: {number} Size of `q` in bits (DSA).
1296+
* `namedCurve`: {string} Name of the curve (EC).
12931297

12941298
This property exists only on asymmetric keys. Depending on the type of the key,
12951299
this object contains information about the key. None of the information obtained
12961300
through this property can be used to uniquely identify a key or to compromise
12971301
the security of the key.
12981302

1299-
For `'rsa'` and `'rsa-pss'` keys, this object has the properties `modulusLength`
1300-
and `publicExponent`.
1301-
1302-
For `'dsa'` keys, this object has the properties `modulusLength` and
1303-
`divisorLength`.
1304-
1305-
For `'ec'` keys with a known curve, this object has the string property
1306-
`namedCurve`.
1307-
13081303
### `keyObject.asymmetricKeyType`
13091304
<!-- YAML
13101305
added: v11.6.0

lib/internal/crypto/keys.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,8 @@ const [
132132
const kAsymmetricKeyType = Symbol('kAsymmetricKeyType');
133133
const kAsymmetricKeyDetails = Symbol('kAsymmetricKeyDetails');
134134

135-
// TODO: should the returne details object be frozen or otherwise protected
136-
// from manipulation?
137135
function normalizeKeyDetails(details = {}) {
138-
if ('publicExponent' in details) {
136+
if (details.publicExponent !== undefined) {
139137
return {
140138
...details,
141139
publicExponent:

0 commit comments

Comments
 (0)