qml: allow hiding balances and amounts#10636
Conversation
| def redact_amount_string(s: str) -> str: | ||
| """Replace ASCII digits in a formatted-amount string with '*'.""" | ||
| return re.sub(r'[0-9]', '*', s) | ||
|
|
There was a problem hiding this comment.
The length of the amount still exposes some information (*** sat vs ** *** *** sat), but i think that's a good tradeoff between usability and privacy.
I disagree. What is the goal of the feature? If someone has a thousand coins, it does not gain them much that a shoulder-surfer does not see whether it is 1000 or 9999, does it?
Just make it always be (say) four stars, both for shorter and longer "true" values.
That way you can still keep displaying the units (e.g. BTC vs sat) - I imagine hiding the unit would add more complexity.
So e.g.:
36.204 84 mBTC --> **** mBTC
3 620 484 sat --> **** sat
but if it is simple, we could also hide the units, so e.g.:
36.204 84 mBTC --> ****
3 620 484 sat --> ****
btw, I just tested and this last example seems to align with what phoenix is doing
There was a problem hiding this comment.
My thinking was that showing the exact amount of digits provides the benefit of being able to at least roughly estimate the balance as a user, improving the usability of the wallet with the mode enabled.
So e.g. when standing in line to pay for a drink in public you're still able to infer if it you'll be able to pay for the drink instead of having a.) deactivate the obfuscation in public or b.) attempt the payment and then awkwardly fail because the balance was too low. In the end the feature is only beneficial if it doesn't break the main usecase of a wallet, making transactions.
On the other hand I assumed the human mind is optimized to parse digits/numbers very quickly, but has a hard time counting * quickly, so a quick shoulder surfer likely isn't able to get much information as they are not used to the UI and counting * characters from distance.
But OTOH this mostly affects the "sat" unit, if set to "BTC" it will anyways most of the time be *.*** *** ** BTC, so we might as well just show **** uniformly.
What is the goal of the feature?
My motivation was actually not preventing shoulder surfers (though this is probably what the majority of users would benefit from through this feature), but instead being able to demonstrate the app and its features to others without having to use a dummy wallet or reveal my exact balance. For this i agree showing the exact digits is not sufficient but i found it better than not having the obfuscation at all and considered the tradeoffs above for the shoulder surfer usecase.
I'll change it to just use ****.
There was a problem hiding this comment.
Changed it to show **** without unit in relevant places (main view, channels and utxo list), while still showing amounts in the other views (e.g. when confirming a payment or doing a swap).
Implement hiding the wallet balance and transaction amounts when the user long presses the balance details field in the wallet history view.
Wrap the balanceLayout, syncLabel and statusLabel in an Item
which adjusts its width based on the contents width.
Previously when loading a wallet with a small balanceLayout
the syncLabel ("Synchronizing (X/Y)" string) would exceed the width
of the balancePane and it looks broken.
Un-focuses the search box when clicking elsewhere, moves the zoom icon correctly into the search box instead of overlapping with the search box border.
Adds a toggle for setting the hideAmounts config to the Preferences so users don't have to discover that long pressing the balance toggles it. Also shows an hint to guide the user to the more conveniant way of toggling it by long pressing the balance.
This allows hiding the wallet balance and transaction amounts by long-pressing the balance summary of the main view in QML (or toggling the config in the Preferences).
When enabled the amounts will be replaced by a fixed
****string and the units and fiat are hidden.Screencast_20260512_165512.webm