We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7f6172b commit 391d2f8Copy full SHA for 391d2f8
lib/internal/crypto/diffiehellman.js
@@ -219,21 +219,15 @@ function encode(buffer, encoding) {
219
}
220
221
function getFormat(format) {
222
- let f;
223
if (format) {
224
if (format === 'compressed')
225
- f = POINT_CONVERSION_COMPRESSED;
226
- else if (format === 'hybrid')
227
- f = POINT_CONVERSION_HYBRID;
228
- // Default
229
- else if (format === 'uncompressed')
230
- f = POINT_CONVERSION_UNCOMPRESSED;
231
- else
+ return POINT_CONVERSION_COMPRESSED;
+ if (format === 'hybrid')
+ return POINT_CONVERSION_HYBRID;
+ if (format !== 'uncompressed')
232
throw new ERR_CRYPTO_ECDH_INVALID_FORMAT(format);
233
- } else {
234
235
236
- return f;
+ return POINT_CONVERSION_UNCOMPRESSED;
237
238
239
module.exports = {
0 commit comments