PKI small code cleanup#146
Conversation
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR performs code cleanup in the PKI package as preparation for PR #129 (native client-go implementation). The changes modernize error handling, simplify function signatures, and improve code maintainability.
Changes:
- Simplified
SignCertificatefunction to return only the parsed certificate instead of both PEM bytes and parsed certificate - Replaced custom error types with standard Go error handling using
fmt.Errorfwith proper error wrapping (%w) - Refactored
PublicKeysEqualto use a more elegant interface-based approach
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/pki/csr.go |
Changed SignCertificate signature to return only parsed certificate, improved error wrapping |
internal/pki/parse.go |
Replaced custom error types with standard fmt.Errorf and proper error wrapping |
internal/pki/generate.go |
Refactored PublicKeysEqual using interface pattern, improved error wrapping |
internal/pki/tls.go |
Added missing documentation comment for ToTLSCertificate |
internal/certificate/generate.go |
Updated calls to SignCertificate to match new signature |
pkg/authority/ca_secret_controller_test.go |
Updated test to match new SignCertificate signature |
internal/errors/errors.go |
Removed entire file as custom error types are no longer needed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: erikgb The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Code cleanups I found while working on #129.
See commits for more info.