-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
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.
fabric-lib-go/bccsp/sw/keys.go
Line 261 in 25edd1e
cert, err := derToPrivateKey(block.Bytes) fabric-lib-go/bccsp/sw/keys.go
Line 453 in 25edd1e
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.
Metadata
Metadata
Assignees
Labels
No labels