Libraries imports
This commit is contained in:
parent
f172cef2e1
commit
d1c55119c0
4 changed files with 12 additions and 12 deletions
|
|
@ -3,13 +3,13 @@ package armor
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"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/armor"
|
||||||
"golang.org/x/crypto/openpgp/clearsign"
|
"golang.org/x/crypto/openpgp/clearsign"
|
||||||
"golang.org/x/crypto/openpgp/packet"
|
"golang.org/x/crypto/openpgp/packet"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"proton/pmcrypto/internal"
|
|
||||||
"proton/pmcrypto/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ArmorKey make bytes input key to armor format
|
// ArmorKey make bytes input key to armor format
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package armor
|
package armor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"proton/pmcrypto/internal"
|
"gitlab.com/ProtonMail/go-pm-crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -11,4 +11,3 @@ const (
|
||||||
PUBLIC_KEY_HEADER string = "PGP PUBLIC KEY BLOCK"
|
PUBLIC_KEY_HEADER string = "PGP PUBLIC KEY BLOCK"
|
||||||
PRIVATE_KEY_HEADER string = "PGP PRIVATE KEY BLOCK"
|
PRIVATE_KEY_HEADER string = "PGP PRIVATE KEY BLOCK"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ func (sc *SignatureCollector) Accept(part io.Reader, header textproto.MIMEHeader
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// TODO: Sunny proposed to move this also to pm-mime library
|
||||||
partData, _ := ioutil.ReadAll(multiparts[1])
|
partData, _ := ioutil.ReadAll(multiparts[1])
|
||||||
decodedPart := pmmime.DecodeContentEncoding(bytes.NewReader(partData), multipartHeaders[1].Get("Content-Transfer-Encoding"))
|
decodedPart := pmmime.DecodeContentEncoding(bytes.NewReader(partData), multipartHeaders[1].Get("Content-Transfer-Encoding"))
|
||||||
buffer, err := ioutil.ReadAll(decodedPart)
|
buffer, err := ioutil.ReadAll(decodedPart)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"gitlab.com/ProtonMail/go-pm-crypto/constants"
|
||||||
"regexp"
|
"regexp"
|
||||||
"proton/pmcrypto/constants"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func TrimNewlines(input string) string {
|
func TrimNewlines(input string) string {
|
||||||
var re = regexp.MustCompile(`(?m)[ \t]*$`)
|
var re = regexp.MustCompile(`(?m)[ \t]*$`)
|
||||||
return re.ReplaceAllString(input, "")
|
return re.ReplaceAllString(input, "")
|
||||||
|
|
@ -19,7 +18,8 @@ const (
|
||||||
ARMOR_HEADER_VERSION = "Pmcrypto Golang 0.0.1 (" + constants.VERSION + ")"
|
ARMOR_HEADER_VERSION = "Pmcrypto Golang 0.0.1 (" + constants.VERSION + ")"
|
||||||
ARMOR_HEADER_COMMENT = "https://protonmail.com"
|
ARMOR_HEADER_COMMENT = "https://protonmail.com"
|
||||||
)
|
)
|
||||||
var ArmorHeaders = map[string]string {
|
|
||||||
|
var ArmorHeaders = map[string]string{
|
||||||
"Version": ARMOR_HEADER_VERSION,
|
"Version": ARMOR_HEADER_VERSION,
|
||||||
"Comment": ARMOR_HEADER_COMMENT,
|
"Comment": ARMOR_HEADER_COMMENT,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue