mirror of
https://github.com/status-im/status-go.git
synced 2025-01-25 05:58:59 +00:00
5336c47f1b
Add `wallet_SafeSignTypedDataForDApps` with support for `eth_signTypedData` and `eth_signTypedData_v4` Reject if the chain to sign doesn't matches the target chain for typed data signing Add `wallet_HashMessageForSigning` with to support hashing messages for signing in a safe way as per EIP-191 v45 and supporting to hash messages for signing on the client side (keycard) Deprecate `wallet_SignTypedDataV4`` Updates: #15361
32 lines
777 B
Go
32 lines
777 B
Go
package wallet
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/status-im/status-go/services/wallet/walletconnect"
|
|
)
|
|
|
|
// TestAPI_GetWalletConnectActiveSessions tames coverage
|
|
func TestAPI_GetWalletConnectActiveSessions(t *testing.T) {
|
|
db, close := walletconnect.SetupTestDB(t)
|
|
defer close()
|
|
api := &API{
|
|
s: &Service{db: db},
|
|
}
|
|
|
|
sessions, err := api.GetWalletConnectActiveSessions(context.Background(), 0)
|
|
require.NoError(t, err)
|
|
require.Equal(t, 0, len(sessions))
|
|
}
|
|
|
|
// TestAPI_HashMessageEIP191
|
|
func TestAPI_HashMessageEIP191(t *testing.T) {
|
|
api := &API{}
|
|
|
|
res := api.HashMessageEIP191(context.Background(), []byte("test"))
|
|
require.Equal(t, "0x4a5c5d454721bbbb25540c3317521e71c373ae36458f960d2ad46ef088110e95", res.String())
|
|
}
|