Commit 45ec8646 authored by mdj33's avatar mdj33 Committed by vipwzw

adapt signature interface

parent 15488a32
...@@ -28,8 +28,7 @@ const ( ...@@ -28,8 +28,7 @@ const (
) )
func init() { func init() {
crypto.Register(MixSignName, &MixSignZkSnark{}, false) crypto.Register(MixSignName, &MixSignZkSnark{}, crypto.WithRegOptionTypeID(MixSignID))
crypto.RegisterType(MixSignName, MixSignID)
} }
// MixSignature mix签名中对于crypto.Signature接口实现 // MixSignature mix签名中对于crypto.Signature接口实现
...@@ -71,12 +70,12 @@ func (privkey *MixSignPrivateKey) Bytes() []byte { ...@@ -71,12 +70,12 @@ func (privkey *MixSignPrivateKey) Bytes() []byte {
} }
// Sign signature trasaction // Sign signature trasaction
func (privkey *MixSignPrivateKey) Sign(msg []byte) crypto.Signature { func (privkey *MixSignPrivateKey) Sign(msg []byte, opts ...interface{}) crypto.Signature {
return &MixSignature{} return &MixSignature{}
} }
// PubKey convert to public key // PubKey convert to public key
func (privkey *MixSignPrivateKey) PubKey() crypto.PubKey { func (privkey *MixSignPrivateKey) PubKey(opts ...interface{}) crypto.PubKey {
publicKey := new(MixSignPublicKey) publicKey := new(MixSignPublicKey)
return publicKey return publicKey
} }
...@@ -219,3 +218,8 @@ func (r *MixSignZkSnark) SignatureFromBytes(b []byte) (crypto.Signature, error) ...@@ -219,3 +218,8 @@ func (r *MixSignZkSnark) SignatureFromBytes(b []byte) (crypto.Signature, error)
return &mixSig, nil return &mixSig, nil
} }
// Validate validate msg and signature
func (r *MixSignZkSnark) Validate(msg, pub, sig []byte) error {
return crypto.BasicValidation(r, msg, pub, sig)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment