From fc18ca2cb38ba28750fff3032980badda3f35006 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 22 Nov 2021 15:38:15 +0300 Subject: [PATCH] [#87] owner: add compatibility test Test values were generated with the previous version of SDK. Signed-off-by: Evgenii Stratonikov --- owner/wallet_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 owner/wallet_test.go diff --git a/owner/wallet_test.go b/owner/wallet_test.go new file mode 100644 index 00000000..bba293f8 --- /dev/null +++ b/owner/wallet_test.go @@ -0,0 +1,21 @@ +package owner + +import ( + "crypto/ecdsa" + "crypto/elliptic" + "encoding/hex" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNEO3WalletFromPublicKey(t *testing.T) { + rawPub, _ := hex.DecodeString("0369b7b6c49fb937f3de52af189b91069767679c2739798d85f2ed69c079940680") + x, y := elliptic.UnmarshalCompressed(elliptic.P256(), rawPub) + require.True(t, x != nil && y != nil) + + expected := "35ee628f21922d7308f1bd71f03a0d8ba89c4e7372fca1442c" + w, err := NEO3WalletFromPublicKey(&ecdsa.PublicKey{Curve: elliptic.P256(), X: x, Y: y}) + require.NoError(t, err) + require.Equal(t, expected, hex.EncodeToString(w[:])) +}