peridot/vendor/github.com/ProtonMail/gopenpgp/v2/internal/armor.go

19 lines
365 B
Go
Raw Normal View History

2022-07-07 20:11:50 +00:00
package internal
import (
"strings"
"github.com/ProtonMail/go-crypto/openpgp/armor"
"github.com/pkg/errors"
)
// Unarmor unarmors an armored string.
func Unarmor(input string) (*armor.Block, error) {
io := strings.NewReader(input)
b, err := armor.Decode(io)
if err != nil {
return nil, errors.Wrap(err, "gopenpgp: unable to unarmor")
}
return b, nil
}