passforios-gopenpgp/crypto/gopenpgp.go

27 lines
704 B
Go
Raw Permalink Normal View History

// Package crypto provides a high-level API for common OpenPGP functionality.
package crypto
2018-06-04 16:05:14 -07:00
2021-10-18 11:33:02 +02:00
import "sync"
// GopenPGP is used as a "namespace" for many of the functions in this package.
// It is a struct that keeps track of time skew between server and client.
2019-05-14 18:05:01 +02:00
type GopenPGP struct {
2018-06-04 17:50:26 -07:00
latestServerTime int64
generationOffset int64
2021-10-19 08:09:59 +02:00
lock *sync.RWMutex
2018-06-04 16:05:14 -07:00
}
2021-10-18 11:33:02 +02:00
var pgp = GopenPGP{
latestServerTime: 0,
generationOffset: 0,
2021-10-19 09:06:09 +02:00
lock: &sync.RWMutex{},
2021-10-18 11:33:02 +02:00
}
// clone returns a clone of the byte slice. Internal function used to make sure
// we don't retain a reference to external data.
func clone(input []byte) []byte {
data := make([]byte, len(input))
copy(data, input)
return data
}