2019-05-15 14:57:35 +02:00
|
|
|
// Package internal contains internal methods and constants.
|
2018-09-11 11:09:28 +02:00
|
|
|
package internal
|
|
|
|
|
|
|
|
|
|
import (
|
2020-12-01 18:09:25 +01:00
|
|
|
"strings"
|
2019-05-15 13:40:19 +02:00
|
|
|
|
2019-12-27 19:35:43 +01:00
|
|
|
"github.com/ProtonMail/gopenpgp/v2/constants"
|
2018-09-11 11:09:28 +02:00
|
|
|
)
|
|
|
|
|
|
2020-12-01 18:09:25 +01:00
|
|
|
func CanonicalizeAndTrim(text string) string {
|
|
|
|
|
lines := strings.Split(text, "\n")
|
|
|
|
|
|
|
|
|
|
for i := range lines {
|
|
|
|
|
lines[i] = strings.TrimRight(lines[i], " \t\r")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return strings.Join(lines, "\r\n")
|
2018-09-11 11:09:28 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-13 12:33:01 +00:00
|
|
|
// CreationTimeOffset stores the amount of seconds that a signature may be
|
2019-05-15 14:57:35 +02:00
|
|
|
// created in the future, to compensate for clock skew.
|
2018-09-11 11:09:28 +02:00
|
|
|
const CreationTimeOffset = int64(60 * 60 * 24 * 2)
|
|
|
|
|
|
2019-05-15 14:57:35 +02:00
|
|
|
// ArmorHeaders is a map of default armor headers.
|
2018-09-20 13:36:56 +02:00
|
|
|
var ArmorHeaders = map[string]string{
|
2019-03-07 16:56:12 +01:00
|
|
|
"Version": constants.ArmorHeaderVersion,
|
|
|
|
|
"Comment": constants.ArmorHeaderComment,
|
2018-09-11 11:09:28 +02:00
|
|
|
}
|