Add support for 24 word seed phrases (#7987)

feature/default_network_editable
William Morriss 5 years ago committed by GitHub
parent 712f3eb637
commit 1eb828f7f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/_locales/en/messages.json
  2. 3
      ui/app/pages/first-time-flow/create-password/import-with-seed-phrase/import-with-seed-phrase.component.js
  3. 4
      ui/app/pages/first-time-flow/seed-phrase/confirm-seed-phrase/confirm-seed-phrase.component.js
  4. 3
      ui/app/pages/keychains/restore-vault.js

@ -1187,7 +1187,7 @@
"message": "Separate each word with a single space"
},
"seedPhraseReq": {
"message": "Seed phrases are 12 words long"
"message": "Seed phrases contain 12, 15, 18, 21, or 24 words"
},
"selectCurrency": {
"message": "Select Currency"

@ -73,7 +73,8 @@ export default class ImportWithSeedPhrase extends PureComponent {
if (seedPhrase) {
const parsedSeedPhrase = this.parseSeedPhrase(seedPhrase)
if (parsedSeedPhrase.split(' ').length !== 12) {
const wordCount = parsedSeedPhrase.split(new RegExp('\\s')).length
if (wordCount % 3 !== 0 || wordCount > 24 || wordCount < 12) {
seedPhraseError = this.context.t('seedPhraseReq')
} else if (!validateMnemonic(parsedSeedPhrase)) {
seedPhraseError = this.context.t('invalidSeedPhrase')

@ -271,9 +271,5 @@ function insert (list, value, target, removeOld) {
})
}
if (nextList.length > 12) {
nextList.pop()
}
return nextList
}

@ -42,7 +42,8 @@ class RestoreVaultPage extends Component {
handleSeedPhraseChange (seedPhrase) {
let seedPhraseError = null
if (seedPhrase && this.parseSeedPhrase(seedPhrase).split(' ').length !== 12) {
const wordCount = this.parseSeedPhrase(seedPhrase).split(new RegExp('\\s')).length
if (seedPhrase && (wordCount % 3 !== 0 || wordCount < 12 || wordCount > 24)) {
seedPhraseError = this.context.t('seedPhraseReq')
}

Loading…
Cancel
Save