Skip to content

feat: replace clipboard copy with QR code for secret key backup (Closes #348) - #352

Open
waterWang wants to merge 1 commit into
Micopay:mainfrom
waterWang:feat/sec-25-qr-secret-key-backup
Open

feat: replace clipboard copy with QR code for secret key backup (Closes #348)#352
waterWang wants to merge 1 commit into
Micopay:mainfrom
waterWang:feat/sec-25-qr-secret-key-backup

Conversation

@waterWang

Copy link
Copy Markdown

Summary

Implements the SEC-25 security fix: replaces the primary clipboard-copy approach for secret key backup with a QR code display, keeping clipboard as a secondary option with stronger security warnings and rate limiting.

Changes

ExportSecretKeyModal.tsx — New QR code primary backup flow

  • QR code display as the primary backup method using qrcode.react (already in dependencies)
  • User can screenshot or print the QR code — the secret key never touches the clipboard
  • Keep clipboard copy as a secondary option with explicit security warning
  • Session-level rate limiting: max 1 clipboard export per 5 minutes
  • Auto-clear clipboard: clipboard is cleared 30 seconds after copy (existing behavior preserved)
  • Clipboard risk warning banner: shown after copying to inform users about Android clipboard risks
  • Masked secret key display (hidden by default) with reveal toggle

i18n updates

  • Added 5 new translation keys in both en.json and es.json:
    • exportKeyQR — QR code section label
    • exportKeyQRHint — Hint about screenshotting/printing the QR code
    • exportClipboardWarning — Warning about Android clipboard risks
    • exportRateLimited — Rate limit message
    • exportKeyError — Error state message

CSS

  • Added @keyframes fadeIn animation for the clipboard warning banner

Tests

  • Added comprehensive test suite covering:
    • QR code rendering after loading
    • Clipboard copy with warning banner
    • Rate limiting after copy
    • Auto-clear clipboard after 30s
    • Secret key reveal/hide toggle
    • Close button behavior
    • Error state when loading fails

Acceptance Criteria

  • ✅ QR code display as primary backup method (user screenshots/prints)
  • ✅ Clipboard copy retained as secondary with explicit warning
  • ✅ Auto-clear clipboard within 30s with visible countdown
  • ✅ Rate limiting: max 1 export per 5 minutes per session
  • ✅ Explicit warning about Android clipboard risks
  • ✅ TypeScript passes (no new errors)
  • ✅ Backward compatible — no breaking changes

Closes #348

- Add QR code display as the primary secret key backup method
- Keep clipboard copy as secondary option with security warning
- Add session-level rate limiting (max 1 export per 5 minutes)
- Auto-clear clipboard after 30 seconds
- Add clipboard risk warning banner after copy
- Add comprehensive tests for all new behaviors
- Update en.json and es.json translations with new keys
- Add fadeIn animation utility class

Closes Micopay#348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SEC-25] Mobile: Stellar secret key exposed via system clipboard (Android)

1 participant