diff --git a/mobile/response_test.go b/mobile/response_test.go index a697cce0f..21657479a 100644 --- a/mobile/response_test.go +++ b/mobile/response_test.go @@ -25,3 +25,10 @@ func TestPrepareJSONResponseErrorWithError(t *testing.T) { data := prepareJSONResponse("0x123", errors.New("some error")) require.Contains(t, data, `{"error":{"message":"some error"}}`) } + +func TestDeserializeAndCompressKeyApi(t *testing.T) { + desktopKey := "zQ3shTAten2v9CwyQD1Kc7VXAqNPDcHZAMsfbLHCZEx6nFqk9" + mobileKeyExpected := "0x025596a7ff87da36860a84b0908191ce60a504afc94aac93c1abd774f182967ce6" + mobileKeyConverted := DeserializeAndCompressKey(desktopKey) + require.Equal(t, mobileKeyConverted, mobileKeyExpected) +} diff --git a/mobile/status.go b/mobile/status.go index 8995de100..b1829da5a 100644 --- a/mobile/status.go +++ b/mobile/status.go @@ -1088,3 +1088,9 @@ func ToChecksumAddress(address string) string { } return address } + +func DeserializeAndCompressKey(DesktopKey string) string { + deserialisedKey := MultiformatDeserializePublicKey(DesktopKey, "f") + sanitisedKey := "0x" + deserialisedKey[5:] + return CompressPublicKey(sanitisedKey) +}