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:
parent
712f3eb637
commit
1eb828f7f0
@ -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…
Reference in New Issue
Block a user