more cleanup, fixes

This commit is contained in:
Sanjana Rajan 2018-06-04 17:50:26 -07:00
parent c254bd5d44
commit 04ebe6d459
9 changed files with 33 additions and 53 deletions

View file

@ -8,24 +8,12 @@ import (
"golang.org/x/crypto/openpgp/armor"
)
// ...Armor Type
type ArmorType string
func (at ArmorType) string() string {
return string(at)
}
const (
pgpMessageType ArmorType = "PGP MESSAGE"
pgpPublicBlockType ArmorType = "PGP PUBLIC KEY BLOCK"
pgpPrivateBlockType ArmorType = "PGP PRIVATE KEY BLOCK"
pgpMessageType string = "PGP MESSAGE"
pgpPublicBlockType string = "PGP PUBLIC KEY BLOCK"
pgpPrivateBlockType string = "PGP PRIVATE KEY BLOCK"
)
// ArmorKey make bytes input key to armor format
func ArmorKey(input []byte) (string, error) {
return ArmorWithType(input, pgpPublicBlockType.string())
}
// ArmorWithType make bytes input to armor format
func ArmorWithType(input []byte, armorType string) (string, error) {
var b bytes.Buffer