Skip to content

QR Code Share Token — Generation Flow

Scope: Shows the current iOS QR generation path. The client requests an opaque backend token, renders {SHARE_URL}/contact/{token}?aid={APP_STORE_ID}, and uses expiresIn only for display text.

flowchart TD
    classDef client fill:#E0F2FE,stroke:#0284C7,color:#0369A1,stroke-width:2px;
    classDef server fill:#D1FAE5,stroke:#059669,color:#047857,stroke-width:2px;
    classDef state fill:#F3F4F6,stroke:#9CA3AF,color:#374151;

    subgraph Client ["iOS Client (My QR Code Screen)"]
        Start(["👤 User opens My QR Code tab"]):::client --> APICall("POST /app/api/share-token"):::client
    end

    subgraph Server ["Backend / Token Service"]
        APICall --> AuthCheck{"Verify Session"}:::server
        AuthCheck -->|Valid| GenString["Generate opaque token"]:::server
        GenString --> SaveDB[("Persist token<br/>backend-controlled policy")]:::server
        SaveDB --> Response(["{ token, expiresIn? }"]):::server
    end

    subgraph Present ["UI Display"]
        Response --> BuildDL["Create DeepLink URL<br/>{SHARE_URL}/contact/{token}?aid={APP_STORE_ID}"]:::state
        BuildDL --> RenderQR["Render QR Code image from URL"]:::client
        BuildDL --> CopyBtn["Copy Link / Share Button"]:::client
    end