(path string)
| 263 | } |
| 264 | |
| 265 | func parsePrivateKeyFromPath(path string) ([]byte, error) { |
| 266 | if _, err := os.Stat(path); err != nil { |
| 267 | return nil, fmt.Errorf("private key file not found: %s", credentialsPrivateKeyPath) |
| 268 | } |
| 269 | keyContents, err := os.ReadFile(path) |
| 270 | if err != nil { |
| 271 | return nil, fmt.Errorf("failed to read private key file: %w", err) |
| 272 | } |
| 273 | pemBlock, _ := pem.Decode(keyContents) |
| 274 | if pemBlock == nil { |
| 275 | return nil, fmt.Errorf("failed to decode PEM block") |
| 276 | } |
| 277 | if _, err := x509.ParsePKCS1PrivateKey(pemBlock.Bytes); err != nil { |
| 278 | return nil, fmt.Errorf("failed to parse private key: %w", err) |
| 279 | } |
| 280 | return keyContents, nil |
| 281 | } |
| 282 | |
| 283 | func parseCredentialsAddParams() (ret params.CreateGithubCredentialsParams, err error) { |
| 284 | ret.Name = credentialsName |
no outgoing calls
no test coverage detected