passforios-gopenpgp/internal/common.go

29 lines
803 B
Go
Raw Normal View History

package internal
import (
2018-11-01 17:03:43 +01:00
"github.com/ProtonMail/go-pm-crypto/constants"
"regexp"
)
2019-03-07 14:23:38 +01:00
// TrimNewlines removes a whitespace in the end of string (don't stop on linebreak)
func TrimNewlines(input string) string {
var re = regexp.MustCompile(`(?m)[ \t]*$`)
return re.ReplaceAllString(input, "")
}
2019-03-07 14:23:38 +01:00
// CreationTimeOffset stores amount of seconds that a signature may be created
// after the verify time Consistent with the 2 day slack allowed in the
// ProtonMail Email Parser
const CreationTimeOffset = int64(60 * 60 * 24 * 2)
const (
2019-03-07 14:23:38 +01:00
armorHeaderVersion = "Pmcrypto Golang 0.0.1 (" + constants.VERSION + ")"
armorHeaderComment = "https://protonmail.com"
)
2018-09-20 13:36:56 +02:00
2019-03-07 14:23:38 +01:00
// ArmorHeaders from golang pm-crypto
2018-09-20 13:36:56 +02:00
var ArmorHeaders = map[string]string{
2019-03-07 14:23:38 +01:00
"Version": armorHeaderVersion,
"Comment": armorHeaderComment,
}