diff --git a/.changeset/cool-penguins-raise.md b/.changeset/cool-penguins-raise.md new file mode 100644 index 00000000000..c47839be310 --- /dev/null +++ b/.changeset/cool-penguins-raise.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +#updated Remove custom ed25519 private to public key conversion. diff --git a/core/services/keystore/keys/csakey/key_v2.go b/core/services/keystore/keys/csakey/key_v2.go index 08207f52af4..ddccbfb488b 100644 --- a/core/services/keystore/keys/csakey/key_v2.go +++ b/core/services/keystore/keys/csakey/key_v2.go @@ -16,7 +16,7 @@ func (raw Raw) Key() KeyV2 { privKey := ed25519.PrivateKey(raw) return KeyV2{ privateKey: &privKey, - PublicKey: ed25519PubKeyFromPrivKey(privKey), + PublicKey: privKey.Public().(ed25519.PublicKey), } } @@ -66,7 +66,7 @@ func MustNewV2XXXTestingOnly(k *big.Int) KeyV2 { privKey := ed25519.NewKeyFromSeed(seed) return KeyV2{ privateKey: &privKey, - PublicKey: ed25519PubKeyFromPrivKey(privKey), + PublicKey: privKey.Public().(ed25519.PublicKey), Version: 2, } } @@ -90,9 +90,3 @@ func (k KeyV2) String() string { func (k KeyV2) GoString() string { return k.String() } - -func ed25519PubKeyFromPrivKey(privKey ed25519.PrivateKey) ed25519.PublicKey { - publicKey := make([]byte, ed25519.PublicKeySize) - copy(publicKey, privKey[32:]) - return publicKey -} diff --git a/core/services/keystore/keys/solkey/key.go b/core/services/keystore/keys/solkey/key.go index c6cdd62d3bf..610dada64b1 100644 --- a/core/services/keystore/keys/solkey/key.go +++ b/core/services/keystore/keys/solkey/key.go @@ -17,11 +17,9 @@ type Raw []byte // Key gets the Key func (raw Raw) Key() Key { privKey := ed25519.NewKeyFromSeed(raw) - pubKey := make([]byte, ed25519.PublicKeySize) - copy(pubKey, privKey[ed25519.PublicKeySize:]) return Key{ privkey: privKey, - pubKey: pubKey, + pubKey: privKey.Public().(ed25519.PublicKey), } }