Skip to content

Commit 5be9d45

Browse files
committed
Update wnfs-comparison.md
1 parent 41d39f8 commit 5be9d45

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

docs/wnfs-comparison.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,60 @@ Scores are **1–10**, where 10 is best given typical modern requirements. Score
463463
- Fula has a modest advantage in future‑proofing due to its **HPKE centric** design and simpler key hierarchies.
464464
- WNFS is still upgradable but will need carefully planned migrations for accumulators and RSA components.
465465

466+
### 3.6 Encrypted Folder Listing for File Managers
467+
468+
This section focuses on the common "file manager" use case: **listing files in an encrypted folder with names, sizes, timestamps, and content types, without reading or decrypting full file contents.**
469+
470+
#### Fula
471+
472+
- **PrivateForest as a pre‑computed index**
473+
- `PrivateForest` stores a per‑bucket index of files and directories:
474+
- `ForestFileEntry` contains original path, storage key, size, content type, timestamps, user metadata, and optional content hash.
475+
- The entire forest is wrapped in `EncryptedForest` and encrypted once with a forest DEK derived from `KeyManager::derive_path_key("forest:<bucket>")`.
476+
- The server sees only an opaque forest object (`x-fula-forest: true`) and flat storage keys; all human‑readable paths live inside the encrypted forest.
477+
- **Listing behavior**
478+
- `EncryptedClient::load_forest` downloads and decrypts the forest index **once** per bucket.
479+
- `list_directory_from_forest` and `list_files_from_forest` then perform **in‑memory lookups** to produce `DirectoryListing` and `FileMetadata` structs:
480+
- `original_key`, `original_size`, `content_type`, `created_at`, `modified_at`, `user_metadata`, `is_encrypted`.
481+
- To render a file manager view (names, icons, sizes, dates), the client only needs to:
482+
1. Fetch and decrypt the forest index object.
483+
2. Never touch individual file ciphertexts until the user actually opens a file.
484+
- **Implications**
485+
- **Pros:**
486+
- Very fast after the first forest load; directory listings are just hash‑map lookups.
487+
- Ideal for UI patterns like "load all files in this bucket and sort/filter client‑side".
488+
- **Cons:**
489+
- For extremely large buckets (millions of files), the forest index itself can become large; listing any directory requires fetching and decrypting the entire index.
490+
491+
#### WNFS
492+
493+
- **Per‑node metadata and forest indirection**
494+
- WNFS separates **metadata nodes** from content blocks:
495+
- Private directories and files are represented as `PrivateNode`s with headers encrypted under `TemporalKey` (AES‑KWP) and content under `SnapshotKey` (XChaCha20‑Poly1305).
496+
- The `HamtForest` maps name accumulators to ciphertext CIDs for these private nodes.
497+
- To list a directory, the client:
498+
1. Uses `HamtForest` to resolve the directory's name accumulator into one or more CIDs.
499+
2. Fetches and AES‑KWP decrypts the directory node header to obtain child entries (names → `PrivateRef`s).
500+
3. Optionally fetches child file headers to obtain per‑file metadata (size, timestamps, etc.), **without decrypting file content blocks**.
501+
- **Listing behavior**
502+
- Listing is localized: only the directory node and relevant HAMT nodes (and perhaps child headers) are loaded and decrypted.
503+
- For very large trees, this avoids loading a global index; the amount of data touched is proportional to the size of the directory subtree being viewed.
504+
- **Implications**
505+
- **Pros:**
506+
- Scales well to very large forests; listing a small directory only touches a small subset of the tree.
507+
- Clean separation between metadata nodes and content blocks ensures file content is never decrypted during pure listing.
508+
- **Cons:**
509+
- Listing a large directory can require multiple blockstore fetches and many small decryption operations (one per node/header).
510+
- More complex data structures (HAMT + accumulators + ratchets) make implementation and caching more involved.
511+
512+
**Verdict:**
513+
514+
- Both Fula and WNFS support **metadata‑only listing of encrypted folders** suitable for file‑manager‑style UIs, without decrypting file contents.
515+
- **Fula** optimizes for the gateway/object‑storage model:
516+
- A single encrypted `PrivateForest` index per bucket gives very fast listings after an initial download/decrypt, especially for small–medium buckets.
517+
- **WNFS** optimizes for very large, evolving private filesystems:
518+
- `HamtForest` and per‑node headers let you list only the subtrees you care about, with work proportional to directory size rather than global tree size.
519+
466520
---
467521

468522
## 4. Missing or Weaker Features in Fula Compared to WNFS

0 commit comments

Comments
 (0)