# andreaskarageorgos/itch.io-licensing-for-unity architecture

> Architecture diagram of the GitHub repository andreaskarageorgos/itch.io-licensing-for-unity, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andreaskarageorgos/itch.io-licensing-for-unity
- Repository: https://github.com/andreaskarageorgos/itch.io-licensing-for-unity

## Overview

This Unity integration gates game access through itch.io ownership verification, then uses an encrypted, machine-bound license for offline launches and periodic rechecks. The principal flow is coordinated by ItchOwnershipCheck; license persistence and validation live in ItchLicenseCache. The README also documents per-project secret generation and the player-facing setup. Some login and recheck internals are only partially excerpted, so the graph avoids asserting finer-grained calls than the excerpts or README support.

Main entry points: [`ItchLicenseCache.cs`](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs) (License validation), [`ItchOwnershipCheck.cs`](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs) (Access controller), [`ItchSecrets.cs`](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchSecrets.cs) (Generated secrets), [`ItchLicenseConfig.cs`](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseConfig.cs) (Offline duration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Game access"]
  node_access_check["Access controller"]
  node_game_state["Game access state"]
  node_quiet_checks["Quiet rechecks"]
end

subgraph group_login["Online verification"]
  node_itch_browser["itch.io login"]
  node_callback_server["Local callback"]
  node_ownership_api["Ownership API"]
  node_developer_check["Developer check"]
end

subgraph group_license["Offline license"]
  node_license_cache["License validation"]
  node_license_crypto["License cryptography"]
  node_license_store[("License file")]
  node_hardware_id["Hardware identity"]
end

subgraph group_setup["Project configuration"]
  node_license_config["Offline duration"]
  node_project_strings["Project settings<br/>[ItchStrings.cs]"]
  node_secrets["Generated secrets<br/>[ItchSecrets.cs]"]
  node_secret_generator["Secrets generator"]
end

node_player(("Player"))
node_game["Unity game"]

node_player -->|"starts game"| node_access_check
node_access_check -->|"checks license"| node_license_cache
node_access_check -->|"starts login listener"| node_callback_server
node_callback_server -->|"opens login"| node_itch_browser
node_itch_browser -->|"returns token"| node_callback_server
node_access_check -->|"checks ownership"| node_ownership_api
node_ownership_api -->|"returns ownership"| node_access_check
node_access_check -->|"saves license"| node_license_cache
node_access_check -->|"checks developer"| node_developer_check
node_access_check -->|"sets access"| node_game_state
node_game -->|"runs during play"| node_quiet_checks
node_quiet_checks -->|"rechecks license"| node_license_cache
node_quiet_checks -->|"delays lockout"| node_game_state
node_game -->|"verifies later scenes"| node_license_cache
node_license_cache -->|"reads and writes"| node_license_store
node_license_cache -->|"validates and encrypts"| node_license_crypto
node_license_cache -->|"binds to device"| node_hardware_id
node_license_cache -->|"reads expiry"| node_license_config
node_license_cache -->|"reads file settings"| node_project_strings
node_license_config -->|"loads settings"| node_secrets
node_project_strings -->|"loads values"| node_secrets
node_secret_generator -->|"generates local values"| node_secrets
node_player -->|"logs in"| node_itch_browser

click node_access_check "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs"
click node_game_state "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs"
click node_quiet_checks "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs"
click node_callback_server "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs"
click node_developer_check "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs"
click node_license_cache "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs"
click node_license_crypto "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs"
click node_hardware_id "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs"
click node_license_config "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseConfig.cs"
click node_project_strings "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchStrings.cs"
click node_secrets "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchSecrets.cs"
click node_secret_generator "https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/Editor/ItchSecretsGenerator.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_access_check,node_game_state,node_quiet_checks toneBlue
class node_itch_browser,node_callback_server,node_ownership_api,node_developer_check toneAmber
class node_license_cache,node_license_crypto,node_license_store,node_hardware_id toneMint
class node_license_config,node_project_strings,node_secrets,node_secret_generator toneRose
class node_player,node_game toneIndigo
```

## Components

### Game access

- [Access controller](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs): `ItchOwnershipCheck.cs`
- [Game access state](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs): `ItchOwnershipCheck.cs`
- [Quiet rechecks](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs): `ItchOwnershipCheck.cs`

### Online verification

- **itch.io login**
- [Local callback](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs): `ItchOwnershipCheck.cs`
- **Ownership API**
- [Developer check](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchOwnershipCheck.cs): `ItchOwnershipCheck.cs`

### Offline license

- [License validation](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs): `ItchLicenseCache.cs`
- [License cryptography](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs): `ItchLicenseCache.cs`
- **License file**
- [Hardware identity](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseCache.cs): `ItchLicenseCache.cs`

### Project configuration

- [Offline duration](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchLicenseConfig.cs): `ItchLicenseConfig.cs`
- [Project settings](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchStrings.cs): `ItchStrings.cs`
- [Generated secrets](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/ItchSecrets.cs): `ItchSecrets.cs`
- [Secrets generator](https://github.com/andreaskarageorgos/itch.io-licensing-for-unity/blob/main/Editor/ItchSecretsGenerator.cs): `Editor/ItchSecretsGenerator.cs`

### Other components

- **Player**
- **Unity game**

## Connections

- Player → Access controller: starts game (evidence: `README.md`)
- Access controller → License validation: checks license (evidence: `ItchOwnershipCheck.cs`)
- Access controller → Local callback: starts login listener (evidence: `ItchOwnershipCheck.cs`)
- Local callback → itch.io login: opens login (evidence: `README.md`)
- itch.io login → Local callback: returns token (evidence: `README.md`)
- Access controller → Ownership API: checks ownership (evidence: `ItchOwnershipCheck.cs`)
- Ownership API → Access controller: returns ownership (evidence: `ItchOwnershipCheck.cs`)
- Access controller → License validation: saves license (evidence: `ItchOwnershipCheck.cs`)
- Access controller → Developer check: checks developer (evidence: `ItchOwnershipCheck.cs`)
- Access controller → Game access state: sets access (evidence: `README.md`)
- Unity game → Quiet rechecks: runs during play (evidence: `README.md`)
- Quiet rechecks → License validation: rechecks license (evidence: `ItchOwnershipCheck.cs`)
- Quiet rechecks → Game access state: delays lockout (evidence: `ItchOwnershipCheck.cs`)
- Unity game → License validation: verifies later scenes (evidence: `README.md`)
- License validation → License file: reads and writes (evidence: `ItchLicenseCache.cs`)
- License validation → License cryptography: validates and encrypts (evidence: `ItchLicenseCache.cs`)
- License validation → Hardware identity: binds to device (evidence: `ItchLicenseCache.cs`)
- License validation → Offline duration: reads expiry (evidence: `ItchLicenseCache.cs`)
- License validation → Project settings: reads file settings (evidence: `ItchLicenseCache.cs`)
- Offline duration → Generated secrets: loads settings (evidence: `ItchLicenseConfig.cs`)
- Project settings → Generated secrets: loads values (evidence: `ItchStrings.cs`)
- Secrets generator → Generated secrets: generates local values (evidence: `README.md`)
- Player → itch.io login: logs in (evidence: `README.md`)
