ImportFile attempts to import the armored key file into the GnuPGHome keyring. It returns an error if the GnuPGHome does not pass Validate, or if the import failed.
(path string)
| 169 | // It returns an error if the GnuPGHome does not pass Validate, or if the |
| 170 | // import failed. |
| 171 | func (d GnuPGHome) ImportFile(path string) error { |
| 172 | b, err := os.ReadFile(path) |
| 173 | if err != nil { |
| 174 | return fmt.Errorf("cannot read armored key data from file: %w", err) |
| 175 | } |
| 176 | return d.Import(b) |
| 177 | } |
| 178 | |
| 179 | // Cleanup deletes the GnuPGHome if it passes Validate. |
| 180 | // It returns an error if the GnuPGHome does not pass Validate, or if the |