|
|
@ -27,6 +27,11 @@ var _ = wire.RegisterInterface( |
|
|
|
wire.ConcreteType{SignatureSecp256k1{}, SignatureTypeSecp256k1}, |
|
|
|
) |
|
|
|
|
|
|
|
func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) { |
|
|
|
err = wire.ReadBinaryBytes(sigBytes, &sig) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
//-------------------------------------
|
|
|
|
|
|
|
|
// Implements Signature
|
|
|
@ -40,15 +45,6 @@ func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 } |
|
|
|
|
|
|
|
func (sig SignatureEd25519) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) } |
|
|
|
|
|
|
|
func ReadSignatureEd25519(bz []byte) (SignatureEd25519, error) { |
|
|
|
sig := struct{ Signature }{} |
|
|
|
err := wire.ReadBinaryBytes(bz, &sig) |
|
|
|
if err != nil { |
|
|
|
return SignatureEd25519{}, err |
|
|
|
} |
|
|
|
return sig.Signature.(SignatureEd25519), nil |
|
|
|
} |
|
|
|
|
|
|
|
//-------------------------------------
|
|
|
|
|
|
|
|
// Implements Signature
|
|
|
@ -61,12 +57,3 @@ func (sig SignatureSecp256k1) Bytes() []byte { |
|
|
|
func (sig SignatureSecp256k1) IsZero() bool { return len(sig) == 0 } |
|
|
|
|
|
|
|
func (sig SignatureSecp256k1) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) } |
|
|
|
|
|
|
|
func ReadSignatureSecp256k1(bz []byte) (SignatureSecp256k1, error) { |
|
|
|
sig := struct{ Signature }{} |
|
|
|
err := wire.ReadBinaryBytes(bz, &sig) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
return sig.Signature.(SignatureSecp256k1), nil |
|
|
|
} |