Somewhat related to this post last year.
I admire the vision for what Mutiny, Cashu wallets, and other PWA-focused devs are building, but I must admit I am concerned by the PWA-maximalism which I have seen espoused here and on Nostr.
Background
If you're not up to speed: PWAs are very popular in the BTC space right now because (correct me if i'm wrong) Apple and Google are frequently censoring bitcoin and especially lightning applications submitted to their respective mobile app stores. PWAs offer an end-run opportunity where users can "install" a PWA on their mobile phones without either party needing to jump the Apple/Google garden walls.
Thesis
PWAs are a poisoned well for bitcoin wallet devs parched of free (libre) distribution channels. We can drink from this well for a while, but not forever, and certainly not if we expect the bitcoin wallet userbase to grow.
Survey
Consider your favorite PWA wallet. Let me ask you a few questions to see whether this PWA wallet is right for you.
- Are you OK with your wallet phoning home to the developers every time you open it?
- Are you OK with wiping your seed every time you clear your browser cookies/storage?
- Are you OK with your wallet constantly loading and executing code served by a remote computer?
- Can you accept the risk that a single successful domain-name takeover or BGP hijacking attack on the PWA would result in your wallet seed being permanently and silently exposed? (IF you open your wallet at the time of the attack)
- Are you aware that TLS - a historically flawed and brittle encryption protocol - is the ONLY way a PWA wallet installation can be verified? (no PGP signatures)
- Can you accept that a TLS middle-man can compromise your wallet any time you open it on an insecure network?
- Do you trust the entire distribution pipeline of the wallet with your money? This includes the software used in building the wallet itself (which is fundamentally just a bunch of HTML/CSS/JS files), and also the services used to distribute those files, like AWS, Cloudlfare, DNS servers, certificate authorities, and all the web2 technology stacks they depend on.
- Do you trust your browser's developers to properly enforce site isolation? (e.g. if you open
evil.com
in a new tab, that site shouldn't be able to read or write to the memory/storage of themutinywallet.com
tab). - Have you planned and tested how you will recover your money if the wallet's domain is taken offline tomorrow?
- Can you live with the risk of governments seizing or silently surveilling your wallet? (Think of how effectively the US government could have deanonymized or rug-pulled users of the now-seized Samourai wallet if it had been distributed as a PWA)
If you can answer "yes" to all the above questions, then keep calm and carry on: PWAs are a fine choice for you.
If not... perhaps you should take a deeper look.
App Stores Suck Too
I'm not saying apple and google's walled gardens are any better. They rely on similar flawed infrastructure to distribute apps to their users. However there are two very important distinctions to be emphasized:
1. PWAs cannot be signed, verified, or reproduced
2. PWAs are updated every time you open them
The combination of these two properties is what makes PWAs toxic, in my view at least.
By comparison, app stores distribute builds which are signed by the developers so that updates can be verified after initial installation without trusting the distribution pipeline. Auto-updates can be disabled if needed. For android apps installed directly by APK, one can even add a layer of PGP verification or manual APK-signature verification.
Bitcoin Core is probably the best example of safe software distribution: It is compiled with reproducible builds, PGP-signed by numerous developers, and intentionally shipped without any centralized auto-update or phone-home mechanism, because those could be used to force undesirable changes onto unwilling users.
Security-sensitive software in general should be updated only with the consent of the user, because the user relies on the software to act in their interest, as their agent and representative in the digital world. A software which changes itself arbitrarily can easily morph into something which acts against the user.
Obviously a PWA wallet for pocket spending money is not as high-value a target as the base-layer bitcoin node software, but that argument only works for as long as the sum value of money stored in that wallet across all users remains small. If any wallet gets popular enough, even with very small individual balances, the wallet software and distribution pipeline will eventually become a desirable target.
An Easier Target
Put yourself in the position of a hacker targeting self-custodial wallets. Since private keys live on users' devices, you'll only be able to steal bitcoin if you can sneak your malicious code into a wallet update, or otherwise compromise a user's device.
You have the the choice between two wallets: one distributed by app store, and one distributed by PWA, both otherwise identical in attack surface, protecting an equal value of bitcoin. Which do you attack?
You attack the PWA. Why?
- Your malicious code stands more chance of reaching more victims faster, because updates are always automated and are fetched far more frequently. This means a bigger payout for your effort.
- The distribution pipeline has more attack surface due to the lack of build-signing. This means the attack itself will be easier and cheaper to execute.
From Source
Most of the risks i've mentioned so far can be resolved if one builds and runs the PWA wallet from its source code.
Unfortunately PWAs are very difficult to build from source. Whereas a desktop or mobile app can be built from source with varying degrees of difficulty and then simply installed and executed, a PWA must be built, AND served over an HTTP connection to a browser, and so the user must also supply their own HTTP server and figure out how to set up TLS, reverse proxies, SSH tunnels, or other ways of routing their browser's HTTP request to the server running the PWA.
Often open source PWAs are not meant to be run from source by amateurs. Devs don't always document the build process or how to serve that build securely. And so most people can't figure it out, and just use the devs' own published PWA URL. We're back to square 1.
Conclusion
A PWA wallet is certainly better than no wallet at all. But I would urge devs who ship PWA wallets to also ship a binary distribution of their app which is securely signed, and does not auto-update itself.
Long term, i believe developer-driven distribution tools like F-Droid and Obtanium are the answer. I expect the EU will soon force apple to allow users to install apps manually on iOS devices, like Android users can currently do. PWA wallets will then no longer be necessary or desirable, and we can avoid learning our lesson the hard way.
helm-wallet.pages.dev
in my browser (and every time I open the PWA), my browser makes aGET
request tohelm-wallet.pages.dev
to fetch an HTML file which dictates what UI to display and what code to execute. That's phoning home and auto-update at the same time. Maybe it's not your home, sincepages.dev
is controlled by cloudflare, but that's still phoning home, in my opinion at least.