passforios-gopenpgp/common.go

36 lines
792 B
Go
Raw Normal View History

2018-06-04 16:05:14 -07:00
package pm
2018-06-05 15:26:55 -07:00
import (
"regexp"
)
2018-06-04 16:05:14 -07:00
var armorHeader = map[string]string{
2018-06-04 17:50:26 -07:00
"Version": "OpenPGP Golang 0.0.1 (" + Version() + ")",
2018-06-04 16:05:14 -07:00
"Comment": "https://protonmail.com",
}
// Key ... add later
// protonmail key object
type Key struct {
KeyID string
PublicKey string
PrivateKey string
FingerPrint string
}
//Address ... add later protonmail address object
type Address struct {
// address_id : string;
// #optional
// address_name : string;
keys []Key
}
2018-06-05 15:26:55 -07:00
func trimNewlines(input string) string {
var re = regexp.MustCompile(`(?m)[ \t]*$`)
return re.ReplaceAllString(input, "")
}
// 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
var creationTimeOffset = int64(60 * 60 * 24 * 2)