|
|
@ -2,6 +2,7 @@ package bls |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"errors" |
|
|
|
"errors" |
|
|
|
|
|
|
|
"fmt" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/harmony-one/bls/ffi/go/bls" |
|
|
|
"github.com/harmony-one/bls/ffi/go/bls" |
|
|
|
"github.com/harmony-one/harmony/internal/ctxerror" |
|
|
|
"github.com/harmony-one/harmony/internal/ctxerror" |
|
|
@ -20,6 +21,9 @@ func RandPrivateKey() *bls.SecretKey { |
|
|
|
|
|
|
|
|
|
|
|
// BytesToBlsPublicKey converts bytes into bls.PublicKey pointer.
|
|
|
|
// BytesToBlsPublicKey converts bytes into bls.PublicKey pointer.
|
|
|
|
func BytesToBlsPublicKey(bytes []byte) (*bls.PublicKey, error) { |
|
|
|
func BytesToBlsPublicKey(bytes []byte) (*bls.PublicKey, error) { |
|
|
|
|
|
|
|
if len(bytes) == 0 { |
|
|
|
|
|
|
|
return nil, fmt.Errorf("[BytesToBlsPublicKey] bytes is empty") |
|
|
|
|
|
|
|
} |
|
|
|
pubKey := &bls.PublicKey{} |
|
|
|
pubKey := &bls.PublicKey{} |
|
|
|
err := pubKey.Deserialize(bytes) |
|
|
|
err := pubKey.Deserialize(bytes) |
|
|
|
return pubKey, err |
|
|
|
return pubKey, err |
|
|
|