Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Clean up formatting for bitcoin wallet backup (shows when download/sa…
Browse files Browse the repository at this point in the history
…ve as)
  • Loading branch information
jkup committed Nov 27, 2016
1 parent dcc0a7a commit 148f89f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/extensions/brave/locales/en-US/app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ flashInstalled=Flash is already installed and can be enabled in Preferences > Se
goToPrefs=Open Preferences
goToAdobe=Reinstall Flash
allowFlashPlayer=Allow {{origin}} to run Flash Player?
ledgerBackupText=Your ledger keys are {{paymentId}} and {{passphrase}}
ledgerBackupText1=Brave Wallet Recovery Keys
ledgerBackupText2=Date created:
ledgerBackupText3=Recovery Key 1:
ledgerBackupText4=Recovery Key 2:
ledgerBackupText5=Note: These keys are not stored on Brave servers. These keys are your only method of recovering your Brave wallet. Save these keys in a safe place, separate from your Brave browser.
allowWidevine=Allow {{origin}} to run Google Widevine?

error=Error
Expand Down
14 changes: 13 additions & 1 deletion app/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

const fs = require('fs')
const os = require('os')
const path = require('path')
const url = require('url')
const util = require('util')
Expand All @@ -40,6 +41,7 @@ const random = require('random-lib')
const tldjs = require('tldjs')
const underscore = require('underscore')
const uuid = require('node-uuid')
const moment = require('moment')

const appActions = require('../js/actions/appActions')
const appConfig = require('../js/constants/appConfig')
Expand Down Expand Up @@ -244,9 +246,19 @@ var boot = () => {
*/

var backupKeys = (appState, action) => {
const date = moment().format('L')
const paymentId = appState.getIn(['ledgerInfo', 'paymentId'])
const passphrase = appState.getIn(['ledgerInfo', 'passphrase'])
const message = locale.translation('ledgerBackupText', {paymentId, passphrase})
const messageLines = [
locale.translation('ledgerBackupText1'),
[locale.translation('ledgerBackupText2'), date].join(' '),
'',
[locale.translation('ledgerBackupText3'), paymentId].join(' '),
[locale.translation('ledgerBackupText4'), passphrase].join(' '),
'',
locale.translation('ledgerBackupText5')
]
const message = messageLines.join(os.EOL)
const filePath = path.join(app.getPath('userData'), '/brave_wallet_recovery.txt')

fs.writeFile(filePath, message, (err) => {
Expand Down
6 changes: 5 additions & 1 deletion app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ var rendererIdentifiers = function () {
'deleteHistoryEntry',
'deleteHistoryEntries',
'deleteLedgerEntry',
'ledgerBackupText',
'ledgerBackupText1',
'ledgerBackupText2',
'ledgerBackupText3',
'ledgerBackupText4',
'ledgerBackupText5',
'editFolder',
'editBookmark',
'unmuteTabs',
Expand Down

0 comments on commit 148f89f

Please sign in to comment.