Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fallback flow to pairing #5567

Closed
wants to merge 4 commits into from
Closed

Conversation

cammellos
Copy link
Contributor

@cammellos cammellos commented Jul 24, 2024

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).

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

  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.

@cammellos cammellos self-assigned this Jul 24, 2024
@cammellos cammellos changed the title wip add fallback flow to pairing Jul 24, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Jul 24, 2024

Jenkins Builds

Click to see older builds (30)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ 6413382 #1 2024-07-24 06:23:54 ~1 min tests 📄log
✔️ 6413382 #1 2024-07-24 06:25:25 ~2 min tests-rpc 📄log
✔️ 6413382 #1 2024-07-24 06:26:32 ~3 min linux 📦zip
✔️ 6413382 #1 2024-07-24 06:27:36 ~4 min ios 📦zip
✔️ 6413382 #1 2024-07-24 06:28:23 ~5 min android 📦aar
✔️ da2a8c0 #2 2024-07-24 06:45:53 ~1 min android 📦aar
✖️ da2a8c0 #2 2024-07-24 06:46:41 ~2 min tests 📄log
✔️ da2a8c0 #2 2024-07-24 06:47:30 ~3 min ios 📦zip
✔️ da2a8c0 #2 2024-07-24 06:47:34 ~3 min tests-rpc 📄log
✔️ da2a8c0 #2 2024-07-24 06:48:13 ~3 min linux 📦zip
✔️ 7d0468b #3 2024-07-24 06:55:43 ~1 min android 📦aar
✔️ 7d0468b #3 2024-07-24 06:56:02 ~2 min tests-rpc 📄log
✔️ 7d0468b #3 2024-07-24 06:56:10 ~2 min linux 📦zip
✔️ 7d0468b #3 2024-07-24 06:56:59 ~3 min ios 📦zip
✖️ 7d0468b #3 2024-07-24 06:59:03 ~5 min tests 📄log
✔️ 4207c5f #4 2024-07-24 07:05:03 ~1 min android 📦aar
✔️ 4207c5f #4 2024-07-24 07:05:39 ~2 min linux 📦zip
✔️ 4207c5f #4 2024-07-24 07:05:40 ~2 min tests-rpc 📄log
✔️ 4207c5f #4 2024-07-24 07:06:33 ~3 min ios 📦zip
✔️ 4207c5f #4 2024-07-24 07:49:15 ~45 min tests 📄log
✔️ c4821d6 #5 2024-07-25 07:30:25 ~1 min android 📦aar
✔️ c4821d6 #5 2024-07-25 07:30:45 ~1 min linux 📦zip
✔️ c4821d6 #5 2024-07-25 07:31:04 ~2 min tests-rpc 📄log
✔️ c4821d6 #5 2024-07-25 07:33:25 ~4 min ios 📦zip
✖️ c4821d6 #5 2024-07-25 08:07:21 ~38 min tests 📄log
✔️ 8f56c10 #6 2024-07-25 08:16:28 ~2 min tests-rpc 📄log
✔️ 8f56c10 #6 2024-07-25 08:16:37 ~2 min linux 📦zip
✖️ 8f56c10 #6 2024-07-25 08:16:40 ~2 min tests 📄log
✔️ 8f56c10 #6 2024-07-25 08:17:10 ~2 min ios 📦zip
✔️ 8f56c10 #6 2024-07-25 08:19:29 ~5 min android 📦aar
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ c39d9dc #7 2024-07-25 08:46:54 ~1 min android 📦aar
✔️ c39d9dc #7 2024-07-25 08:47:28 ~2 min linux 📦zip
✔️ c39d9dc #7 2024-07-25 08:47:37 ~2 min tests-rpc 📄log
✔️ c39d9dc #7 2024-07-25 08:48:44 ~3 min ios 📦zip
✖️ c39d9dc #7 2024-07-25 09:25:30 ~40 min tests 📄log
✔️ 2514315 #8 2024-07-25 11:34:05 ~2 min tests-rpc 📄log
✔️ 2514315 #8 2024-07-25 11:35:03 ~3 min ios 📦zip
✔️ 2514315 #8 2024-07-25 11:35:33 ~3 min linux 📦zip
✔️ 2514315 #8 2024-07-25 11:36:51 ~5 min android 📦aar
✖️ 2514315 #8 2024-07-25 12:10:57 ~39 min tests 📄log

@cammellos cammellos force-pushed the feature/fallback-pairing-seed branch from 6413382 to da2a8c0 Compare July 24, 2024 06:44
@cammellos cammellos marked this pull request as ready for review July 24, 2024 06:44
@cammellos cammellos force-pushed the feature/fallback-pairing-seed branch 2 times, most recently from 7d0468b to 4207c5f Compare July 24, 2024 07:03
@qfrank qfrank self-assigned this Jul 24, 2024
cammellos and others added 4 commits July 25, 2024 19:31
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.
@qfrank
Copy link
Contributor

qfrank commented Jul 29, 2024

pls use PR instead of this one

@qfrank qfrank closed this Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants