tendermint/blocks/signature.go

42 lines
712 B
Go
Raw Normal View History

2014-06-04 01:40:17 -07:00
package blocks
import (
2014-07-01 14:50:24 -07:00
. "github.com/tendermint/tendermint/binary"
"io"
2014-06-04 01:40:17 -07:00
)
/*
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 {
2014-07-01 14:50:24 -07:00
Signer AccountId
SigBytes ByteSlice
2014-06-04 01:40:17 -07:00
}
2014-06-05 11:04:56 -07:00
func ReadSignature(r io.Reader) Signature {
2014-07-01 14:50:24 -07:00
return Signature{
Signer: ReadAccountId(r),
SigBytes: ReadByteSlice(r),
}
2014-06-04 01:40:17 -07:00
}
2014-06-05 11:45:18 -07:00
func (self Signature) WriteTo(w io.Writer) (n int64, err error) {
2014-07-01 14:50:24 -07:00
n, err = WriteOnto(self.Signer, w, n, err)
n, err = WriteOnto(self.SigBytes, w, n, err)
return
2014-06-04 01:40:17 -07:00
}
func (self *Signature) Verify(msg ByteSlice) bool {
2014-07-01 14:50:24 -07:00
return false
2014-06-04 01:40:17 -07:00
}