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-07-25 15:45:45 -07:00
|
|
|
"github.com/tendermint/tendermint/wire"
|
2015-04-01 17:30:16 -07:00
|
|
|
. "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-07-19 09:45:40 -07:00
|
|
|
IsZero() bool
|
|
|
|
String() string
|
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)
|
|
|
|
)
|
|
|
|
|
2015-07-25 15:45:45 -07:00
|
|
|
// for wire.readReflect
|
|
|
|
var _ = wire.RegisterInterface(
|
2015-01-04 17:33:18 -08:00
|
|
|
struct{ Signature }{},
|
2015-07-25 15:45:45 -07:00
|
|
|
wire.ConcreteType{SignatureEd25519{}, SignatureTypeEd25519},
|
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-07-17 17:19:16 -04:00
|
|
|
type SignatureEd25519 [64]byte
|
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-07-17 17:19:16 -04:00
|
|
|
func (sig SignatureEd25519) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) }
|