One name, type byte per algorithm

This commit is contained in:
Ethan Frey
2017-02-24 00:31:43 +01:00
parent 8c9b889ccf
commit 0e92dd5bb5
5 changed files with 21 additions and 37 deletions

View File

@ -17,21 +17,13 @@ type Signature interface {
Equals(Signature) bool
}
// Types of Signature implementations
const (
SignatureTypeEd25519 = byte(0x01)
SignatureTypeSecp256k1 = byte(0x02)
SignatureNameEd25519 = "ed25519"
SignatureNameSecp256k1 = "secp256k1"
)
var sigMapper data.Mapper
// register both public key types with go-data (and thus go-wire)
func init() {
sigMapper = data.NewMapper(SignatureS{}).
RegisterInterface(SignatureEd25519{}, SignatureNameEd25519, SignatureTypeEd25519).
RegisterInterface(SignatureSecp256k1{}, SignatureNameSecp256k1, SignatureTypeSecp256k1)
RegisterInterface(SignatureEd25519{}, NameEd25519, TypeEd25519).
RegisterInterface(SignatureSecp256k1{}, NameSecp256k1, TypeSecp256k1)
}
// SignatureS add json serialization to Signature