Description:
In the pemToPrivateKey function, the variable name "cert" is used to store the result of derToPrivateKey(block.Bytes). This naming is confusing because:
- The variable doesn't actually contain a certificate.
- The function is meant to return a private key, not a certificate.
Proposed change:
Rename the "cert" variable to "privateKey" or "key" to accurately reflect its contents.
|
cert, err := derToPrivateKey(block.Bytes) |
|
cert, err := derToPublicKey(block.Bytes) |
Current code:
cert, err := derToPrivateKey(block.Bytes)
if err != nil {
return nil, err
}
return cert, err
Suggested code:
key, err := derToPrivateKey(block.Bytes)
if err != nil {
return nil, err
}
return key, err
Impact:
This change does not affect the functionality of the code. It's purely a readability improvement that will enhance developer experience and reduce potential confusion when maintaining or reviewing this code.
Description:
In the
pemToPrivateKeyfunction, the variable name "cert" is used to store the result ofderToPrivateKey(block.Bytes). This naming is confusing because:Proposed change:
Rename the "cert" variable to "privateKey" or "key" to accurately reflect its contents.
fabric-lib-go/bccsp/sw/keys.go
Line 261 in 25edd1e
fabric-lib-go/bccsp/sw/keys.go
Line 453 in 25edd1e
Current code:
Suggested code:
Impact:
This change does not affect the functionality of the code. It's purely a readability improvement that will enhance developer experience and reduce potential confusion when maintaining or reviewing this code.