INNER CODE UNIT · Go
func
aead/minisign · minisign.go:85
func (r *Reader) Read(p []byte) (int, error) {
n, err := r.message.Read(p)
r.hash.Write(p[:n])
return n, err
}
// Sign signs whatever has been read from the underlying
// io.Reader up to this point in time with the given private
// key.
//
// It behaves like SignWithComments but uses some generic comments.
func (r *Reader) Sign(privateKey PrivateKey) []byte {
var (
trustedComment = "timestamp:" + strconv.FormatInt(time.Now().Unix(), 10)
untrustedComment = "signature from private key: " + strings.ToUpper(strconv.FormatUint(privateKey.ID(), 16))
)
return r.SignWithComments(privateKey, trustedComment, untrustedComment)
}