Files
final-wishes/README.md

369 lines
22 KiB
Markdown

# Final Wishes
An encrypted, printable "in the event of my death or incapacity" guide that
lives on a thumbdrive as a single HTML file. No install and no network are
needed to use it. See `PLAN.md` for the design. This file is also the owner's
guide (updating, backups, printing and so on, below). The executor's
instructions are in `docs/thumbdrive/README.txt`.
## Develop
```
npm test # unit + build tests (Node 20+)
npm run build # app only -> dist/final-wishes.html
npm run seal # encrypt data/seed.json -> dist/
node build.js --data F.json --out PATH # custom input/output
```
The passphrase is prompted for (hidden) or read from `FW_PASSPHRASE`.
## Layout
- `src/crypto.js` passphrase encryption (PBKDF2 -> AES-256-GCM)
- `src/model.js` document schema and validation (sections, records, and the
optional print `header`); `src/ops.js` edit helpers
- `src/images.js` image-field helpers and the import pipeline (PNG/JPEG only,
downscaled and re-encoded in the browser)
- Visual sequences (numbered pictures with optional text, in any section) are
described under *Visual sequences* below.
- `src/version.js` the version shown at the top (`Ver YYMMDDX`); `npm run bump` advances it by hand;
a pre-commit hook (`npm run hooks` once per clone) does it on every commit
that changes the app
- `src/print.js` print helpers (secret masking in three views, header layout)
- `src/app.js` + `src/style.css` the UI, including the Print header panel
- `src/template.js` the HTML skeleton shared by `build.js` and in-page Save
- `docs/thumbdrive/` what goes on the drive alongside the HTML file
## What you have
One file, `final-wishes.html`: the app plus your data, encrypted with a
passphrase (PBKDF2-SHA256, 600,000 iterations, AES-256-GCM). It runs in any
browser, offline. There is no recovery if the passphrase is lost.
## Thumbdrive layout
```
final-wishes.html the encrypted guide
README.txt copy of docs/thumbdrive/README.txt (fill in the blanks)
backups/ dated copies, final-wishes-YYYYMMDD.html
```
Fill in the two blanks in `README.txt` with *where* the passphrase and any
printed copy are kept, never the passphrase itself.
## First-time setup
Either route gives the same kind of file:
- **In a terminal:** `npm run seal` encrypts `data/seed.json` (prompts twice
for a passphrase, minimum 12 characters). To write straight to the drive:
`node build.js --data data/seed.json --out /mnt/f/final-wishes.html`
(WSL needs the drive mounted: `sudo mount -t drvfs F: /mnt/f`).
- **In the browser:** `npm run build`, open `dist/final-wishes.html`, import
a JSON file or start a new document, then Save. You will be asked to
choose a passphrase.
**Never write a seal over a file you want to keep.** `npm run seal` builds
from `data/seed.json`, not from your latest edits; use it only for the very
first file. After that, edit in the page and Save.
After sealing, `data/seed.json` is still plaintext. Delete it (and see
"Security clean-up" below). `data/` and `*.pdf` are git-ignored on purpose.
## Updating
1. Open `final-wishes.html` from the drive, unlock, click **Edit**.
2. Change things, **Done editing**, **Save** (or Ctrl/Cmd+S).
- Chrome/Edge: pick the drive file once; later saves overwrite silently.
- If Chrome refuses to write to the place you picked (a protected folder such as Downloads, Documents or your home folder), Save downloads the file instead and says so. Delete the empty file it left behind. Pick a subfolder you made, or the thumbdrive, to save in place.
- Firefox/Safari: a new `final-wishes.html` downloads. Copy it over the
old one on the drive.
- **Cancel** (next to Save, edit mode only) throws away the unsaved
changes to the section on screen, back to how it was at the last open
or save, and leaves edit mode. It asks first if anything changed. It
works on the Print header page too. Other sections keep their unsaved
edits. A section you added this session is removed. Deleting or moving
sections is not undone by Cancel, and neither is a passphrase change.
Deleting a section asks first and says what is in it (records, items,
visual sequences, images).
3. Saving updates "Last update" and the per-record dates. "Last update" is
what the printed header shows. Editing the header settings themselves does
not change it.
4. If you changed the passphrase, the old file still opens with the *old*
one until you save and replace it.
## Searching
Click **Search** in the toolbar (view mode only). The toolbar buttons are
replaced, in the same row, by a search box with **Search**, **← Previous**,
**Next →** and **Cancel** buttons. Type a word, press **Search** or Enter.
It ignores capitals and looks through the whole document: section titles, text,
record titles, field labels and values, notes, items and visual-sequence step
text. Every match on the page is highlighted and the current one is stronger;
the count shows as "2 of 6".
- **Tab** and **Shift+Tab** (with the cursor in the search box), the arrow
buttons, or Enter / Shift+Enter move to the next or previous match. They wrap
round at the ends and jump to the right section and sub-tab, unfolding a
collapsed record if the match is inside it.
- **Not found:** nothing is highlighted, the box says "Not found", the arrows
are greyed and Tab behaves normally (it moves on to the next control).
- **Cancel** (or Esc) clears the box and the highlights and puts the usual
toolbar buttons back. Typing a new word also clears the old results until you
search again.
- **Secrets are never searched or shown.** A word that only appears inside a
value marked secret is "Not found". Field labels are searched, values marked
secret are not. Image text is not searchable.
- Search is for reading: there is no Search button in Edit mode, and
starting to edit clears any results.
- The Print header page and dates such as "Updated" are not searched.
## Sub-tabs
A *records* section (Banking, say) can be split into **sub-tabs** such as
Standard, Online and Credit Union. Other kinds of section don't have them.
- **Create:** choose Edit, type a name under **Sub-tabs** and press
**+ Add sub-tab**. The first one makes a tab bar appear, with a catch-all
**General** tab first. Records you already had are in General. A section
with no sub-tabs looks exactly as before.
- **Add into a tab:** **+ Add record** and **+ Add visual sequence** add to the
tab you are on.
- **Fix a misplaced record:** each record (and visual sequence) has a
**Sub-tab** drop-down in edit mode. Pick the right tab and it moves there.
- **Order:** the up/down arrows reorder within the tab you are on. The
name box under Sub-tabs renames the selected tab (General too), and its
arrows move the tab left or right.
- **Delete a tab:** the ✕ asks first. Its records move to General, so
nothing is lost. Deleting the last tab turns the section back into a plain list.
- **Collapse all / Expand all** work on the tab you are on.
- **Print:** each tab prints as a sub-heading inside the section (tabs
with nothing in them are left out).
- **Older copies:** a file saved with sub-tabs can't be opened by an older
build of the app. Upgrade the app first (see *Upgrading*).
## Images
Any record can hold pictures (scans of documents, photos of a safe's
contents, a screenshot of where to click). They are another kind of field, so
they have a label, a **Normal / Lawyer / Secret** choice, reorder arrows and a delete button
like any other field. In **Edit** mode, add one of three ways:
- **+ Add image...** in the record, then choose one or more files.
- **Drag and drop** a file onto the record (adds a new field) or onto an
existing image box (replaces that image).
- **Paste** (Ctrl/Cmd+V) with the cursor inside the record (adds a new field),
or with an image box selected (replaces it). Text pastes are unaffected.
What to expect:
- Only **PNG and JPEG** are accepted. The type is checked from the file's
contents, not its name. Anything else is refused with a message.
- Images are **shrunk** so the longest side is at most 1600 px and re-encoded.
This also removes camera metadata such as GPS location. A large PNG becomes a
JPEG (transparency is lost); small PNGs stay PNG so screenshots stay sharp.
Photos usually end up well under 1 MB; there is a hard limit of about 3 MB
per image.
- Pictures are stored inside the encrypted document, so they are protected by
the passphrase like everything else, but they make `final-wishes.html` bigger
and each save slower. Add what the executor needs, not everything you have.
- **Secret** images are hidden in the viewer behind **Show/Hide** and are
withheld ("[withheld]") from a masked print. A photo of an ID card is as
sensitive as a password: a full "Include secrets" print contains it.
- Click an image in the viewer to enlarge it. In print each image is scaled to
fit the page (at most about 4 inches tall).
- Dropping a file anywhere on the page never navigates away from unsaved work.
## Visual sequences
A **visual sequence** is a numbered series of pictures, each with optional
text, for things that are easier to show than to describe: how to log in to a
bank site, how to cancel a service that hides the button. It is its own block,
not part of a record or item, so it sits exactly where you put it.
- **Where:** in any section. In *records*, *steps* and *checklist* sections use
**+ Add visual sequence** next to the add-record / add-item button. It sits
in the same ordered list, so the up/down arrows place it between records or
items. In a *text* section sequences print after the text. A section can
hold as many as you like. A sequence is not a step: it has no number and no
tick box, and numbering of the items around it carries on unbroken.
- **Adding pictures:** **+ Add images…** (choose several files at once), drop
files on the sequence, or paste a screenshot while the cursor is inside it.
Each becomes a step. Dropping or pasting onto an existing step's box replaces
that step's picture. **+ Add step** adds an empty one. Same image rules as
Images above (PNG/JPEG, shrunk, about 3 MB limit).
- **Text:** each step has a text position, chosen per step: *right of image*,
*under image*, or *no text*. Text keeps its line breaks. Switching to *no
text* hides it but keeps what you typed. Empty text never takes room.
- **Secret** (per step) hides both the picture and the text behind Show/Hide
and withholds it from a masked print. Steps are numbered 1, 2, 3… in view
and in print, and a step is kept on one page.
- **Capture from the screen:** in Edit, **Capture from screen…** asks the
browser to share a window or tab (nothing is recorded or sent anywhere).
Log in to the site yourself, get to the screen you want, come back to this
page and click **Capture step**. Each click adds one step with that picture;
repeat for each screen, then **Stop sharing** (it also stops when you leave
Edit). Account numbers and balances in a screenshot are real data: mark the
step **secret**, or capture a screen before they appear. Works in Chrome,
Edge and Firefox opened from a file. Pasting a screenshot still works too.
- **Capture online, merge offline (issue #28):** capturing inside this file
means the unlocked document is open in a browser that is logged in to a
bank. Instead, `npm run build` also writes **`capture.html`** next to the
main file. It holds no document and no passwords. Open it while online,
**+ New walkthrough**, name it, **Share screen…**, **Capture step** for each
screen, and repeat for as many walkthroughs as you like. **Export bundle…**
asks for a passphrase (the pictures can show account numbers) and downloads
one encrypted `.fwcapture` file. Nothing is kept in the browser, so export
before closing the page. Later, offline, open your Final Wishes file and
choose **Import captures…**: pick the bundle, enter its passphrase, and for
each walkthrough tick it, rename it and choose the section (or sub-tab) it
goes in. Then **Save**, and delete the bundle file. The bundle is never
changed, so walkthroughs you skip can be imported from it later. Add the
step text, marks, blur and secret flags after importing.
- **If it looks different or fails:** each step has an optional note for what
to do when the screen is not what the picture shows (who to call, what to
say). Tick **Stop here** to tell the reader not to go further without help.
Both show in the list, the walkthrough and print, and are hidden with a
secret step.
- **Mark up a picture:** in Edit, **Mark up picture…** under a step's image
opens an editor. **Marker** (click) drops a numbered circle where the reader
should click; **Box** (drag) outlines something to look at; **Blur out**
(drag) pixelates anything private, such as account numbers and balances.
**Undo** steps back, **Apply** keeps it. Markers and boxes are overlays you can
change later (they show in the list, walkthrough, enlarged view and print).
**Blur is different: it is baked into the picture when you Apply**, so no
readable copy is kept, and it cannot be undone after you Save. Replacing or
removing a step's picture drops its markers and boxes, since they would no
longer line up.
- **Credentials a step needs:** in Edit, each step has **+ Use a field from a
record…**. Pick the login fields (say Santander's username and password) and
the step shows them beside the picture, live from the record, so there is one
copy to keep current. A secret stays masked until **Show**; **Copy** puts the
value on the clipboard without showing it (the clipboard is wiped after 30
seconds, which also replaces anything else copied in that time). Print shows
them too, masked unless you choose "Include secrets". If the record or field is
later deleted the step says the credential was removed. Renaming or
reordering fields is safe: the link is to the field itself.
- **Walkthrough:** in view mode, **Walk through, one step at a time** shows one
step with Back / Next. A sequence made from captures shows its capture date
and a reminder that the site may have changed since.
- Files saved with sequences cannot be opened by older builds; opening an
older file in a newer build (see below) still works. **Cancel** and the
other editing rules work the same as for records.
## Version number
The top of the page shows the app's version after the "Last update" date,
for example **Ver 261109B**: `261109` is the date (YY MM DD) and the letter is
the iteration that day (A first, B second, up to Z). It is the version of the
*app code*, not of your data, so a file saved from a newer build shows the
newer number. After upgrading an old file (below), check that it changed.
For the developer: the bump is automatic. A git pre-commit hook
(`.githooks/pre-commit`) moves `src/version.js` to today's date with the next
letter (or A on a new day) in any commit that changes `src/` or `build.js`.
Docs-only and test-only commits don't bump, and a commit that already changes
the version by hand is left alone. Past Z (26 in a day) it warns and keeps Z.
- Once per clone, switch the hook on: `npm run hooks` (sets
`core.hooksPath` to `.githooks`). Until then commits are not bumped.
- `npm run bump` still bumps by hand if you need it.
- The hook adds `src/version.js` to the commit being made. It works with
`git add ... && git commit` and `git commit -a`; with `git commit <paths>`
the bump is left out of that commit, so use the first form.
## Upgrading the app (new version, same data)
Your data is stored encrypted inside each `final-wishes.html`; the app code
sits beside it in the same file. A file therefore keeps running the version it
was saved with until you move its data into a newer build:
1. `npm run build` (or take a newer `final-wishes.html` build) and open
`dist/final-wishes.html`.
2. On the start screen choose **Open your existing Final Wishes file**, pick
your current file and unlock it with its passphrase. The old file is only
read, not changed.
3. Click **Save** and give the result a **new name** (for example
`final-wishes-new.html`) rather than the current one.
4. Open the new file, unlock it, and look through it. Only then replace the
old file (keep the old one in `backups/`).
Never point `npm run seal --out` at a file you want to keep: it builds from `data/seed.json`.
Documents made by older versions keep working: anything a newer version added
(such as the print header) falls back to a default until you set it.
## Backups
- **Backup copy** downloads `final-wishes-YYYYMMDD.html` to your Downloads
folder. Move it into `backups/`.
- Keep a second copy off the drive. The file is encrypted, so cloud storage
or a second drive is reasonable. Thumbdrives fail without warning.
- After any important change, open the *copy* once and unlock it to prove it
works.
## The passphrase (the real single point of failure)
- Do not store it on the drive or in the same place as the drive.
- Good options: a sealed envelope with your will in the fire safe, or with
your attorney, plus a second person who knows where it is.
- Make sure your executor knows the drive exists and where the passphrase
is kept. The blanks in `README.txt` exist for this.
- Use a few random words (12+ characters is enforced). Do not reuse the
LastPass master password.
## Printing
**Print...** offers "Withhold secrets" (safe overview), "Lawyer's view",
"Lawyer's summary" and "Include secrets" (full copy). Every field and step has a level in Edit mode:
**Normal** (always printed), **Lawyer** or **Secret**. Lawyer and Secret values
are both hidden on screen until **Show**. For a bank account, say, the name is
Normal, the account number Lawyer and the balance Secret: the overview prints
only the name, the lawyer's view adds the account number, and the full copy
prints all three. The **lawyer's summary** is a short list instead of a full copy: only the
records that have at least one Lawyer-level field, each with just its Lawyer
fields (so the account and its number, nothing else), in clear text. Text
sections, steps, walkthroughs, notes and Normal or Secret fields are left out.
Lawyer-level image fields are not listed. Both lawyer copies are still
sensitive, so store them too. Print on Letter paper with the browser's own
"Headers and footers" turned off (that is separate from the document header
below). A full copy is as sensitive as the passwords on it: store it in the
fire safe and shred superseded copies. Page layout was checked by rendering
pages in Chromium (Chrome/Edge); it has not been checked in Firefox or Safari,
so look at a test print the first time.
### The print header
Every printed page starts with a header line in larger bold type. It is part
of the document, so it is saved with the rest and is encrypted too. Open
**Print header** at the bottom of the sidebar to see a live preview, then
**Edit** to change it:
- Add as many fields as you like. Each is either **Text** (printed as
written) or **Last updated** (an optional label such as `Last update: `
followed by the document's last-update date).
- Each field's alignment is **Left**, **Right** or **Not aligned**. At most one
field can be left aligned and one right aligned; the other choice shows
"(in use)" and is disabled.
- Printed order is always: the left field, then the unaligned fields in the
order listed, then the right field. List order only matters between
unaligned fields. Use the arrows to reorder and the cross to remove.
- **Reset to default** restores the title on the left and "Last update: date"
on the right, which is also what a document with no header setting uses.
- Keep the left and middle text short. If the line gets crowded, the left
field wraps first; the right and middle fields never wrap.
## Reset: erase secrets before working online (issue #19)
To work on the layout somewhere less safe (a shared or online machine), open the file with `?reset=1` on the end of its address, for example `final-wishes.html?reset=1` (`#reset=1` works too). After you unlock it, a banner offers to erase every value marked secret: secret fields, secret images and secret steps. Labels, structure and everything else stay.
Nothing is written until you Save, and saving over the file removes the secrets for good. Use **Backup copy** first, or save under a new name, if you need them again. Choosing "Keep them" dismisses the banner and changes nothing.
### Making a copy without secrets (the sanitize script)
`node sanitize.js --in /path/real.html --out /path/copy.html` reads your real file (it is never changed), asks for its passphrase and a **new** passphrase for the copy, erases every value marked secret, and writes the copy with the newest app code. It prints what is still in the copy, section by section, so you can judge whether it is safe where you plan to put it. It refuses to write over the input, and refuses to reuse the real passphrase. Set `FW_PASSPHRASE` and `FW_NEW_PASSPHRASE` to skip the prompts. Only values flagged secret are erased: review anything sensitive that is not flagged.
## Keep it current
Nothing in the app reminds you to review. Set a yearly reminder. Things that
go stale: card expiry dates, account balances and metal values, advisors'
contact details, anything marked TBD. The "Still to add" section lists
known gaps.
## Security clean-up (issue #8)
- Destroy plaintext copies of the source material once the encrypted file is
verified: `abi-wishes.pdf`, the Word version, and `data/seed.json`.
- Rotate every password and PIN that appeared in the PDF (LastPass master
password, computer PIN, ATM PIN, bank logins), since it existed in
plaintext for years.
- Treat the encrypted file like any sensitive file: an attacker who gets it
can try passphrases offline forever, so the passphrase strength is all that
protects it.
## Limits
This is a guide, not a legal document. It does not replace a will, health
care directive or powers of attorney, and the executor may still need
those to be granted access to accounts.
## Never commit
`*.pdf` and `data/` hold real personal data and are git-ignored.