status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
271 stars 76 forks source link

Browser Plugin Connector SPIKE #14795

Closed jrainville closed 21 hours ago

jrainville commented 1 month ago

Description

Spike to investigate the different ways that we can connect the Status app and a browser plugin.

Acceptance Criteria

kounkou commented 3 weeks ago

Connector implementation

Status : draft Reviewers : cammellos@ MishkaRogachev@

Context

Status is building a Browser plugin that serves as a cryptocurrency wallet and gateway to blockchain applications. It primarily interacts with the Ethereum blockchain but supports other networks as well. To achieve the creation of the Browser plugin, Desktop core team will be involved in creating a Connector that will connect Status-go and the Browser plugin by exposing the Wallet API’s. Here are proposals for implementing the solution.

Requirements

Proposal

Sequence Diagram for the interactions

sequenceDiagram
    participant User
    participant BrowserPlugin
    participant Connector
    participant StatusApp

    User->>BrowserPlugin: Connect Wallet to dApp

    BrowserPlugin->>Connector: Send RPC request

    alt Connector crash
        BrowserPlugin->>Connector: Retry Policy Send RPC request + publicKey
    end

    Connector->>StatusApp: Trigger user authentication popup
    StatusApp->>User: Show authentication popup
    User->>StatusApp: Authenticate

    alt Connector crash
        BrowserPlugin->>Connector: Retry Policy Establish WebSocket connection with token
    end

    BrowserPlugin->>Connector: Establish WebSocket connection
    BrowserPlugin->>Connector: Send API calls over WebSocket
    Connector->>StatusApp: forward API calls to StatusApp

    alt Connector crash
        BrowserPlugin->>Connector: Retry Policy Establish WebSocket connection with token
    end

    StatusApp->>StatusApp: Lost network connection
    StatusApp->>Connector: Status App offline
    Connector->>BrowserPlugin: Status App offline

1. Websock handover

In this proposal the flow looks like the following

  1. when launching Status app, we launch the connector and RPC server
  2. user clicks on Connect Wallet to dApp in the browser plugin
  3. Browser plugin will send a request to Connector
  4. if the Status app is running, this will trigger a popup to authenticate the user (Here a request was sent through RPC, I mean the curl command sent by Browser plugin).
  5. the status desktop will answer with success or failure
  6. If success, Browser plugin will then establish WS connection to allow for sending signals without prior api call from the browser plugin but also other API calls.

From there :

pros:

cons:


2. Plan

Obsolete tracker

Task Description Task points Team Ticket dependency State
Spike ticket Spike ticket na backend https://github.com/status-im/status-desktop/issues/14795 na in progress
Implement the capacity to trigger Connection request Popup Implement the capacity to trigger Connection request Popup na backend https://github.com/status-im/status-desktop/issues/15179 https://github.com/status-im/status-desktop/issues/14688 https://github.com/status-im/status-desktop/issues/15171 blocked by https://github.com/status-im/status-desktop/issues/14688
Implement the capacity to trigger signing a request popup Implement the capacity to trigger signing a request popup na backend https://github.com/status-im/status-desktop/issues/15182 https://github.com/status-im/status-desktop/issues/14762 https://github.com/status-im/status-desktop/issues/15172 blocked by https://github.com/status-im/status-desktop/issues/14762
Implement capacity to share Status desktop running status to client Implement capacity to share Status desktop running status to client na backend https://github.com/status-im/status-desktop/issues/15197 na na

Other proposals


3. Questions

MishkaRogachev commented 21 hours ago

I think we can close this issue with https://github.com/status-im/status-desktop/pull/15168