()
| 179 | } |
| 180 | |
| 181 | func (o *pluginPackageOptions) passphraseFileFetcher() (provenance.PassphraseFetcher, error) { |
| 182 | file, err := openPassphraseFile(o.passphraseFile, os.Stdin) |
| 183 | if err != nil { |
| 184 | return nil, err |
| 185 | } |
| 186 | defer file.Close() |
| 187 | |
| 188 | // Read the entire passphrase |
| 189 | passphrase, err := io.ReadAll(file) |
| 190 | if err != nil { |
| 191 | return nil, err |
| 192 | } |
| 193 | |
| 194 | // Trim any trailing newline characters (both \n and \r\n) |
| 195 | passphrase = bytes.TrimRight(passphrase, "\r\n") |
| 196 | |
| 197 | return func(_ string) ([]byte, error) { |
| 198 | return passphrase, nil |
| 199 | }, nil |
| 200 | } |
| 201 | |
| 202 | // copied from action.openPassphraseFile |
| 203 | // TODO: should we move this to pkg/action so we can reuse the func from there? |
no test coverage detected