From 0b53528e8c6d2aa798d9123d485a00479b6f2601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Tue, 2 Apr 2024 10:03:22 +0200 Subject: [PATCH] fix tests and error message --- tools/walletextension/httpapi/utils.go | 2 +- tools/walletextension/lib/client_lib.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/walletextension/httpapi/utils.go b/tools/walletextension/httpapi/utils.go index 80c58ba0cb..c7acc16b8c 100644 --- a/tools/walletextension/httpapi/utils.go +++ b/tools/walletextension/httpapi/utils.go @@ -26,7 +26,7 @@ func getUserID(conn UserConn) ([]byte, error) { userID, err := getQueryParameter(conn.ReadRequestParams(), common.EncryptedTokenQueryParameter) if err == nil { if len(userID) != common.MessageUserIDLenWithPrefix { - return nil, fmt.Errorf(fmt.Sprintf("wrong length of userID from URL. Got: %d, Expected: %d", len(userID), common.MessageUserIDLen)) + return nil, fmt.Errorf(fmt.Sprintf("wrong length of userID from URL. Got: %d, Expected: %d", len(userID), common.MessageUserIDLenWithPrefix)) } return hexutils.HexToBytes(userID[2:]), err } diff --git a/tools/walletextension/lib/client_lib.go b/tools/walletextension/lib/client_lib.go index 3e63a1a22e..72eda7b77c 100644 --- a/tools/walletextension/lib/client_lib.go +++ b/tools/walletextension/lib/client_lib.go @@ -74,7 +74,7 @@ func (o *TGLib) RegisterAccount(pk *ecdsa.PrivateKey, addr gethcommon.Address) e req, err := http.NewRequestWithContext( context.Background(), http.MethodPost, - o.httpURL+"/v1/authenticate/?token="+hexutils.BytesToHex(o.userID), + o.httpURL+"/v1/authenticate/?token=0x"+hexutils.BytesToHex(o.userID), strings.NewReader(payload), ) if err != nil { @@ -124,7 +124,7 @@ func (o *TGLib) RegisterAccountPersonalSign(pk *ecdsa.PrivateKey, addr gethcommo req, err := http.NewRequestWithContext( context.Background(), http.MethodPost, - o.httpURL+"/v1/authenticate/?token="+hexutils.BytesToHex(o.userID), + o.httpURL+"/v1/authenticate/?token=0x"+hexutils.BytesToHex(o.userID), strings.NewReader(payload), ) if err != nil {