# LegacyLock — Security Model

## What this product is
A **client-side encrypted digital legacy vault** for usernames, passwords, banking identifiers, legal document locations, social accounts, devices, wishes, and related steward instructions.

## Where the *app* can be hosted (safe)
The HTML/CSS/JS is just code. Host it like other Lidon tools:

| Host | Cost | Notes |
|------|------|--------|
| **DreamHost (planned)** | Existing plan | Fine for **code only** — see DreamHost notes below |
| GitHub Pages | Free | Fine for **code only** |
| Cloudflare Pages | Free | Fine for **code only** |
| Netlify | Free | Fine for **code only** |
| Open `index.html` offline | Free | Best for maximum privacy |

Hosting the app on a static host does **not** upload your vault contents.

## DreamHost — what changes vs GitHub Pages
**Short answer:** The encryption model does **not** change. Vault secrets still never go to DreamHost. What changes is **who can alter the app files** and a few hosting hygiene rules.

| Topic | Impact on DreamHost |
|-------|---------------------|
| Vault data location | Unchanged — browser localStorage / user-held encrypted backup only |
| NapWise / DoseClear / HomeSafe | Unchanged — still client-side only |
| HTTPS | **Required.** Serve all Lidon apps over `https://`. HTTP lets an attacker swap the JS and steal a passphrase on unlock. |
| Host / FTP / panel access | High value. Anyone who can edit `legacylock/app.js` on the server can ship malicious code. Protect DreamHost login + FTP/SFTP like a bank password; use SFTP, not plain FTP. |
| Web root hygiene | **Never** upload vault backups, exports, CSV password lists, or steward sheets into `public_html`. Those must stay off the server. |
| Directory listing | Keep off (`Options -Indexes` in `.htaccess`). |
| Shared hosting | Other sites on shared infra cannot read a visitor’s localStorage. They *could* matter only if your account/files are compromised. |
| Server databases / PHP forms | Do **not** add a DreamHost MySQL “vault table” or email form that receives secrets. Stay static for LegacyLock. |
| Analytics / WordPress plugins | Do not drop tracking scripts on LegacyLock pages. |

Use the included `.htaccess` files to force HTTPS, disable indexes, and set basic security headers.

## Where the *data* should live (critical)
| Place | Allowed? | Why |
|-------|----------|-----|
| Encrypted in this browser (localStorage) | Yes | Default. Ciphertext only. |
| Encrypted backup `.json` on USB / encrypted disk | Yes | Best portable backup. |
| Encrypted backup in a cloud drive **you** control | Acceptable | Only the ciphertext file. Still protect the cloud account. |
| Unencrypted Google Doc / Notion / email / SMS | **Never** | Trivially leaked or subpoenaed in plaintext. |
| Free shared databases (Airtable, Sheets) | **Never** | Wrong threat model. |
| Lidon / GitHub / any server vault (current version) | **No** | This build has **no** server-side storage by design. |

## Cryptography (this build)
- **KDF:** PBKDF2-HMAC-SHA-256, **600,000** iterations, random 16-byte salt  
- **Cipher:** AES-256-GCM, random 12-byte IV per save  
- **API:** Web Crypto (`crypto.subtle`) in the browser  
- **Passphrase:** never transmitted; wiped from form fields after use  
- **Auto-lock:** 5 minutes idle; also locks when the tab is hidden  

If the passphrase is lost, ciphertext is unrecoverable. That is intentional.

## Threat model (honest)
**Protects reasonably against:** casual snooping on a shared PC (while locked), lost encrypted backup without passphrase, static host operator reading your vault (they only see app code).

**Does not fully protect against:** malware/keyloggers on the device, a compromised browser extension, physical access while unlocked, sophisticated XSS if you load the app from a malicious or altered host, shoulder surfing while secrets are shown.

## Steward practice (recommended)
1. Keep the **master passphrase** separate from the vault backup (sealed envelope, attorney, or password-manager emergency access).  
2. Print steward instructions **without** secrets by default.  
3. Tell one trusted steward that LegacyLock exists and where the encrypted backup lives.  
4. Re-export an encrypted backup after major updates.  
5. Prefer a private device; keep OS/browser updated; avoid public computers.

## What not to build until revenue + threat review
- Server sync with plaintext or weak encryption  
- SMS recovery of the master passphrase  
- “Forgot password” resets  
- Analytics / ad scripts on this app  

## Legal note
Not a substitute for wills, trusts, powers of attorney, or professional estate planning. Not a licensed password manager with audited security. Use at your own risk.
