status-go/mobile
Icaro Motta 919277be38
feat(pairing)_: Fallback pairing seed (#5614) (#5627)
* feat(pairing)!: Add extra parameters and remove v2 compatibility

This commit includes the following changes:

I have added a flag to maintain 2.29 compatibility.

Breaking change in connection string

The local pairing code that was parsing the connection string had a few non-upgradable features:

It was strictly checking the number of parameters, throwing an error if the number was different. This made it impossible to add parameters to it without breaking.
It was strictly checking the version number. This made increasing the version number impossible as older client would just refuse to connect.
The code has been changed so that:

Two parameters have been added, installation-id and key-uid. Those are needed for the fallback flow.
I have also removed version from the payload, since it wasn't used.

This means that we don't support v1 anymore. V2 parsing is supported . Going forward there's a clear strategy on how to update the protocol (append parameters, don't change existing one).

https://www.youtube.com/watch?v=oyLBGkS5ICk Is a must watch video for understanding the strategy

Changed MessengerResponse to use internally a map of installations rather than an array (minor)
Just moving towards maps as arrays tend to lead to subtle bugs.

Moved pairing methods to messenger_pairing.go
Just moved some methods

Added 2 new methods for the fallback flow
FinishPairingThroughSeedPhraseProcess
https://github.com/status-im/status-go/pull/5567/files#diff-1ad620b07fa3bd5fbc96c9f459d88829938a162bf1aaf41c61dea6e38b488d54R29

EnableAndSyncInstallation

https://github.com/status-im/status-go/pull/5567/files#diff-1ad620b07fa3bd5fbc96c9f459d88829938a162bf1aaf41c61dea6e38b488d54R18

Flow for clients
Client A1 is logged in
Client A2 is logged out

Client A1 shows a QR code
Client A2 scans a QR code
If connection fails on A2, the user will be prompted to enter a seed phrase.
If the generated account matches the key-uid from the QR code, A2 should call FinishPairingThroughSeedPhraseProcess with the installation id passed in the QR code. This will send installation information over waku. The user should be shown its own installation id and prompted to check the other device.
Client A1 will receive new installation data through waku, if they are still on the qr code page, they should show a popup to the user showing the received installation id, and a way to Enable and Sync, which should call the EnableAndSyncInstallation endpoint. This should finish the fallback syncing flow.
Current issues
Currently I haven't tested that all the data is synced after finishing the flow. I see that the two devices are paired correctly, but for example the DisplayName is not changed on the receiving device. I haven't had time to look into it further.

* test_: add more test for connection string parser

* fix_: fix panic when parse old connection string

* test_: add comments for TestMessengerPairAfterSeedPhrase

* fix_: correct error description

* feat_:rename FinishPairingThroughSeedPhraseProcess to EnableInstallationAndPair

* fix_: delete leftover

* fix_: add UniqueKey method

* fix_: unify the response for InputConnectionStringForBootstrapping

* fix_: remove fields installationID and keyUID in GethStatusBackend

* fix_: rename messenger_pairing to messenger_pairing_and_syncing

---------

Co-authored-by: frank <lovefree103@gmail.com>
Co-authored-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
2024-07-30 13:03:43 -03:00
..
README.md rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
multiaccount.go feat: create acc from private key endpoint added 2023-03-28 16:19:27 +02:00
response.go Use eth-node `keystore` for `generator.go` 2020-01-06 15:45:31 +01:00
response_test.go converting desktop key to mobile readable (#3042) 2023-01-04 07:25:07 +05:30
status.go feat(pairing)_: Fallback pairing seed (#5614) (#5627) 2024-07-30 13:03:43 -03:00
status_geth.go remove nimbus 2021-05-21 07:22:58 +02:00
types.go Return keyUID on succesfull validation of mnemonic 2023-03-28 10:52:06 +02:00

README.md

Mobile

Package mobile implements gomobile bindings for status-go. Current implementation servers as a drop-in replacement for lib package.

Individual bindings and their descriptions are available in status.go.

The primary consumer of this package is status-mobile project.

The framework name is generated from the package name, hence these things are done intentionally: (1) this package's name isn't equal to the directory name (statusgo vs mobile respectively); (2) this package name is statusgo and not status which produces the right framework name.

Usage

For properly using this package, please refer to Makefile in the root of status-go directory.

To manually build library, run following commands:

iOS

gomobile bind -v -target=ios -ldflags="-s -w" github.com/status-im/status-go/mobile

This will produce Statusgo.framework file in the current directory, which can be used in iOS project.

Android

gomobile bind -v -target=android -ldflags="-s -w" github.com/status-im/status-go/mobile

This will generate Statusgo.aar file in the current dir.

Notes

See https://github.com/golang/go/wiki/Mobile for more information on gomobile usage.