tendermint/blocks/signature.go

44 lines
824 B
Go
Raw Normal View History

2014-06-04 01:40:17 -07:00
package blocks
import (
. "github.com/tendermint/tendermint/binary"
"io"
)
/*
Signature message wire format:
|A...|SSS...|
A account number, varint encoded (1+ bytes)
S signature of all prior bytes (32 bytes)
It usually follows the message to be signed.
*/
type Signature struct {
Signer AccountId
SigBytes ByteSlice
}
2014-06-05 11:04:56 -07:00
func ReadSignature(r io.Reader) Signature {
return Signature{
Signer: ReadAccountId(r),
SigBytes: ReadByteSlice(r),
2014-06-04 01:40:17 -07:00
}
}
func (self *Signature) WriteTo(w io.Writer) (n int64, err error) {
var n_ int64
n_, err = self.Signer.WriteTo(w)
n += n_; if err != nil { return n, err }
n_, err = self.SigBytes.WriteTo(w)
n += n_; return
}
func (self *Signature) Verify(msg ByteSlice) bool {
return false
}