mirror of
https://github.com/FiloSottile/age.git
synced 2026-01-07 12:35:14 +00:00
internal/age: remove EncryptWithArmor and armor support in Decrypt
The caller can take care of the armor. For consistency move the responsibility to close the armor to the caller, and make the stream Writer not propagate Close. This also will also allow us to spin the armor implementation out into its won package that imports format, without getting an import loop from format.Parse magically invoking armor decoding. Less magic in the API, more magic in the CLI.
This commit is contained in:
@@ -112,13 +112,6 @@ func Parse(input io.Reader) (*Header, io.Reader, error) {
|
||||
h := &Header{}
|
||||
rr := bufio.NewReader(input)
|
||||
|
||||
// TODO: find a way to communicate to the caller that the file was armored,
|
||||
// as they might not appreciate the malleability.
|
||||
if start, _ := rr.Peek(len(armorPreamble)); string(start) == armorPreamble {
|
||||
input = ArmoredReader(rr)
|
||||
rr = bufio.NewReader(input)
|
||||
}
|
||||
|
||||
line, err := rr.ReadString('\n')
|
||||
if err != nil {
|
||||
return nil, nil, errorf("failed to read intro: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user