2014-12-09 18:49:04 -08:00
|
|
|
package account
|
|
|
|
|
|
|
|
import (
|
2014-12-28 16:26:53 -08:00
|
|
|
"fmt"
|
2014-12-09 18:49:04 -08:00
|
|
|
|
2015-04-01 17:30:16 -07:00
|
|
|
"github.com/tendermint/tendermint/binary"
|
|
|
|
. "github.com/tendermint/tendermint/common"
|
2014-12-09 18:49:04 -08:00
|
|
|
)
|
|
|
|
|
2014-12-22 17:38:16 -08:00
|
|
|
// Signature is a part of Txs and consensus Votes.
|
2014-12-09 18:49:04 -08:00
|
|
|
type Signature interface {
|
2015-01-18 06:34:01 -08:00
|
|
|
TypeByte() byte
|
2014-12-09 18:49:04 -08:00
|
|
|
}
|
|
|
|
|
2014-12-22 17:38:16 -08:00
|
|
|
// Types of Signature implementations
|
2014-12-09 18:49:04 -08:00
|
|
|
const (
|
|
|
|
SignatureTypeEd25519 = byte(0x01)
|
|
|
|
)
|
|
|
|
|
2014-12-22 17:38:16 -08:00
|
|
|
// for binary.readReflect
|
2015-01-14 20:34:53 -08:00
|
|
|
var _ = binary.RegisterInterface(
|
2015-01-04 17:33:18 -08:00
|
|
|
struct{ Signature }{},
|
2015-01-14 20:34:53 -08:00
|
|
|
binary.ConcreteType{SignatureEd25519{}},
|
2015-01-04 17:33:18 -08:00
|
|
|
)
|
2014-12-09 18:49:04 -08:00
|
|
|
|
|
|
|
//-------------------------------------
|
|
|
|
|
2014-12-22 17:38:16 -08:00
|
|
|
// Implements Signature
|
2015-01-03 20:24:02 -08:00
|
|
|
type SignatureEd25519 []byte
|
2014-12-09 18:49:04 -08:00
|
|
|
|
|
|
|
func (sig SignatureEd25519) TypeByte() byte { return SignatureTypeEd25519 }
|
|
|
|
|
2015-01-18 06:34:01 -08:00
|
|
|
func (sig SignatureEd25519) IsNil() bool { return false }
|
2014-12-09 18:49:04 -08:00
|
|
|
|
2015-01-18 06:34:01 -08:00
|
|
|
func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 }
|
2014-12-28 16:26:53 -08:00
|
|
|
|
2015-01-18 06:34:01 -08:00
|
|
|
func (sig SignatureEd25519) String() string { return fmt.Sprintf("%X", Fingerprint(sig)) }
|