mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-26 15:35:46 +00:00
adjusted for ed25519
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
dc0de3732d
commit
2e587783b6
@ -5,14 +5,13 @@ import (
|
||||
machinetypes "planetmint-go/x/machine/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
// KeyPair returns a sample private / public keypair
|
||||
func KeyPair() (string, string) {
|
||||
secret := "Don't tell anybody"
|
||||
sk := secp256k1.GenPrivKeyFromSecret([]byte(secret))
|
||||
sk := ed25519.GenPrivKeyFromSecret([]byte(secret))
|
||||
pk := sk.PubKey()
|
||||
return hex.EncodeToString(sk.Bytes()), hex.EncodeToString(pk.Bytes())
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"planetmint-go/x/asset/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
@ -47,7 +47,7 @@ func ValidateSignature(message string, signature string, publicKey string) bool
|
||||
hash := sha256.Sum256(messageBytes)
|
||||
|
||||
// Create a secp256k1 public key object
|
||||
pubKey := &secp256k1.PubKey{Key: publicKeyBytes}
|
||||
pubKey := &ed25519.PubKey{Key: publicKeyBytes}
|
||||
|
||||
// Verify the signature
|
||||
isValid := pubKey.VerifySignature(hash[:], signatureBytes)
|
||||
|
||||
@ -11,7 +11,7 @@ import (
|
||||
"planetmint-go/x/asset/keeper"
|
||||
"planetmint-go/x/asset/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@ -29,7 +29,7 @@ func TestMsgServerNotarizeAsset(t *testing.T) {
|
||||
if err != nil {
|
||||
assert.Equal(t, true, false)
|
||||
}
|
||||
privKey := &secp256k1.PrivKey{Key: skBytes}
|
||||
privKey := &ed25519.PrivKey{Key: skBytes}
|
||||
|
||||
cidBytes, _ := hex.DecodeString(cid)
|
||||
hash := sha256.Sum256(cidBytes)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user