Libraries imports

This commit is contained in:
Jakub Lehotsky 2018-09-20 13:36:56 +02:00
parent f172cef2e1
commit d1c55119c0
4 changed files with 12 additions and 12 deletions

View file

@ -3,13 +3,13 @@ package armor
import (
"bytes"
"errors"
"gitlab.com/ProtonMail/go-pm-crypto/internal"
"gitlab.com/ProtonMail/go-pm-crypto/models"
"golang.org/x/crypto/openpgp/armor"
"golang.org/x/crypto/openpgp/clearsign"
"golang.org/x/crypto/openpgp/packet"
"io"
"io/ioutil"
"proton/pmcrypto/internal"
"proton/pmcrypto/models"
)
// ArmorKey make bytes input key to armor format

View file

@ -1,14 +1,13 @@
package armor
import (
"proton/pmcrypto/internal"
"gitlab.com/ProtonMail/go-pm-crypto/internal"
)
const (
ARMOR_HEADER_VERSION = internal.ARMOR_HEADER_VERSION
ARMOR_HEADER_COMMENT = internal.ARMOR_HEADER_COMMENT
MESSAGE_HEADER string = "PGP MESSAGE"
PUBLIC_KEY_HEADER string = "PGP PUBLIC KEY BLOCK"
PRIVATE_KEY_HEADER string = "PGP PRIVATE KEY BLOCK"
ARMOR_HEADER_VERSION = internal.ARMOR_HEADER_VERSION
ARMOR_HEADER_COMMENT = internal.ARMOR_HEADER_COMMENT
MESSAGE_HEADER string = "PGP MESSAGE"
PUBLIC_KEY_HEADER string = "PGP PUBLIC KEY BLOCK"
PRIVATE_KEY_HEADER string = "PGP PRIVATE KEY BLOCK"
)

View file

@ -62,6 +62,7 @@ func (sc *SignatureCollector) Accept(part io.Reader, header textproto.MIMEHeader
if err != nil {
return
}
// TODO: Sunny proposed to move this also to pm-mime library
partData, _ := ioutil.ReadAll(multiparts[1])
decodedPart := pmmime.DecodeContentEncoding(bytes.NewReader(partData), multipartHeaders[1].Get("Content-Transfer-Encoding"))
buffer, err := ioutil.ReadAll(decodedPart)

View file

@ -1,11 +1,10 @@
package internal
import (
"gitlab.com/ProtonMail/go-pm-crypto/constants"
"regexp"
"proton/pmcrypto/constants"
)
func TrimNewlines(input string) string {
var re = regexp.MustCompile(`(?m)[ \t]*$`)
return re.ReplaceAllString(input, "")
@ -19,7 +18,8 @@ const (
ARMOR_HEADER_VERSION = "Pmcrypto Golang 0.0.1 (" + constants.VERSION + ")"
ARMOR_HEADER_COMMENT = "https://protonmail.com"
)
var ArmorHeaders = map[string]string {
var ArmorHeaders = map[string]string{
"Version": ARMOR_HEADER_VERSION,
"Comment": ARMOR_HEADER_COMMENT,
}