@inoku/lepan 0.0.1 → 0.7.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # LePan / LifeDrive Installer
2
+
3
+ This public repository contains versioned LifeDrive installation assets built from the private LifeAlbum source repository.
4
+
5
+ For an ordinary Windows or macOS installation, download the matching package from LePan's Cloudflare-backed download URLs:
6
+
7
+ - **Windows 10/11 or Windows Server (x64):** [LePan-Setup-windows-x64.exe](https://lepan.org/download/LePan-Setup-windows-x64.exe)
8
+ - **Mac with Apple silicon:** [LePan-Setup-macos-arm64.pkg](https://lepan.org/download/LePan-Setup-macos-arm64.pkg)
9
+ - **Mac with an Intel processor:** [LePan-Setup-macos-x64.pkg](https://lepan.org/download/LePan-Setup-macos-x64.pkg)
10
+
11
+ The native packages contain a private Node.js runtime used only by LePan Setup. They do not install Node.js system-wide or replace an existing Node.js installation. Windows asks for Administrator approval. macOS installs **LePan Setup** in Applications, opens Terminal, and asks for an administrator password when registering background services and allowing Leither through the Application Firewall. Follow the on-screen prompts to choose storage and create the first mobile invitation.
12
+
13
+ **New to LifeDrive?** Read the [user manual](USER_MANUAL.md): installing and upgrading a node, users and devices, and what to do when a device or an identity is lost.
14
+
15
+ ## Command-line installation
16
+
17
+ Linux users and experienced Mac users can install Node.js 18 or later and run:
18
+
19
+ ```bash
20
+ npx --yes @inoku/lepan
21
+ ```
22
+
23
+ The npm package supports Linux and macOS on Apple Silicon/ARM64 and Intel/AMD64, plus native x64 Windows. Run it as your normal user on Linux/macOS or from an Administrator Windows Terminal on Windows. Fresh setup installs and starts Leither when it is missing. WSL, Git Bash, Homebrew, and third-party Windows service wrappers are not required. A fresh Windows node defaults to
24
+ `%ProgramData%\LifeDrive\Leither`, uses the native official x64 Leither build,
25
+ and activates household users during installation.
26
+
27
+ To upgrade an existing key-auth installation without changing its authorized devices, public address, or drive data, run:
28
+
29
+ ```bash
30
+ npx --yes @inoku/lepan@latest --upgrade
31
+ ```
32
+
33
+ The installer reuses a running Leither node and finds its directory automatically. If none is running, Linux/macOS fresh setup first looks for Leither in the selected directory, the current directory, or on `PATH`; otherwise it uses `~/.local/share/lifedrive/leither`. Windows uses `%ProgramData%\LifeDrive\Leither` unless `--leither-root` selects another directory. It downloads the matching binary from the [official Leither distribution](http://vzhan.cn/#start.html), verifies its SHA-256 checksum, initializes local configuration and keys, installs boot startup, and waits for the managed process and local version endpoint before continuing. Existing executables, configuration, and keys are never replaced.
34
+
35
+ When the installer creates a new node, it shows the free space on the selected drive and asks how many whole decimal gigabytes Leither may use. The default is **100 GB**. This is a node-wide maximum covering LePan and every other application stored by that Leither node; it does not reserve or preallocate the space. The installer refuses a value larger than the space currently available and saves the choice before Leither first starts. For unattended setup, pass `--storage-max-gb GB` or set `LIFEDRIVE_STORAGE_MAX_GB`. Existing nodes and upgrades keep their current limit; change those from LePan Settings.
36
+
37
+ Choose another empty directory for a fresh node, select a stopped node, or select among multiple running instances:
38
+
39
+ ```bash
40
+ npx --yes @inoku/lepan --leither-root /path/to/leither
41
+ ```
42
+
43
+ For example, create a fresh node with a 250 GB maximum:
44
+
45
+ ```bash
46
+ npx --yes @inoku/lepan --leither-root /path/to/leither --storage-max-gb 250
47
+ ```
48
+
49
+ Use `--no-install-leither` to require an already running node. Upgrades always require a running node and never install or start Leither. The legacy browser-device management options remain Linux/macOS-only; Windows uses household management from a paired phone. A nonempty directory without a Leither executable is left untouched. New nodes use port 4800 by default; a port conflict stops setup with instructions. Leither V0.24.11 or newer is required; older existing nodes must be upgraded separately.
50
+
51
+ ### Leither starts automatically at boot
52
+
53
+ Fresh setup installs boot startup and crash recovery. Linux/macOS request `sudo`
54
+ to run Leither as the invoking account through systemd or a system
55
+ LaunchDaemon. Windows uses a SYSTEM Scheduled Task and grants that task access
56
+ to the selected node directory. Every platform sets the working directory and
57
+ runs `Leither run` in the foreground so the manager can supervise it directly.
58
+
59
+ | Platform | Service definition | Status and logs |
60
+ |---|---|---|
61
+ | Linux | `/etc/systemd/system/lifedrive-leither.service` | `systemctl status lifedrive-leither.service`; `journalctl -u lifedrive-leither.service` |
62
+ | macOS | `/Library/LaunchDaemons/uk.inoku.leither.plist` | `sudo launchctl print system/uk.inoku.leither`; `<Leither root>/leither-service.log` |
63
+ | Windows | Task Scheduler: `LifeDrive Leither` | Task Scheduler history; `Get-ScheduledTask -TaskName "LifeDrive Leither"` |
64
+
65
+ To configure only Leither's startup without changing LifeDrive files:
66
+
67
+ ```bash
68
+ npx --yes @inoku/lepan --leither-service --leither-root /path/to/leither
69
+ ```
70
+
71
+ Run this as the node's normal user, not with `sudo npx`; on Windows, use an Administrator terminal. It can enable an already running service installed by this package without restarting it. A process started manually or by another service manager is left untouched: keep that manager, or stop it in a maintenance window and disable its old boot registration before adopting the package's service. A service/task definition with different settings or another node/account is never overwritten. Normal LifeDrive upgrades do not restart Leither. Systems without systemd can supply a running node through their own manager and use `--no-install-leither`.
72
+
73
+ The npm package contains the versioned installer, checksum, and LifeDrive bundle. The Windows and macOS packages contain the same payload plus a checksum-verified Node.js 22 runtime from nodejs.org. After the package is downloaded, LifeDrive's files do not depend on GitHub's release-asset network. Installing a missing Leither runtime additionally needs access to `vzhan.cn`. Its official distribution currently uses HTTP with a same-source checksum; that checksum detects corrupt downloads and is not an authenticated signature. If npm is unavailable on Linux/macOS, use the GitHub release bootstrap directly (Node.js is still required):
74
+
75
+ ```bash
76
+ curl -fLO https://github.com/cfa532/lifedrive-installer/releases/latest/download/lifedrive-install.sh
77
+ chmod +x lifedrive-install.sh
78
+ ./lifedrive-install.sh
79
+ ```
80
+
81
+ The bootstrap verifies `lifedrive-bundle.tar.gz` against its SHA-256 file, installs it below the detected Leither root, and runs the interactive terminal setup. The npm launcher reads those assets from its own package; the standalone bootstrap downloads them from the matching GitHub Release. All installer options after the npm package name pass through to that bootstrap.
82
+
83
+ The Linux/macOS legacy browser-owner setup uses the built-in AV1 registration endpoint and does not ask users for a service URL, AV1 login, or developer-issued code. Windows skips that shell-only flow and uses household pairing.
84
+
85
+ LifeDrive requires Leither V0.24.11 or newer. Linux/macOS browser-owner setup creates a separate Ed25519 `sodiumv2` identity for the primary browser. Windows prints a private ten-minute invitation for the first paired phone; later users and devices are managed from a paired device.
86
+
87
+ An existing installation is backed up before replacement. The explicit `--upgrade` path requires the saved application and key-auth owner state before changing files, synchronizes the same published application MID, and does not rerun device or domain setup. This release intentionally does not migrate the earlier password-owner prototype. Application files are active only after Leither advances the application from `cur` to `last`; a publication timeout leaves the prior `last` version serving users.
88
+
89
+ Source code and design documentation are maintained separately. No device key, identity bundle, PPT, publisher key, or node-specific application MID is included in these release assets.
90
+
91
+ ## Household users
92
+
93
+ This release includes the household identity service for Linux, macOS, and x64 Windows. Existing installations retain their application MID. On Linux/macOS, an ordinary `--upgrade` installs the service files but does not automatically activate household mode. Fresh Windows setup uses household mode by default because the legacy browser-owner tools are shell-only.
94
+
95
+ Household activation uses the existing Leither node address. On Linux/macOS, run the matching release with `--upgrade --household`. Windows performs the same private configuration and invitation flow during fresh setup. No additional public hostname or TLS certificate is required. On iPhone or Android, use Settings → Set up users. Each user starts with an empty personal drive; older files are not imported.
96
+
97
+ On Windows, Task Scheduler entries named `LifeDrive Leither` and
98
+ `LifeDrive Identity` run as SYSTEM at startup with their working directories set
99
+ to the selected Leither root. Setup also adds a Windows Firewall rule for the
100
+ configured Leither port. The loopback identity port 4811 is not opened publicly.
101
+
102
+ On macOS, setup registers the selected Leither executable with the Application
103
+ Firewall, allows incoming connections, and verifies the rule. The system's
104
+ **Block all incoming connections** setting and managed firewall policy can still
105
+ override that application rule. Setup also installs
106
+ `/Library/LaunchDaemons/uk.inoku.lifedrive-identity.plist`. The identity service runs as your Leither account, starts at boot, and remains running after Terminal closes or you log out. Leither must also be running for LifeDrive to work. Logs are stored in `<Leither root>/.lifedrive-household/identity.log`. Stop any previously started foreground identity service before activating the daemon. The advanced `--household-config` option continues to print a manual start command for custom configurations. Router port forwarding remains a separate manual step.
107
+
108
+ The shared browser URL remains `http://drive.lepan.org/?n=<node-id>`. Native identities persist; a paired browser stays signed in until it goes seven days without use. Direct setup requires Leither to enforce private MiMei access and stops if its checks cannot confirm that. See the source deployment notes for the HTTP transport limitations.
109
+
110
+ Once synchronized, Leither follows new publications of the same application MID. The household browser also loads that published application. Updates to the separate identity-service executable require another npm upgrade; the Windows upgrader restarts only its identity task, while Linux/macOS operators restart their identity service. The installer never restarts Leither. Install mobile application updates separately.
111
+
112
+ After upgrading on macOS, restart only the identity service:
113
+
114
+ ```bash
115
+ sudo launchctl kickstart -k system/uk.inoku.lifedrive-identity
116
+ sudo launchctl print system/uk.inoku.lifedrive-identity
117
+ curl --fail http://127.0.0.1:4811/health
118
+ ```
119
+
120
+ ## iPhone photo backup with your own domain
121
+
122
+ The photo HTTPS helper supports a domain controlled by the node owner. Use a
123
+ release whose `lifedrive-identity/setup-photo-https.sh --help` lists `--domain`.
124
+ Automatic certificate management is built into the identity service on Linux
125
+ and macOS; nginx, Certbot and DNS-provider credentials are not required. It is
126
+ separate from ordinary household pairing and backup.
127
+
128
+ Create a dedicated A record, such as `photos.example.com`, pointing to the node's
129
+ public IPv4 address. Any DNS provider is supported; on Cloudflare use **DNS only**.
130
+ Public TCP port 443 must reach the identity service's private photo listener.
131
+ The default router mapping is WAN 443 → node 8443. Port 80 is not needed.
132
+ Carrier-grade NAT requires a separately configured reachable endpoint or
133
+ TLS pass-through tunnel; creating DNS does not provide connectivity.
134
+
135
+ Wait until at least one iPhone is paired with the node and its owner intends to
136
+ enable photo sync before creating this record. Node installation and pairing do
137
+ not enable iOS background photo upload. The app registers it only after explicit
138
+ Photos consent and a successful HTTPS readiness response from the paired node.
139
+
140
+ From the installed node's `lifedrive-identity` directory, run:
141
+
142
+ ```bash
143
+ bash setup-photo-https.sh --domain photos.example.com --agree-acme-terms
144
+ ```
145
+
146
+ On Windows, open an Administrator PowerShell in that directory and run:
147
+
148
+ ```powershell
149
+ .\setup-photo-https.ps1 -Domain photos.example.com -AgreeAcmeTerms
150
+ ```
151
+
152
+ The Windows helper opens only the private photo-listener port (8443 by default)
153
+ in Windows Firewall. The router must still forward public TCP 443 to that private
154
+ port. The ordinary Leither port remains separately forwarded; port 4811 and
155
+ public port 80 are not needed.
156
+
157
+ Replace the example hostname with yours and run the command as the Leither
158
+ account. This accepts Let's Encrypt's subscriber agreement, obtains a certificate
159
+ through TLS-ALPN-01 and enables automatic renewal. Use
160
+ `--photo-listen ADDRESS:PORT` only to change the default private listener. It restarts only
161
+ LifeDrive identity and verifies the trusted HTTPS endpoint. Leither is not
162
+ restarted. The ACME account and certificates stay in the private identity state;
163
+ none is included in the installer package.
164
+
165
+ The iPhone needs a LePan build containing the Photos background-upload extension
166
+ and iOS 26.5 or later. Open **Settings → Auto sync**, enable Photos with **Full
167
+ Access**, and check the photo-change backup status below **Wi-Fi only**. Paired
168
+ phones discover the address from their node; no address needs to be entered on
169
+ each phone. iOS decides when uploads run. File and Android backup use their
170
+ existing connection.
171
+
172
+ To change domains, finish pending uploads, point the new name at the node and
173
+ rerun the helper with that name. Reopen LePan on each phone after setup. The old
174
+ photo hostname is no longer served after successful activation; jobs already
175
+ queued to that address may require retries. The helper restores the previous
176
+ identity configuration if activation fails. Old DNS records and private ACME
177
+ cache entries are not deleted automatically.
package/USER_MANUAL.md ADDED
@@ -0,0 +1,399 @@
1
+ # LifeDrive User Manual
2
+
3
+ **Audience:** people who run a LifeDrive node, and the people who use it.
4
+ **Covers:** installing LifeDrive on a node, upgrading it, how identity works, and what to do when a device or an identity is lost.
5
+ **Current release:** 0.7.35 (`npm view @inoku/lepan version` shows the latest).
6
+
7
+ LifeDrive is a private drive that runs on your own Leither node. Your files stay on
8
+ that node; phones, tablets and browsers connect to it directly. There is no
9
+ LifeDrive account on the Internet and no password: each device holds its own key,
10
+ and a device you already trust approves every new one.
11
+
12
+ ---
13
+
14
+ ## 1. Before you start
15
+
16
+ A LifeDrive node needs:
17
+
18
+ | Requirement | Notes |
19
+ |---|---|
20
+ | A Linux, macOS, or Windows computer | Fresh setup installs Leither if missing, or reuses an existing node. Linux/macOS support AMD64 and ARM64; Windows uses the official x64 build. |
21
+ | Node.js 18 or later | Included privately in the Windows and macOS packages. Install it yourself only for the Linux or advanced macOS command-line method. |
22
+ | Platform tools | Linux/macOS use `bash`, `curl`, `tar`, and a SHA-256 tool. macOS also uses its built-in Application Firewall tool. Windows uses built-in Windows PowerShell, `tar.exe`, and Windows Firewall tools. |
23
+ | An appropriate account | Linux/macOS use the normal Leither account. macOS requests `sudo` for service and firewall registration. Windows setup must run from an Administrator terminal. |
24
+ | A startup manager | systemd on Linux, launchd on macOS, or Task Scheduler on Windows starts the node at boot and recovers it after crashes. |
25
+ | The LifeDrive app on your phone | iPhone or Android. The first user is created from a phone. |
26
+
27
+ LifeDrive never stops or restarts Leither. If more than one Leither node runs on
28
+ the machine, the installer lists them and asks you to choose one with
29
+ `--leither-root <directory>`.
30
+
31
+ ---
32
+
33
+ ## 2. Install LifeDrive on a node
34
+
35
+ ### 2.1 Install LifeDrive
36
+
37
+ For Windows or macOS, download the installer for the computer:
38
+
39
+ - Windows x64: [LePan-Setup-windows-x64.exe](https://lepan.org/download/LePan-Setup-windows-x64.exe)
40
+ - Mac with Apple silicon: [LePan-Setup-macos-arm64.pkg](https://lepan.org/download/LePan-Setup-macos-arm64.pkg)
41
+ - Mac with an Intel processor: [LePan-Setup-macos-x64.pkg](https://lepan.org/download/LePan-Setup-macos-x64.pkg)
42
+
43
+ On Windows, open the downloaded setup file and approve the Administrator prompt. On macOS, open the package; it installs **LePan Setup** in Applications and opens a Terminal window. Follow the prompts to choose the storage limit and create the first private mobile invitation. The package carries its own Node.js runtime and does not install or replace Node.js for other applications.
44
+
45
+ Linux users and experienced Mac users can instead install Node.js 18 or later and use Terminal. On the node, as the account that runs Leither:
46
+
47
+ ```bash
48
+ npx --yes @inoku/lepan@latest
49
+ ```
50
+
51
+ The same command also remains available from an Administrator Windows Terminal for advanced use. WSL and Git Bash are not required.
52
+
53
+ The installer finds an existing running Leither node. If none is running, it
54
+ reuses Leither in the selected directory, current directory, or `PATH`, or
55
+ downloads and verifies the official runtime for your machine. A new node is
56
+ created in `~/.local/share/lifedrive/leither` on Linux/macOS or
57
+ `%ProgramData%\LifeDrive\Leither` on Windows, initialized with its own private
58
+ keys, and prepared for automatic boot startup. Before starting the service,
59
+ setup shows the selected drive's available space and asks for the maximum space
60
+ Leither may use. Press Enter for the 100 GB default, or enter another whole
61
+ number of decimal gigabytes. The limit covers all data stored by that Leither
62
+ node, including LePan; it does not preallocate the space. Setup then starts the
63
+ service, waits for Leither's local version
64
+ endpoint, verifies the LifeDrive archive, installs LifeDrive and runs terminal
65
+ setup. Follow its prompts.
66
+
67
+ To choose another empty directory or start a stopped existing node:
68
+
69
+ ```bash
70
+ npx --yes @inoku/lepan@latest --leither-root "/path/to/leither"
71
+ ```
72
+
73
+ For unattended fresh setup, supply the limit explicitly:
74
+
75
+ ```bash
76
+ npx --yes @inoku/lepan@latest --leither-root "/path/to/leither" --storage-max-gb 100
77
+ ```
78
+
79
+ The selected maximum cannot exceed the space currently available on that drive.
80
+ The option applies only when the installer creates a new node. Existing nodes
81
+ and upgrades keep their current limit; an owner can change it later in LePan
82
+ Settings, after which Leither must be restarted.
83
+
84
+ Existing Leither files are never replaced. If a directory contains files but no
85
+ Leither executable, setup stops instead of initializing over them. Use
86
+ `--no-install-leither` to require a running node. Upgrades and device-management
87
+ commands always require a running node. An older existing Leither version must
88
+ be upgraded separately to V0.24.11 or newer.
89
+
90
+ Fresh Leither downloads require access to the [official distribution](http://vzhan.cn/#start.html).
91
+ Port 4800 must be available for a new node. On Linux, inspect startup with
92
+ `systemctl status lifedrive-leither.service` and
93
+ `journalctl -u lifedrive-leither.service`. On macOS, use
94
+ `sudo launchctl print system/uk.inoku.leither` and read
95
+ `<Leither root>/leither-service.log`. The service starts at boot and continues
96
+ after you log out. Run setup as your normal user, not with `sudo npx`; it will
97
+ request sudo for system service and macOS Application Firewall registration.
98
+ Setup adds Leither to the allowed incoming applications and verifies the rule.
99
+ The macOS **Block all incoming connections** option or a managed policy can still
100
+ override it. Router port forwarding remains a separate manual step.
101
+
102
+ On Windows, setup creates the `LifeDrive Leither` and `LifeDrive Identity`
103
+ Scheduled Tasks and an inbound Windows Firewall rule for Leither's configured
104
+ port. The identity control port 4811 stays loopback-only and needs no router or
105
+ firewall opening. Inspect startup with:
106
+
107
+ ```powershell
108
+ Get-ScheduledTask -TaskName "LifeDrive Leither", "LifeDrive Identity"
109
+ ```
110
+
111
+ To add boot startup to an existing node without changing LifeDrive files:
112
+
113
+ ```bash
114
+ npx --yes @inoku/lepan@latest --leither-service --leither-root "/path/to/leither"
115
+ ```
116
+
117
+ A service already installed by this package is enabled without restarting it.
118
+ If Leither is running manually or under another manager, setup leaves it alone.
119
+ Keep that manager, or stop the node during a maintenance window and disable its
120
+ old boot registration before running the service-only command. Existing service
121
+ definitions with different settings are not overwritten. Regular LifeDrive
122
+ upgrades do not change or restart Leither's service.
123
+
124
+ If a LifeDrive is already installed on this node, the installer stops and says so.
125
+ Use the upgrade in section 3 instead.
126
+
127
+ ### 2.2 Turn on users and mobile setup
128
+
129
+ Fresh Windows setup already performs this section and prints its invitation. On
130
+ Linux/macOS, or when enabling household users on an existing compatible node,
131
+ run:
132
+
133
+ Still on the node:
134
+
135
+ ```bash
136
+ npx --yes @inoku/lepan@latest --upgrade --household
137
+ ```
138
+
139
+ This keeps what step 2.1 installed and adds users and phones:
140
+
141
+ 1. Creates LifeDrive's private configuration in `<Leither root>/.lifedrive-household/`.
142
+ 2. Installs and starts the identity service: `lifedrive-identity` through systemd on Linux, `uk.inoku.lifedrive-identity` through launchd on macOS, or `LifeDrive Identity` through Task Scheduler on Windows. Leither itself is not restarted and must be running separately.
143
+ 3. Prints a **setup invitation**: a block of text, followed by
144
+ *"Keep the invitation above private. It expires in ten minutes."*
145
+
146
+ The setup invitation is what makes a phone the first user of this node. Treat it
147
+ like a key: do not post it, email it to others, or paste it anywhere public.
148
+
149
+ ### 2.3 Create the first user from your phone
150
+
151
+ Within ten minutes of the invitation being printed:
152
+
153
+ 1. Copy the whole invitation block from the terminal and send it to your phone, or copy it on a computer your phone shares a clipboard with.
154
+ 2. Open LifeDrive on the phone. The **Set up your LifeDrive** screen opens by itself (or open **Settings → Set up users**).
155
+ 3. Enter **Your name** and a name for this device.
156
+ 4. Tap **Paste node identity** (or **Choose identity file** if you saved the invitation as a file).
157
+
158
+ The phone creates its own device key, claims the node, and opens your new, empty
159
+ personal drive. You are now the node's first user and its **administrator**, and
160
+ this phone is a **device manager**.
161
+
162
+ You can close the setup screen without pairing to look around the app. Tapping an
163
+ empty page, or **Settings → Set up users**, opens it again.
164
+
165
+ ### 2.4 If setup is interrupted
166
+
167
+ | Situation | What to do |
168
+ |---|---|
169
+ | The invitation expired before you pasted it | On the node, stop the identity service (`sudo systemctl stop lifedrive-identity` on Linux, or `sudo launchctl bootout system/uk.inoku.lifedrive-identity` on macOS) and run the command from 2.2 again for a fresh invitation. |
170
+ | You pasted it, but the app lost its connection or was closed | Open the app on **the same phone** and paste **the same invitation** again. A claim that has started can finish after the ten minutes have passed. Do not delete the app or ask for a new invitation: that would abandon the phone's pending key. |
171
+ | Setup says the node already has users | The node has been claimed. Add further devices from **My devices** (section 4), not with a new setup invitation. |
172
+
173
+ ### 2.5 Check that the node is healthy
174
+
175
+ On the node:
176
+
177
+ ```bash
178
+ systemctl status lifedrive-identity # Linux: should be "active (running)"
179
+ sudo launchctl print system/uk.inoku.lifedrive-identity # macOS: should report state = running
180
+ curl -s http://127.0.0.1:4811/health # should print the service name and node ID
181
+ ```
182
+
183
+ ---
184
+
185
+ ## 3. Upgrade LifeDrive
186
+
187
+ Upgrading replaces the LifeDrive application and the identity service program.
188
+ **Users, device keys, files and backups are preserved.** Upgrading does not
189
+ restart Leither.
190
+
191
+ ### 3.1 Upgrade the node
192
+
193
+ On the node, as the account that runs Leither:
194
+
195
+ ```bash
196
+ npx --yes @inoku/lepan@latest --upgrade
197
+ ```
198
+
199
+ To install a specific release instead of the latest, name it, for example
200
+ `npx --yes @inoku/lepan@0.7.35 --upgrade`. Release versions are never reused,
201
+ so a version number always means the same files.
202
+
203
+ The installer saves the previous application files to a backup directory, prints
204
+ where, and then:
205
+
206
+ ```text
207
+ LifeDrive application and identity-service files updated. Household users and keys were preserved.
208
+ Restart only the LifeDrive identity service through its service manager to load the new binary.
209
+ ```
210
+
211
+ Then restart the identity service so the new program runs:
212
+
213
+ ```bash
214
+ sudo systemctl restart lifedrive-identity # Linux
215
+ systemctl status lifedrive-identity # confirm it is running again
216
+ ```
217
+
218
+ On macOS:
219
+
220
+ ```bash
221
+ sudo launchctl kickstart -k system/uk.inoku.lifedrive-identity
222
+ sudo launchctl print system/uk.inoku.lifedrive-identity
223
+ curl --fail http://127.0.0.1:4811/health
224
+ ```
225
+
226
+ If startup fails, inspect `<Leither root>/.lifedrive-household/identity.log`.
227
+ Custom configurations installed with `--household-config` still use the manual
228
+ start command printed during installation.
229
+
230
+ While the service restarts, apps show a connection error for a few seconds and
231
+ retry by themselves. Uploads and backups that were in progress resume.
232
+
233
+ ### 3.2 Upgrade the apps
234
+
235
+ Update LifeDrive on each phone from its app store or distribution channel as
236
+ usual. The browser client updates itself when the page is reloaded.
237
+
238
+ ---
239
+
240
+ ## 4. Identity: users, devices and invitations
241
+
242
+ ### 4.1 What LifeDrive keeps
243
+
244
+ | Thing | What it is |
245
+ |---|---|
246
+ | **Node** | Your Leither server. Its identity is fixed; its network address may change without affecting you. |
247
+ | **User** | A person with their own private drive on the node. Created once, from a phone. Users cannot see each other's files. |
248
+ | **Administrator** | The first user. Can invite other people to create their own users. Being administrator gives no access to other users' files. |
249
+ | **Device** | One phone, tablet, computer or browser signed in as a user. Each device has **its own key**, created on that device and never copied anywhere. |
250
+ | **Device manager** | A device allowed to approve new devices and remove devices. Phones and tablets are managers by default; a browser is not, unless a manager promotes it. |
251
+
252
+ Nothing in LifeDrive is protected by a password, and there is no "identity file"
253
+ that can sign you in on its own. Every invitation below only *asks* to join; a
254
+ device you already use has to approve.
255
+
256
+ ### 4.2 Add another of your own devices
257
+
258
+ On a device manager you already use:
259
+
260
+ 1. Open **Settings → My devices → Pair another device**.
261
+ 2. The app creates an invitation file (`lifedrive-user.identity.json`) and opens the share sheet. Send it to the new device with AirDrop, a messaging app, or save it to Files.
262
+ 3. On the new device, open LifeDrive, choose **Settings → Set up users**, enter a device name, and import the file (**Choose identity file**).
263
+ 4. The new device shows a **match code**. On the manager, open **My devices** (pull down to refresh if needed), check that the code shown there is the same, and tap **Approve this device**.
264
+
265
+ The new device opens the same drive. The invitation expires shortly after it is
266
+ created, and a copy of it cannot be used by anyone else once your new device has
267
+ used it.
268
+
269
+ ### 4.3 Sign in a browser
270
+
271
+ 1. On your phone, open **Settings → My devices → Pair a browser**. It shows the browser address for your node, with **Copy browser URL** and **Share browser URL**.
272
+ 2. Open that address in a browser on a computer connected to the same network. The page shows a QR code.
273
+ 3. On the phone, tap **Scan browser QR code**, scan the code, and approve.
274
+
275
+ The browser gets its own session. It stays signed in until it goes seven days
276
+ without being used, or until you remove it. A browser starts without device-manager
277
+ rights; a manager can grant them with **Allow device management** in My devices.
278
+
279
+ ### 4.4 Invite another person
280
+
281
+ Only the administrator can do this.
282
+
283
+ 1. **Settings → My devices → Invite another user** creates an invitation and opens the share sheet. Send it to the person.
284
+ 2. They install LifeDrive on their phone, open **Settings → Set up users**, enter their own name, and import the invitation.
285
+
286
+ They get their own empty drive. Nothing of yours is shared with them unless you
287
+ share a file or folder with a link.
288
+
289
+ ### 4.5 Manage devices
290
+
291
+ In **Settings → My devices** every device of your user is listed with its name,
292
+ type, status and last activity. A device manager can:
293
+
294
+ - **Rename** a device.
295
+ - **Remove access**: the device is signed out on its next request and can no longer read or change your drive. Files it had already downloaded stay on it.
296
+ - **Allow device management**: give a browser manager rights.
297
+ - **Forget**: delete the record of a device that has already lost access. This only tidies the list; it does not change anyone's access.
298
+
299
+ **Removal needs a replacement already in place.** The node refuses to remove a
300
+ device unless at least one *other* active phone (iPhone or Android) and one other
301
+ active device manager remain, and says *"pair a replacement mobile and device
302
+ manager first"*. This keeps you from locking yourself out, and it decides the
303
+ order of steps in section 5.
304
+
305
+ ### 4.6 Forget this identity on a device
306
+
307
+ **Settings → Forget this identity** deletes this device's key from the device. The
308
+ device is no longer signed in. Your drive and your other devices are unaffected.
309
+ To use the device again, pair it again as in 4.2 with an invitation from another
310
+ device you still use.
311
+
312
+ ---
313
+
314
+ ## 5. Recovering a lost identity
315
+
316
+ Your files live on the node, not on your phone. Losing a device does not lose
317
+ your drive. What you can lose is **the ability to sign in** — and that depends
318
+ on whether you still have another working device.
319
+
320
+ ### 5.1 You lost a device, and you still have another phone that is a device manager
321
+
322
+ This is the normal case, and you can fix it yourself right away.
323
+
324
+ 1. On the phone you still have, open **Settings → My devices**.
325
+ 2. Find the lost device and tap **Remove access**. From its next request, the lost device can no longer reach your drive.
326
+ 3. When you have a replacement, pair it with **Pair another device** (section 4.2).
327
+
328
+ Do this even if you expect to find the device again: pairing it again later takes
329
+ a minute.
330
+
331
+ If the lost device was your **only phone** and what you still have is a browser
332
+ or a computer, **Remove access** is refused until another phone is paired. Follow
333
+ 5.2.
334
+
335
+ ### 5.2 You lost your only phone, but a browser is still signed in
336
+
337
+ A browser can only approve new devices if it was given **Allow device management**
338
+ beforehand. If it was, the order matters, because the lost phone cannot be removed
339
+ while it is your only phone:
340
+
341
+ 1. In the browser, open **My devices → Pair another device** and save the invitation.
342
+ 2. Import it on the new phone (**Settings → Set up users → Choose identity file**) and approve the match code in the browser.
343
+ 3. Now remove the lost phone: **My devices → Remove access**.
344
+
345
+ Until step 3 the lost phone still has access, so do this as soon as you can.
346
+
347
+ If the browser was not a device manager, it can still read and download your
348
+ files, but it cannot approve a new phone. Continue with 5.3.
349
+
350
+ ### 5.3 You lost every device
351
+
352
+ There is no recovery code, recovery file or password to fall back on. The app
353
+ used to offer a recovery file; that option has been removed, because a file that
354
+ can restore an account on its own is as dangerous to lose as the account itself.
355
+
356
+ What remains true:
357
+
358
+ - **Your files are safe on the node.** Nothing is deleted when devices are lost.
359
+ - **Other users are unaffected.** Their drives and devices keep working.
360
+ - **Recovery needs the node operator.** Contact whoever runs the node.
361
+
362
+ For node operators: LifeDrive does not yet include a repair command that binds a
363
+ new device to an existing user. The setup invitation (`--household`) only works
364
+ on a node that has no users, so it cannot be used for this. Until the repair
365
+ command exists, recovering a user who has lost every device needs help from the
366
+ LifeDrive maintainers. Do not delete or edit `.lifedrive-household/` to try to
367
+ work around it: it holds every user's authority and the authorization journal.
368
+
369
+ ### 5.4 Prevent lockout
370
+
371
+ - **Pair at least two phones as device managers**, for example an iPhone and an Android phone, or your phone and a family member's old phone kept at home. (Tablets count as phones here only if they run the iPhone or Android app.) This alone turns every "lost device" into the easy case in 5.1.
372
+ - If you mainly use a computer, give its browser **Allow device management** so it can stand in for a lost phone.
373
+ - Remove access for a lost device as soon as you notice, from any device you still have.
374
+
375
+ ### 5.5 For node operators: protect the node's identity data
376
+
377
+ The directory `<Leither root>/.lifedrive-household/` holds each user's storage
378
+ authority, the device authorization journal, the node's transport key and staged
379
+ uploads that have not been committed yet.
380
+
381
+ - **Back it up** together with the Leither node's data. Without it, the drives on the node cannot be used by their owners even though the files still exist.
382
+ - **Keep it private.** Anyone with a copy holds every user's storage authority. Never put it in a shared folder, a public repository or an application bundle.
383
+ - **Do not restore an old copy over a running service** to undo a device removal: authorization only moves forward, and an old copy can re-open access that was deliberately removed.
384
+
385
+ ---
386
+
387
+ ## 6. Quick reference
388
+
389
+ | Task | Where |
390
+ |---|---|
391
+ | Install on a node | `npx --yes @inoku/lepan@latest`; Linux/macOS then run it with `--upgrade --household` |
392
+ | Upgrade a node | `npx --yes @inoku/lepan@latest --upgrade`; restart only identity if the platform installer does not do so |
393
+ | Check the node | Check the platform service/task and open `http://127.0.0.1:4811/health` locally |
394
+ | Create the first user | Phone: **Settings → Set up users → Paste node identity** |
395
+ | Add your own device | Existing device: **My devices → Pair another device**; new device: **Set up users → Choose identity file**; approve the match code |
396
+ | Sign in a browser | Phone: **My devices → Pair a browser**; open the address it shows; **Scan browser QR code** |
397
+ | Invite another person | Administrator: **My devices → Invite another user** |
398
+ | Lost a device | Another phone: **My devices → Remove access**, then pair a replacement. Lost your only phone: pair the replacement first (section 5.2) |
399
+ | Lost every device | Contact the node operator (section 5.3) |