feat(pairing)!: add fallback flow to pairing
This commit includes the following changes:
*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:
- Version is not used. Better not to use something than to use it wrongly, rarely version is needed if the protocol is correctly upgraded.
- 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 should be supported (a new might be able to parse a v2 client, but not the other way around). It is to be considered a complete breaking change. 2.30 -> 2.30 syncing only is supported, but going forward there's a clear strategy on how to update the protocol (append parameters, don't change existing one).
*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
1) Client A1 shows a QR code
2) Client A2 scans a QR code
3) If connection fails on A2, the user will be prompted to enter a seed phrase.
4) 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.
5) 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.
* fix_:still return the image when handleAccountInitialsImpl unable to get public key
* test_:add unit test for handleAccountInitialsImpl
* test_:improve unit test
* fix_:still return the image when handleAccountImagesImpl unable to get public key
The reused implementation from signing typed data V1 was used
in case of signing typed data V4. This implementation required
chain ID to be present in the typed data. This change fixes
the issue by making chainID optional for signing typed data V4.
* feat(connector)_: impl `eth_requestAccounts` for browser plugin
* feat(connector)_: add impl for `wallet_switchEthereumChain` and `eth_chainId`
* feat(connector)_: add impl for `eth_sendTransaction`
* feat(connector)_: add a signal and an endpoint for wallet ui side
* chore_: refactor connector tests
* feat(connector)_: impl `eth_requestAccounts` with signal
* chore(connector)_: Add test, covering full transaction flow
And polish impl & test for connector endpoints
* fix(connector)_: temporary allow all origins for ws connection
* chore_: review fixes
* fix(connector)_: make user select chain id for dApp
* fix(connector)_: add requestID and fine tune endpoints
* chore(connector)_: naming fixes and tests improvments
instead.
Fixed padding points being removed from final result, regression.
Edge points not added per address as it does not make sense.
Fixed padding points number with respect to edge points number.
Padding points now duplicate previous entry.
Fixed timestamp boundaries to ignore addresses, as we want the whole
range for all passed addresses.
Fixed missing indices in balance_history table and clean up of
duplicate rows.
Removed ERC1155 from balance history sql query
* fix_: allow gas estimation for DynamicFeeTx
* test_: added tests for BuildAndValidateTransaction
* fix_: using IsDynamicTx for gasPrice suggestion
* fix_: hash transaction check
Co-authored-by: Stefan Dunca <47554641+stefandunca@users.noreply.github.com>
---------
Co-authored-by: Stefan Dunca <47554641+stefandunca@users.noreply.github.com>
This commit adds support for centralized metrics.
There are two providers as of now, and we haven't quite decided which
one to go for, so for the time being both are supported.
It also introduces a new endpoint InitializeApplication that replaces
OpenAccounts