Sign in, register with a recovery code shown once, browse, switch area, upload, download through a share sheet, and create password-protected links. All of it sits on FilesClient, which filesctl already exercises end to end against both a self-hosted stack and files.flamenet.io. The area banner is always on screen rather than tucked into a menu. Which area you are working in decides where a new file lands and who can ever read it, and finding that out afterwards is too late. Rows this session cannot decrypt are shown, and say so — hiding them would be a lie about what the server knows. The project file is generated by XcodeGen and not committed, so it cannot become a merge hazard. UI tests drive the real app, which is how the first real bug here was found: the mode picker and the submit button carry the same three words, so matching on the visible label tapped the picker and the form never submitted. Both are addressed by identifier now, which VoiceOver benefits from as much as the tests do.
3.7 KiB
flamenet-files-ios
The iOS client for Flamenet Files — private, labelled file storage, encrypted on your device before it is uploaded.
MIT licensed, like the server and web client.
What is here
Sources/FilesEngine |
The cryptography, in CryptoKit. Implements docs/SPEC.md — the lattice, key derivation, the key hierarchy, recovery codes, filename digests, chunked content, share links. |
Sources/FilesClient |
The wire layer: server discovery, the account service, the file API, and a session that ties them together. |
Sources/filesctl |
A command-line client. Runs a full round trip against a real server without an app, a simulator, or a person tapping. |
Tests/FilesEngineTests |
Interop against vectors produced by the browser. |
The engine and the client are a Swift package rather than app code so that
swift test runs from the command line. Requiring Xcode to exercise the
cryptography would mean it gets exercised rarely, and this is the part that must
not be wrong.
Interop is the test suite
The tests do not check that this code is self-consistent — they check that it agrees with the implementation people actually use.
swift test
The vectors are generated by the JavaScript engine in the public repository and copied here verbatim. A file written in the browser must open on a phone, a code printed on one device must work on another, and a divergence should fail here rather than in somebody's hands.
Trying it against a real server
swift run filesctl https://files.flamenet.io probe
One address is enough. The server names its own account service — files.flamenet.io
points at accounts.flamenet.io, a self-hosted box points at the service bundled
alongside it — so there are no build flags and no baked-in list of which
hostnames are "ours".
swift run filesctl http://127.0.0.1:8081 smoke myhandle 'a good passphrase'
smoke registers an account, signs in fresh, creates a folder, uploads 200 KB
across four chunks, decrypts the name back, downloads and compares byte for
byte, makes a password-protected share link, opens it, and checks that the same
link is refused without the password.
Two things worth knowing
- PKCS#8 versus raw. WebCrypto exports an X25519 private key as PKCS#8;
CryptoKit uses the raw 32-byte form.
Identity.rawFromPKCS8converts. Without it, a record written in a browser cannot be opened here at all. - PBKDF2 comes from CommonCrypto. CryptoKit has no password-based KDF, and the derivation has to match WebCrypto byte for byte.
Status
The engine and the wire layer are complete and verified, including against the Android engine: one uploads, the other downloads, and the bytes match.
The SwiftUI app is in progress.
⚠️ There is no release channel yet. No signing team is configured and the export-compliance key is unset. TestFlight needs an Apple Developer Program membership; until there is one, this builds and runs in the simulator and nowhere else.
Building the app
xcodegen generate # the .xcodeproj is generated, not committed
open FlamenetFiles.xcodeproj
AppTests/ drives the real app against a real server, because the interesting
failures up here are wiring rather than cryptography — whether a button is
connected to the thing it claims to do. It expects a stack on
http://127.0.0.1:8081; the simulator shares the host's network, so
docker compose up in the public repository is enough.
xcodebuild -project FlamenetFiles.xcodeproj -scheme FlamenetFiles \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' test