# planet-nine-app/sessionless architecture

> Architecture diagram of the GitHub repository planet-nine-app/sessionless, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/planet-nine-app/sessionless
- Repository: https://github.com/planet-nine-app/sessionless

## Overview

##### Main Components

a. Core Protocol Layer
- Authentication Protocol Engine
- Cryptographic Operations Module (secp256k1)
- Key Management System
- UUID Generation Service

b. Implementation Layers
- Client-side Implementations (Multiple Languages)
- Server-side Implementations (Multiple Languages)
- Platform-specific Secure Storage Systems

##### Key Relationships to Highlight

a. Client-Server Communication Flow
**[Client] ←→ [Transport Layer] ←→ [Server]**
- ↓             ↓                ↓
**[Key Gen]    [Protocol]     [Verification]**

**┌─────────────────────────────────────────────────────┐**
- Sessionless Protocol                 │
- ┬─────────────────┬─────────────────┤
- Client Side   │  Core Protocol  │   Server Side   │

- ┌─────────────┐ │ ┌─────────────┐ │ ┌─────────────┐ │
- Generate Keys│ │ │  Protocol   │ │ │   Verify    │ │
- Module    │ │ │   Layer     │ │ │  Signature  │ │
- ┘ │ └─────────────┘ │ └─────────────┘ │

- ┌─────────────┐ │ ┌─────────────┐ │ ┌─────────────┐ │
- Sign     │ │ │Cryptographic│ │ │  Generate   │ │
- Module    │ │ │   Engine    │ │ │    UUID     │ │
- ┘ │ └─────────────┘ │ └─────────────┘ │

- ┌─────────────┐ │ ┌─────────────┐ │ ┌─────────────┐ │
- Optional   │ │ │   Storage   │ │ │ Association │ │
- Methods   │ │ │  Interface  │ │ │   Service   │ │
- ┘ │ └─────────────┘ │ └─────────────┘ │
- ┴─────────────────┴─────────────────┘

##### Implementation Details

a. Supported Languages Layer
**┌─────────────────────────────────────┐**
- Language Implementations     │
- ┬───────────┬────────────┤
- JavaScript │   Rust    │   Python   │
- TypeScript │   Java    │   Swift    │
- C#      │  Kotlin   │    C++     │
- ┴───────────┴────────────┘

##### Additional Elements

- Version information
- Security boundaries
- Where personally identifying information is NOT stored/transmitted

##### Documentation References
- Link to relevant documentation sections
- API method references
- Platform-specific considerations

- No shared secrets
- No PII transmission
- Transport agnosticism
- Platform independence
- Cryptographic foundations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Protocol["Sessionless Protocol"]
        subgraph Client["Client Side"]
            KeyGen["Generate Keys Module"]:::client
            Sign["Sign Module"]:::client
            OptMethods["Optional Methods"]:::client
            Storage["Secure Storage"]:::client
        end

        subgraph Core["Core Protocol"]
            ProtocolLayer["Protocol Layer"]:::core
            CryptoEngine["Cryptographic Engine"]:::core
            StorageInterface["Storage Interface"]:::core
        end

        subgraph Server["Server Side"]
            Verify["Verify Signature"]:::server
            UUID["Generate UUID"]:::server
            Association["Association Service"]:::server
        end

        subgraph Languages["Language Implementations"]
            JS["JavaScript/TypeScript"]:::lang
            Rust["Rust"]:::lang
            Python["Python"]:::lang
            Kotlin["Kotlin"]:::lang
            Swift["Swift"]:::lang
            CPP["C++"]:::lang
            CSharp["C#"]:::lang
        end
    end

    %% Relationships
    KeyGen --> Sign
    Sign --> ProtocolLayer
    ProtocolLayer --> CryptoEngine
    CryptoEngine --> Verify
    StorageInterface --> Storage
    Verify --> UUID
    UUID --> Association

    %% Click events
    click ProtocolLayer "https://github.com/planet-nine-app/sessionless/blob/main/src/rust/crate/src/lib.rs"
    click JS "https://github.com/planet-nine-app/sessionless/blob/main/src/javascript/node/sessionless.js"
    click Kotlin "https://github.com/planet-nine-app/sessionless/blob/main/src/kotlin/standalone/sessionless/src/main/kotlin/com/planetnine/sessionless/impl/Sessionless.kt"
    click CryptoEngine "https://github.com/planet-nine-app/sessionless/blob/main/src/kotlin/standalone/sessionless/src/main/kotlin/com/planetnine/sessionless/util/hashKeccak256.kt"
    click CPP "https://github.com/planet-nine-app/sessionless/blob/main/src/cpp/client/lib/src/sessionless.cpp"
    click Storage "https://github.com/planet-nine-app/sessionless/blob/main/src/kotlin/standalone/sessionless/src/main/kotlin/com/planetnine/sessionless/impl/KeyStoreVault.kt"
    click CSharp "https://github.com/planet-nine-app/sessionless/blob/main/src/csharp/Sessionless/Impl/Vault.cs"
    click Swift "https://github.com/planet-nine-app/sessionless/blob/main/src/swift/client-ios/Sessionless/Sessionless/Classes/Sessionless.swift"

    %% Styles
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef server fill:#2ecc71,stroke:#27ae60,color:white
    classDef core fill:#f1c40f,stroke:#f39c12,color:black
    classDef lang fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        Client_L["Client Components"]:::client
        Server_L["Server Components"]:::server
        Core_L["Core Components"]:::core
        Lang_L["Language Support"]:::lang
    end
```
