14 Diagrams
Nex8192 edited this page 2025-11-24 13:51:35 +01:00

Diagrams

Software architecture

flowchart LR
    Backend-- json/HTTP (login) ---Frontend
    Backend-- protobuf/WebSocket ---Frontend
    CDN-- octet-stream/HTTP ---Frontend
    DB-- SQL ---Backend
    DB-- SQL ---CDN

Flow

Authentication

Register (REST)

sequenceDiagram
    User->>Frontend: type a master password
    Frontend->>Frontend: generate key pair
    Frontend->>Frontend: encrypt private key with password
    Frontend->>Backend: send public key
    Backend->>DB: store public key

Login (REST)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant DB
    Frontend->>Backend: start auth
    Backend->>Backend: generate random nonce
    Backend->>DB: store nonce
    Backend->>Frontend: ask signature of nonce
    Frontend->>User: ask for master password
    User->>Frontend: type the master password
    Frontend->>Frontend: decrypt private key and sign
    Frontend->>Backend: send signature
    Backend->>DB: get nonce and public key
    Backend->>Backend: check nonce signature
    Backend->>Backend: generate session token with expiration date
    Backend->>DB: store token
    Backend-->>Frontend: send token (HTTP Cookie)    

Notes:

  • If the client still has a session token it will be reused, bypassing this entirely
  • The session expiration date is extended while the user uses it (TODO: how?)

Create a new session (REST)

sequenceDiagram
    participant User
    participant First Frontend
    participant Second Frontend
    participant Backend
    participant DB
    First Frontend->>Backend: add a session
    Backend->>Backend: generate session transfer token
    Backend->>DB: store token
    Backend-->>First Frontend: send token
    First Frontend-->>First Frontend: show token

    First Frontend->>Second Frontend: send token
    User->>Second Frontend: type a master password
    Second Frontend->>Second Frontend: generate key pair
    Second Frontend->>Second Frontend: encrypt private key with password
    Second Frontend->>Backend: send public key + token
    Backend->>DB: store public key

Send message

sequenceDiagram
    Frontend->>Backend: text, medias, guild, channel
    Backend->>DB: message + timestamp + sender
    Backend-->>Frontend: send to guild members