Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "cert" variable to improve code clarity in pemToPrivateKey function #34

Open
y12studio opened this issue Jul 11, 2024 · 0 comments

Comments

@y12studio
Copy link

y12studio commented Jul 11, 2024

Description:

In the pemToPrivateKey function, the variable name "cert" is used to store the result of derToPrivateKey(block.Bytes). This naming is confusing because:

  1. The variable doesn't actually contain a certificate.
  2. 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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant