aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/scripts/lib/seed-phrase-verifier.js2
-rw-r--r--test/unit/seed-phrase-verifier-test.js44
2 files changed, 45 insertions, 1 deletions
diff --git a/app/scripts/lib/seed-phrase-verifier.js b/app/scripts/lib/seed-phrase-verifier.js
index 97a433fd8..1f35c2c67 100644
--- a/app/scripts/lib/seed-phrase-verifier.js
+++ b/app/scripts/lib/seed-phrase-verifier.js
@@ -30,7 +30,7 @@ const seedPhraseVerifier = {
}
for (let i = 0; i < restoredAccounts.length; i++) {
- if (restoredAccounts[i] !== createdAccounts[i]) {
+ if (restoredAccounts[i].toLowerCase() !== createdAccounts[i].toLowerCase()) {
return reject(new Error('Not identical accounts! Original: ' + createdAccounts[i] + ', Restored: ' + restoredAccounts[i]))
}
}
diff --git a/test/unit/seed-phrase-verifier-test.js b/test/unit/seed-phrase-verifier-test.js
index a7a463dd3..3e9acfa82 100644
--- a/test/unit/seed-phrase-verifier-test.js
+++ b/test/unit/seed-phrase-verifier-test.js
@@ -33,6 +33,50 @@ describe('SeedPhraseVerifier', function () {
let result = await seedPhraseVerifier.verifyAccounts(createdAccounts, seedWords)
})
+ it('should be able to verify created account (upper case) with seed words', async function () {
+
+ let keyringController = new KeyringController({
+ initState: clone(firstTimeState),
+ encryptor: mockEncryptor,
+ })
+ assert(keyringController)
+
+ let vault = await keyringController.createNewVaultAndKeychain(password)
+ let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
+
+ let createdAccounts = await primaryKeyring.getAccounts()
+ assert.equal(createdAccounts.length, 1)
+ let upperCaseAccounts = [createdAccounts[0].toUpperCase()]
+
+ let serialized = await primaryKeyring.serialize()
+ let seedWords = serialized.mnemonic
+ assert.notEqual(seedWords.length, 0)
+
+ let result = await seedPhraseVerifier.verifyAccounts(upperCaseAccounts, seedWords)
+ })
+
+ it('should be able to verify created account (lower case) with seed words', async function () {
+
+ let keyringController = new KeyringController({
+ initState: clone(firstTimeState),
+ encryptor: mockEncryptor,
+ })
+ assert(keyringController)
+
+ let vault = await keyringController.createNewVaultAndKeychain(password)
+ let primaryKeyring = keyringController.getKeyringsByType(hdKeyTree)[0]
+
+ let createdAccounts = await primaryKeyring.getAccounts()
+ assert.equal(createdAccounts.length, 1)
+ let lowerCaseAccounts = [createdAccounts[0].toLowerCase()]
+
+ let serialized = await primaryKeyring.serialize()
+ let seedWords = serialized.mnemonic
+ assert.notEqual(seedWords.length, 0)
+
+ let result = await seedPhraseVerifier.verifyAccounts(lowerCaseAccounts, seedWords)
+ })
+
it('should return error with good but different seed words', async function () {
let keyringController = new KeyringController({