28 lines
471 B
Go
28 lines
471 B
Go
package bloat
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"io"
|
|
|
|
"filippo.io/age"
|
|
"filippo.io/age/armor"
|
|
)
|
|
|
|
func (b *Bloat[T]) decrypt(src []byte) ([]byte, error) {
|
|
|
|
input := bytes.NewReader(src)
|
|
deArmored := armor.NewReader(input)
|
|
out, err := age.Decrypt(deArmored, &b.Enc)
|
|
if err != nil {
|
|
fmt.Println("decrypt error")
|
|
fmt.Println(err)
|
|
return nil, err
|
|
}
|
|
res, err := io.ReadAll(out)
|
|
if err != nil {
|
|
fmt.Println("io readall error")
|
|
fmt.Println(err)
|
|
}
|
|
return res, err
|
|
}
|