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

Update pem.go #51

Closed
wants to merge 1 commit into from
Closed

Conversation

infinitydaemon
Copy link
Contributor

  • Replaced panic calls with structured error handling in helper functions.
  • Used %w in fmt.Errorf for better error wrapping.
  • Better readability
  • Centralized redundant logic (e.g., PEM encoding/decoding and file writing) into toPEMBytes, decodePEMBlock, and writePEMToFile.
  • Ensured os.O_TRUNC is used to overwrite files securely in writePEMToFile.
  • Unified similar logic between public and private key handling.

* Replaced panic calls with structured error handling in helper functions.
* Used %w in fmt.Errorf for better error wrapping.
* Better readability
* Centralized redundant logic (e.g., PEM encoding/decoding and file writing) into toPEMBytes, decodePEMBlock, and writePEMToFile.
* Ensured os.O_TRUNC is used to overwrite files securely in writePEMToFile.
* Unified similar logic between public and private key handling.
@david415
Copy link
Member

david415 commented Dec 2, 2024

lol dude you can't change the copyright notice

// SPDX-FileCopyrightText: Copyright (c) 2023-2024 David Stainton
// SPDX-License-Identifier: AGPL-3.0-only
+// infinitydaemon @CWDSYSTEMS

wrong.

@david415 david415 closed this Dec 2, 2024
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

Successfully merging this pull request may close these issues.

2 participants