Skip to content

Wallet Gateway

Alex Matson edited this page Aug 5, 2026 · 5 revisions

Wallet Gateway Remote

The remote wallet gateway has a backend (nodejs+express) and a user management frontend (web components). The frontend, aka User UI, is opened as a separate browser popup window when used with a 3rd-party dApp.

Window Communication

The User UI and dApp UI, once connected, send window message events to each other to share session state, provide user interaction updates, and so on.

sequenceDiagram
    autonumber

    participant D1 as Dapp A UI<br/>(Browser)
    participant D2 as Dapp B UI<br/>(Browser)
    participant WG1 as WG UI A<br/>(Popup)
    participant WG2 as WG UI B<br/>(Popup)
    participant BE as WG Backend

    rect rgb(238, 242, 255)
        Note over D1,WG1: Dapp A establishes an independent session
        D1->>WG1: Open WG UI popup
        D1->>WG1: window.postMessage({ origin: Dapp A })
        WG1-->>D1: Origin acknowledgement
        WG1->>BE: Create or resume session for Dapp A
        BE-->>WG1: Session A
        WG1-->>D1: Connected with Session A
    end

    rect rgb(240, 253, 250)
        Note over D2,WG2: Dapp B establishes a separate session
        D2->>WG2: Open WG UI popup
        D2->>WG2: window.postMessage({ origin: Dapp B })
        WG2-->>D2: Origin acknowledgement
        WG2->>BE: Create or resume session for Dapp B
        BE-->>WG2: Session B
        WG2-->>D2: Connected with Session B
    end

    Note over BE: Session A and Session B are unique and isolated

    rect rgb(255, 247, 237)
        Note over D1,BE: Authentication actions remain scoped to each dapp session
        D1->>WG1: Login
        WG1->>BE: Login using Session A
        BE-->>WG1: Authenticated Session A
        WG1-->>D1: Login successful

        D2->>WG2: Connect
        WG2->>BE: Connect using Session B
        BE-->>WG2: Connected Session B
        WG2-->>D2: Connect successful

        D1->>WG1: Logout
        WG1->>BE: Logout Session A
        BE-->>WG1: Session A unauthenticated
        WG1-->>D1: Logout successful

        Note over D2,BE: Dapp B remains connected and authenticated state is unaffected

        D2->>WG2: Disconnect
        WG2->>BE: Disconnect Session B
        BE-->>WG2: Session B disconnected
        WG2-->>D2: Disconnect successful
    end
Loading

Clone this wiki locally