Skip to content

Commit

Permalink
Seed recovery 🌱 (#300)
Browse files Browse the repository at this point in the history
* bump cashu-ts to 0.9.0

* add screens for seed setup. add seed utils

* add seed screen in options

* add screens related to seed backup

* add translations, clean up

* Add SENTRY_AUTH_TOKEN to .example.env.dev

* Update translations and image sizes

* Update wallet/index.ts with restore method details

* wallet/index.ts update comment

* update comment

* add missing translation. update mnemonic screen

* Add counter increment

* restore

* Refactor wallet recovery and add recovered proofs

* test restore

* update restore counters

* clean up

* Remove unused screens and components

* Remove unused functions and imports

* clean up restore screen components

* remove dashboard animation

* Add TODO custom recovery mint URL input field

* update restore screens

* Update screens and utils

* Fix input comparison bug in ConfirmMnemonicScreen

* Update wallet/restore.ts and screen components

* Add RESTORE_OVERSHOOT, update wallet/restore.ts

* Add TODOs

* Add comingFromOnboarding flag to Payment ProcessingError screen

* add restore to tx history

* add hook useRestore

* clean up imports

* add translations, clean up, lint

* add functionality to SelectRecoveryMint

* Remove TODO

* Update "Add Mint URL" text to use translation key

* clean up

* add a disclaimer and recommendations screen

* add TODO

* add basic tests

* Update German translation and restore disclaimer

* Add TODOs

* Update package.json version to 0.3.0

* Update getBalance function to getMintBalance

* Add seed migration hint to translation files

* Update seed migration hint for multiple mints

* Update english and german translation

* Commented out unused code in getCurrentKeySetId function

* fix require cycle

* Add new types and interfaces for PayLnInvoice and RequestToken

* Refactor screen imports in Navigator.tsx

* Add InfoIcon to SeedScreen

* Adjust header height in Restore/Seed screen

* delete seed update screen component

* Refactor header actions styling in SeedScreen

* add flag and refactor pin setup screen

* Add seed check before retrieving counters

* update error handling

* Fix seed screen navigation bug

* prevent back navigation in recovering screen

* add warning in payment processing screen

* Refactor text alignment in ProcessingScreen

* Refactor payment process logic

* Add hasSeed parameter to initialParams

* temporary ignore eslint error

* Refactor error handling in Pool class

* quick fix ci (fmtJson makes tsconfig.json invalid for jest)

* Fix condition for skipping seed setup

* Refactor MnemonicScreen component padding in warnContainer

* Remove unused code and logging statements

* Update translations for wallet recovery messages

* remove backupToken screens and utils

* lint

* Remove separator

* Remove commented out code in SecuritySettings

* Add marginHorizontal to separator

* fix ci

* add option to manually increase the restore counters by 50

* improve counter store by removing json methods

* remove debuging logs

---------

Co-authored-by: agron <[email protected]>
  • Loading branch information
KKA11010 and agron committed Feb 8, 2024
1 parent d503c80 commit e717541
Show file tree
Hide file tree
Showing 52 changed files with 5,407 additions and 2,775 deletions.
2 changes: 1 addition & 1 deletion .example.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SENTRY_ORG=
SENTRY_PROJECT=
SENTRY_DSN=

SENTRY_AUTH_TOKEN=

NODE_ENV=development
NODE_ENV_SHORT=dev
Expand Down
46 changes: 36 additions & 10 deletions assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,39 @@
"contacts": "Kontakte"
},
"common": {
"copy": "Kopieren",
"cycle": "Zyklus",
"manualCounterIncrease": "Zähler erhöhen",
"manualCounterIncreaseHint": "Die Zähler erhöhen sich automatisch nach jeder Transaktion, aber in seltenen Fällen kann dies fehlschlagen, was zu Fehlern während des Wiederherstellungsprozesses führt. Das manuelle Erhöhen der Zähler kann den Zustand beheben.",
"increaseCounterHint": "Sind Sie sicher, dass Sie die Zähler erhöhen möchten? Dies sollte nur geschehen, wenn Sie sicher sind, dass die Zähler nicht synchron sind.",
"noMintForCounter": "Sie haben keine Mints, für die Sie die Zähler erhöhen könnten.",
"counterIncreased": "Zähler um {{counterIncreased}} erhöht!",
"doneSafety": "Fast fertig... Sicherheitsüberprüfung",
"noProofsRestored": "Keine Beweise gefunden, um deine Wallet wiederherzustellen.",
"restoreErr": "Ein Fehler ist aufgetreten bei der Wiederherstellung Ihrer Wallet.",
"dontClose": "Bitte schließen Sie die App während des Vorgangs nicht.",
"recoveryHint": "Schreiben oder fügen Sie Ihren 12-Wort-Mnemonic in der richtigen Reihenfolge ein, getrennt durch Leerzeichen.",
"walletRecovery": "Wallet-Wiederherstellung",
"walletRecoveryHint": "Verwenden Sie ein Seed-Backup, um Ihre Wallet wiederherzustellen.",
"seedBackup": "Seed-Backup",
"12WordMnemonic": "12-Wort Mnemonic",
"secureWallet": "Sichere Wallet",
"secureWalletHint": "Generieren Sie und notieren Sie ein Seed-Backup, um Ihre Wallet zu sichern.",
"quickWallet": "Schnelle Wallet",
"quickWalletHint": "Erstellen Sie sofort eine neue Wallet. Der Seed-Backup kann später generiert werden.",
"skipSeedHint": "Sie können diesen Prozess überspringen und später ein Seed-Backup generieren.",
"mnemonicHint": "Die Seed-Phrase wird nie wieder angezeigt. Schreiben Sie sie auf und teilen Sie sie niemals mit jemandem.",
"confirmMnemonicErr": "Falsches Wort! Stellen Sie sicher, dass Sie Ihre Seed-Phrase korrekt und in der richtigen Reihenfolge aufschreiben.",
"selectRestoreMint": "Bitte wählen Sie die Mint aus, die zur Wiederherstellung Ihrer Mittel verwendet wird.",
"recoveringWallet": "Die Mint stellt Ihr Guthaben wieder her...",
"seedEnabled": "Seed-Wiederherstellung aktiviert!",
"confirmSeed": "Bestätigen Sie bitte Ihren Seed, indem Sie das richtige Wort eingeben.",
"aboutToLeaveTo": "Sie sind im Begriff die App zu verlassen",
"accept": "Annehmen",
"addEnutsMint": "eNuts mint verwenden",
"amount": "Betrag",
"back": "Zurück",
"backToDashboard": "Zurück zu Wallet",
"backupErr": "Etwas ist schief gelaufen während dem Sicherungsprozess.",
"balance": "Guthaben",
"balanceAfterTX": "Guthaben nach Zahlung",
"balTooLow": "Nicht genug Guthaben",
Expand All @@ -44,6 +70,7 @@
"cashOutFromMint": "Mint Auszahlung",
"change": "Rückgeld",
"claimed": "beansprucht",
"restored": "wiederhergestellt",
"claimSuccess": "{{amount}} Sats erhalten:\n{{mintUrl}}\nMemo: {{memo}}",
"claimToken": "Token in Anspruch nehmen",
"clear": "Löschen",
Expand All @@ -56,7 +83,6 @@
"copied": "Kopiert",
"shareInvoice": "Rechnung teilen",
"copyToken": "Token kopieren",
"createBackup": "Sicherung erstellen",
"createInvoice": "Rechnung erstellen",
"createToken": "Token Erstellen",
"createTokenErr": "Es konnte kein Cashu-Token erstellt werden. Bitte versuchen Sie es später noch einmal.",
Expand All @@ -73,6 +99,14 @@
"resetQ": "Wallet zurücksetzen?",
"delHistoryTxt": "Die Daten können nachträglich nicht wiederhergestellt werden.",
"disclaimer": "Haftungsausschluss",
"restoreDisclaimer": "Diese Funktion ist noch experimentell und sollte mit Vorsicht verwendet werden. Es wird nicht empfohlen, sie mit großen Geldbeträgen zu verwenden. Verwenden Sie es nach eigenem Ermessen. Die Entwickler, Mitwirkenden oder Betreuer dieser Software können nicht für Schäden, Verluste oder nachteilige Auswirkungen haftbar gemacht werden, die durch die Verwendung dieser Funktion entstehen.",
"restoreBattery": "Mindestens 20% Batterie.",
"restoreBatteryHint": "Wir empfehlen, dass Sie mindestens 20% Batterie haben, bevor Sie den Wiederherstellungsprozess starten. Je nach Datenmenge kann der Prozess eine Weile dauern.",
"restoreWifi": "Verwenden Sie Wi-Fi.",
"restoreWifiHint": "Wir empfehlen, dass Sie für den Wiederherstellungsprozess eine stabile Wi-Fi-Verbindung verwenden, um Unterbrechungen zu vermeiden und eine schnelle und sichere Wiederherstellung zu gewährleisten.",
"restoreForeground": "Halten Sie die App im Vordergrund.",
"restoreForegroundHint": "Bitte halten Sie die App im Vordergrund und schließen Sie sie während des Wiederherstellungsprozesses nicht, um Unterbrechungen zu vermeiden.",
"seedMigrationHint": "Der Seed gilt für alle Mints, allerdings können diese nur einzeln wiederhergestellt werden, notieren Sie also häufig verwendete Mint-URLs. Wenn Sie bereits Guthaben haben, jedoch noch kein Seed, erstellen Sie nach dem Generieren eines neuen Seeds einen Token und beanspruchen Sie ihn selbst mit der gewünschten Mint. Wiederholen Sie diesen Vorgang für jede Mint, die Sie sichern möchten.",
"ecashPayment": "Ecash Zahlung",
"english": "Englisch",
"spanish": "Spanisch",
Expand Down Expand Up @@ -113,7 +147,6 @@
"noFunds": "Nicht genügend Guthaben",
"noFundsForFee": "Nicht genug Guthaben, bitte lassen Sie Platz für eventuelle Gebühren: ~{{fee}} Sats",
"noMint": "Keine Mint gefunden",
"noProofsToBackup": "Keine Beweise verfügbar für eine Sicherung.",
"notQrCode": "Kein QR-Code!",
"noTX": "Noch keine Transaktionen",
"optionalMemo": "Optionales Memo",
Expand Down Expand Up @@ -229,9 +262,6 @@
"trustMintOpt": "Mint vertrauen",
"swapHint": "Diese Option erfordert eine Lightning-Zahlung, bringt Gebühren mit sich und kann die unbekannte Mint dennoch zur Liste hinzufügen, wenn eine Gebühren-Rückzahlung erfolgt.",
"trustHint": "Die mit dem Token verbundene Mint wird zu Ihrer Vertrauensliste hinzugefügt.",
"backupQ": "Wie funktioniert es?",
"backupHint": "Der aktuelle Sicherungsprozess stellt eine rudimentäre Umsetzung dar. Er erstellt ein Cashu-Token aus allen Mints und zugehörige Beweise, das nach neuen Transaktionen ungültig wird. Um den Token auf einem neuen Gerät wiederherzustellen, folgen Sie dem vertrauten Beanspruchungsprozess, und der alte Kontostand wird ungültig. Vermeiden Sie es, es auf dem aktuellen Kontostand einzulösen, um Fehler vorzubeugen. Es sei darauf hingewiesen, dass wir aktiv an der Entwicklung einer Sicherungslösung mit Passphrase arbeiten, um die Sicherheit und Bequemlichkeit zu verbessern.",
"singleBackupHint": "Hinweis: Sie können auch eine Sicherung für eine einzelne Mint erstellen unter 'Optionen' > 'Mint Management' > 'Mint auswählen' > 'Guthabensicherung'.",
"noDefaultHint": "Sie müssen eine Standard-Mint einrichten, um einen automatischen Tausch durchzuführen.",
"autoSwapSuccess": "Tausch erfolgreich!"
},
Expand Down Expand Up @@ -269,7 +299,6 @@
"addNewMint": "Neue Mint hinzufügen",
"atLeast2Mints": "Sie brauchen mindestens 2 Mints um einen Multimint-Tausch auszuführen.",
"awaitingInvoice": "Rechnung ausstehend.",
"backupNotCreated": "Mint-Sicherung konnte nicht erstellt werden.",
"cashOutAmountHint": "Es können Lightning-Gebühren anfallen, daher wird eine geschätzte Gebühr hinzugefügt und eventuell zu viel gezahlte Gebühren werden erstattet.",
"checkProofs": "Beweise überprüfen",
"checkProofsQ": "Alle Beweise überprüfen?",
Expand All @@ -296,7 +325,6 @@
"invalidUrl": "URL invalid",
"invoiceAmountHint": "Wählen Sie den Betrag an Ecash aus, den Sie erhalten möchten. Die Mint wird eine Rechnung erstellen, die Sie mit einer Lightning-Wallet bezahlen müssen.",
"invoiceHint": "Das kann einige Sekunden dauern...",
"lowBackupBal": "Kein Guthaben für eine Mint-Sicherung",
"lowBal": "Kein Guthaben verfügbar",
"meltAddressbookHint": "Wählen Sie Ihre eigene LNURL oder einen anderen Kontakt als Zahlungsempfänger aus.",
"meltInputHint": "Erstellen Sie eine Lightning-Rechnung oder geben Sie eine LNURL ein.",
Expand Down Expand Up @@ -338,11 +366,9 @@
"about": "Über uns",
"addressBook": "Adressbuch",
"advancedFunctions": "Erweiterte Funktionen",
"backup": "Sicherung",
"display": "Anzeige",
"history": "Transaktionsverlauf",
"language": "Sprache",
"mintBackup": "Guthabensicherung",
"mintSettings": "Mint Management",
"security": "Sicherheit",
"settings": "Optionen",
Expand Down
46 changes: 36 additions & 10 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,39 @@
"contacts": "Contacts"
},
"common": {
"copy": "Copy",
"cycle": "Cycle",
"manualCounterIncrease": "Increase counters",
"manualCounterIncreaseHint": "The counters increment automatically after each transaction, but in rare cases, this may fail, leading to errors during the restoration process. Manually raising the counters can resolve the state.",
"increaseCounterHint": "Are you sure you want to increase the counters? This should only be done if you are sure that the counters are out of sync.",
"noMintForCounter": "You have no mints to increase the counters for.",
"counterIncreased": "Counters increased by {{counterIncreased}}!",
"doneSafety": "Almost done... Safety check",
"noProofsRestored": "Found no proofs to restore your wallet.",
"restoreErr": "Something went wrong while restoring your wallet.",
"dontClose": "Please do not close the app during the process.",
"recoveryHint": "Write or paste your 12-word mnemonic in the right order, separated by blank spaces.",
"walletRecovery": "Wallet Recovery",
"walletRecoveryHint": "Use a backup seed to restore your wallet.",
"seedBackup": "Seed Backup",
"12WordMnemonic": "12-word mnemonic",
"secureWallet": "Secure wallet",
"secureWalletHint": "Generate and write down a seed backup to secure your wallet.",
"quickWallet": "Quick wallet",
"quickWalletHint": "Create a new wallet instantly. Backup seed can be generated later.",
"skipSeedHint": "You can skip this process and generate a seed backup later.",
"mnemonicHint": "The seed phrase will never be shown again. Write it down and never share it with anyone.",
"confirmMnemonicErr": "Wrong word! Please make sure to write down your seed phrase correctly in the right order.",
"selectRestoreMint": "Please select the mint that will be used to restore your funds.",
"recoveringWallet": "The mint is restoring your funds...",
"seedEnabled": "Seed recovery enabled!",
"confirmSeed": "Please confirm your seed by typing the correct word.",
"aboutToLeaveTo": "You are about to leave",
"accept": "Accept",
"addEnutsMint": "Use the eNuts mint",
"amount": "Amount",
"back": "Back",
"backToDashboard": "Back to dashboard",
"backupErr": "Something went wrong while creating the backup token.",
"balance": "Balance",
"balanceAfterTX": "Balance after TX",
"balTooLow": "Balance too low",
Expand All @@ -44,6 +70,7 @@
"cashOutFromMint": "Cash out from mint",
"change": "Change",
"claimed": "claimed",
"restored": "restored",
"claimSuccess": "Claimed {{amount}} Sats:\n{{mintUrl}}\nMemo: {{memo}}",
"claimToken": "Claim token",
"clear": "Clear",
Expand All @@ -56,7 +83,6 @@
"copied": "Copied",
"shareInvoice": "Share invoice",
"copyToken": "Copy token",
"createBackup": "Create a backup token",
"createInvoice": "Create invoice",
"createToken": "Create Token",
"createTokenErr": "Could not create a cashu token. Please try again later.",
Expand All @@ -73,6 +99,14 @@
"resetQ": "Reset your wallet?",
"delHistoryTxt": "The data can not be retrieved afterwards.",
"disclaimer": "Disclaimer",
"restoreDisclaimer": "This feature is still experimental and should be used with caution. It is not recommended to use it with large amounts of funds. Use at your own discretion. The developers, contributors, or maintainers of this software cannot be held liable for any damages, losses, or adverse effects arising from using this feature.",
"restoreBattery": "At least 20% battery.",
"restoreBatteryHint": "We recommend that you have at least 20% battery before starting the recovery process. Depending on the amount of data, the process may take a while.",
"restoreWifi": "Use Wi-Fi.",
"restoreWifiHint": "We recommend that you use a stable Wi-Fi connection for the recovery process to avoid any interruptions and to ensure a fast and secure recovery.",
"restoreForeground": "Keep the app in the foreground.",
"restoreForegroundHint": "Please keep the app in the foreground and do not close it during the recovery process to avoid any interruptions.",
"seedMigrationHint": "The seed applies to all mints, but each needs an individual restore, so note down frequently used mint URLs. If you have a balance but no seed yet, create a token from a desired mint and self-claim it after generating a new seed. Repeat for each mint you wish to backup.",
"ecashPayment": "Ecash payment",
"english": "English",
"swahili": "Swahili",
Expand Down Expand Up @@ -113,7 +147,6 @@
"noFunds": "Not enough funds",
"noFundsForFee": "Not enough funds, please leave room for potential fees: ~{{fee}} Sats",
"noMint": "Found no mint",
"noProofsToBackup": "Found no proofs to create a backup.",
"notQrCode": "Not a QR code!",
"noTX": "No transactions yet",
"optionalMemo": "Optional memo",
Expand Down Expand Up @@ -229,9 +262,6 @@
"trustMintOpt": "Trust mint",
"swapHint": "This option requires a Lightning payment, involves fees, and may still add the unknown mint to the list if a fee refund occurs.",
"trustHint": "The mint associated with the token will be added to your trusted list.",
"backupQ": "How does it work?",
"backupHint": "The existing backup process represents a rudimentary implementation. It creates a Cashu token from mints and proofs which becomes invalid after new transactions. To restore the token on a new device, follow the familiar claiming process and the old balance becomes invalid. Avoid redeeming on top of the current balance to prevent errors. It's worth mentioning that we're actively engaged in developing a seed phrase backup solution for enhanced security and convenience.",
"singleBackupHint": "Note: You can also create a backup for a single mint under 'Options' > 'Mint management' > 'Select mint' > 'Backup funds'.",
"noDefaultHint": "You need to setup a default mint to perform an auto swap.",
"autoSwapSuccess": "Swap successful!"
},
Expand Down Expand Up @@ -269,7 +299,6 @@
"addNewMint": "Add a new mint",
"atLeast2Mints": "You need at least 2 mints to perform an multimint-swap.",
"awaitingInvoice": "Awaiting invoice",
"backupNotCreated": "Backup token could not be created.",
"cashOutAmountHint": "Lightning fees may occur, so an estimated fee is added, and any overpaid fees will be refunded.",
"checkProofs": "Check proofs",
"checkProofsQ": "Check all the proofs?",
Expand All @@ -296,7 +325,6 @@
"invalidUrl": "Invalid URL",
"invoiceAmountHint": "Select the amount of Ecash you would like to receive. The mint will then create an invoice which you will have to pay using a Lightning wallet.",
"invoiceHint": "This can take a few seconds...",
"lowBackupBal": "The mint has no balance for a backup!",
"lowBal": "Mint balance too low!",
"meltAddressbookHint": "Choose your own LNURL or any other contact as a payment receiver.",
"meltInputHint": "Create a Lightning invoice or paste a LNURL into an input field.",
Expand Down Expand Up @@ -338,11 +366,9 @@
"about": "About us",
"addressBook": "Address book",
"advancedFunctions": "Advanced functions",
"backup": "Backup",
"display": "Display",
"history": "Transaction history",
"language": "Language",
"mintBackup": "Backup funds",
"mintSettings": "Mint management",
"security": "Security",
"settings": "Options",
Expand Down
Loading

0 comments on commit e717541

Please sign in to comment.