Skip to content

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

@y12studio

Description

@y12studio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions