OSDN Git Service

Merge pull request #201 from Bytom/v0.1
[bytom/vapor.git] / vendor / github.com / tendermint / go-crypto / signature.go
index d2ea451..0c9b32a 100644 (file)
@@ -1,12 +1,8 @@
 package crypto
 
 import (
-       "bytes"
-       "fmt"
-
        "github.com/tendermint/go-wire"
        data "github.com/tendermint/go-wire/data"
-       . "github.com/tendermint/tmlibs/common"
 )
 
 func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) {
@@ -20,10 +16,7 @@ func SignatureFromBytes(sigBytes []byte) (sig Signature, err error) {
 // You probably want to use Signature.
 // +gen wrapper:"Signature,Impl[SignatureEd25519,SignatureSecp256k1],ed25519,secp256k1"
 type SignatureInner interface {
-       AssertIsSignatureInner()
        Bytes() []byte
-       IsZero() bool
-       Equals(Signature) bool
        Wrap() Signature
 }
 
@@ -34,24 +27,10 @@ var _ SignatureInner = SignatureEd25519{}
 // Implements Signature
 type SignatureEd25519 [64]byte
 
-func (sig SignatureEd25519) AssertIsSignatureInner() {}
-
 func (sig SignatureEd25519) Bytes() []byte {
        return wire.BinaryBytes(Signature{sig})
 }
 
-func (sig SignatureEd25519) IsZero() bool { return len(sig) == 0 }
-
-func (sig SignatureEd25519) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) }
-
-func (sig SignatureEd25519) Equals(other Signature) bool {
-       if otherEd, ok := other.Unwrap().(SignatureEd25519); ok {
-               return bytes.Equal(sig[:], otherEd[:])
-       } else {
-               return false
-       }
-}
-
 func (sig SignatureEd25519) MarshalJSON() ([]byte, error) {
        return data.Encoder.Marshal(sig[:])
 }
@@ -62,42 +41,3 @@ func (sig *SignatureEd25519) UnmarshalJSON(enc []byte) error {
        copy(sig[:], ref)
        return err
 }
-
-func SignatureEd25519FromBytes(data []byte) Signature {
-       var sig SignatureEd25519
-       copy(sig[:], data)
-       return sig.Wrap()
-}
-
-//-------------------------------------
-
-var _ SignatureInner = SignatureSecp256k1{}
-
-// Implements Signature
-type SignatureSecp256k1 []byte
-
-func (sig SignatureSecp256k1) AssertIsSignatureInner() {}
-
-func (sig SignatureSecp256k1) Bytes() []byte {
-       return wire.BinaryBytes(Signature{sig})
-}
-
-func (sig SignatureSecp256k1) IsZero() bool { return len(sig) == 0 }
-
-func (sig SignatureSecp256k1) String() string { return fmt.Sprintf("/%X.../", Fingerprint(sig[:])) }
-
-func (sig SignatureSecp256k1) Equals(other Signature) bool {
-       if otherEd, ok := other.Unwrap().(SignatureSecp256k1); ok {
-               return bytes.Equal(sig[:], otherEd[:])
-       } else {
-               return false
-       }
-}
-
-func (sig SignatureSecp256k1) MarshalJSON() ([]byte, error) {
-       return data.Encoder.Marshal(sig)
-}
-
-func (sig *SignatureSecp256k1) UnmarshalJSON(enc []byte) error {
-       return data.Encoder.Unmarshal((*[]byte)(sig), enc)
-}