1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Add support for 24 word seed phrases (#7987)

This commit is contained in:
William Morriss 2020-02-06 14:25:45 -08:00 committed by GitHub
parent 712f3eb637
commit 1eb828f7f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View File

@ -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"

View File

@ -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')

View File

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

View File

@ -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')
}