From 2a3da97b49e50316670594df4638fb3d6edec215 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 18 Jan 2026 22:05:36 +0000 Subject: [PATCH] refactor: replace blur with fixed-width placeholders for privacy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent balance size information leakage by using fixed-width placeholder characters instead of blur effect. A blurred "1000000" would still reveal it's a large balance vs "100" even when blurred. Changes: - Replace blur-sm class with conditional placeholder text - Use "••••••" for main balances - Use "••••" for transaction amounts in lists - Use "•••••• sats" for detailed amounts with unit - Use "•••• sats" for smaller amounts like fees Security improvement: No information about balance size is leaked when privacy mode is enabled. All hidden amounts appear identical. --- src/components/WalletViewer.tsx | 45 +++++++++++++++--------------- src/components/nostr/user-menu.tsx | 16 +++++------ 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/components/WalletViewer.tsx b/src/components/WalletViewer.tsx index 2d37ad2..66325d5 100644 --- a/src/components/WalletViewer.tsx +++ b/src/components/WalletViewer.tsx @@ -1064,8 +1064,8 @@ export default function WalletViewer() { className="text-4xl font-bold font-mono hover:opacity-70 transition-opacity cursor-pointer flex items-center gap-3" title="Click to toggle privacy blur" > - - {formatSats(balance)} + + {state.walletBalancesBlurred ? "••••••" : formatSats(balance)} {state.walletBalancesBlurred ? ( @@ -1161,10 +1161,10 @@ export default function WalletViewer() {
-

- {formatSats(tx.amount)} +

+ {state.walletBalancesBlurred + ? "••••" + : formatSats(tx.amount)}

@@ -1251,10 +1251,10 @@ export default function WalletViewer() { ? "Received" : "Sent"}

-

- {formatSats(selectedTransaction.amount)} sats +

+ {state.walletBalancesBlurred + ? "•••••• sats" + : `${formatSats(selectedTransaction.amount)} sats`}

@@ -1287,10 +1287,10 @@ export default function WalletViewer() { -

- {formatSats(selectedTransaction.fees_paid)} sats +

+ {state.walletBalancesBlurred + ? "•••• sats" + : `${formatSats(selectedTransaction.fees_paid)} sats`}

)} @@ -1446,21 +1446,20 @@ export default function WalletViewer() { {invoiceDetails?.amount && !sendAmount && (
Amount: - - {Math.floor(invoiceDetails.amount).toLocaleString()}{" "} - sats + + {state.walletBalancesBlurred + ? "•••••• sats" + : `${Math.floor(invoiceDetails.amount).toLocaleString()} sats`}
)} {sendAmount && (
Amount: - - {parseInt(sendAmount).toLocaleString()} sats + + {state.walletBalancesBlurred + ? "•••••• sats" + : `${parseInt(sendAmount).toLocaleString()} sats`}
)} diff --git a/src/components/nostr/user-menu.tsx b/src/components/nostr/user-menu.tsx index ca93faf..bf113ff 100644 --- a/src/components/nostr/user-menu.tsx +++ b/src/components/nostr/user-menu.tsx @@ -197,10 +197,10 @@ export default function UserMenu() { className="text-lg font-semibold hover:opacity-70 transition-opacity cursor-pointer flex items-center gap-1.5" title="Click to toggle privacy blur" > - - {formatBalance(balance ?? nwcConnection.balance)} + + {state.walletBalancesBlurred + ? "••••••" + : formatBalance(balance ?? nwcConnection.balance)} {state.walletBalancesBlurred ? ( @@ -348,10 +348,10 @@ export default function UserMenu() { {balance !== undefined || nwcConnection.balance !== undefined ? ( - - {formatBalance(balance ?? nwcConnection.balance)} + + {state.walletBalancesBlurred + ? "••••" + : formatBalance(balance ?? nwcConnection.balance)} ) : null}