mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 09:50:15 +01:00
REF: String
This commit is contained in:
parent
c0b525de8a
commit
1d2689bbb0
@ -13,7 +13,7 @@ module.exports.decrypt = function (data, password) {
|
|||||||
str = bytes.toString(CryptoJS.enc.Utf8);
|
str = bytes.toString(CryptoJS.enc.Utf8);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
// for some reason, sometimes decrypt would succeed with wrong password and return random couple of characters.
|
// for some reason, sometimes decrypt would succeed with incorrect password and return random couple of characters.
|
||||||
// at least in nodejs environment. so with this little hack we are not alowing to encrypt data that is shorter than
|
// at least in nodejs environment. so with this little hack we are not alowing to encrypt data that is shorter than
|
||||||
// 10 characters, and thus if decrypted data is less than 10 characters we assume that decrypt actually failed.
|
// 10 characters, and thus if decrypted data is less than 10 characters we assume that decrypt actually failed.
|
||||||
if (str.length < 10) return false;
|
if (str.length < 10) return false;
|
||||||
|
@ -96,11 +96,11 @@ describe('BlueWallet UI Tests', () => {
|
|||||||
.toBeVisible()
|
.toBeVisible()
|
||||||
.withTimeout(33000);
|
.withTimeout(33000);
|
||||||
|
|
||||||
// trying to decrypt with wrong password
|
// trying to decrypt with incorrect password
|
||||||
await expect(element(by.text('Your storage is encrypted. Password is required to decrypt it'))).toBeVisible();
|
await expect(element(by.text('Your storage is encrypted. Password is required to decrypt it'))).toBeVisible();
|
||||||
await element(by.type('android.widget.EditText')).typeText('wrong');
|
await element(by.type('android.widget.EditText')).typeText('wrong');
|
||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
await expect(element(by.text('Wrong password, please try again.'))).toBeVisible();
|
await expect(element(by.text('Incorrect password, please try again.'))).toBeVisible();
|
||||||
|
|
||||||
// correct password
|
// correct password
|
||||||
await element(by.type('android.widget.EditText')).typeText('qqq');
|
await element(by.type('android.widget.EditText')).typeText('qqq');
|
||||||
@ -249,7 +249,7 @@ describe('BlueWallet UI Tests', () => {
|
|||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
await element(by.type('android.widget.EditText')).typeText('fake');
|
await element(by.type('android.widget.EditText')).typeText('fake');
|
||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
await expect(element(by.text('Wrong password, please try again.'))).toBeVisible();
|
await expect(element(by.text('Incorrect password, please try again.'))).toBeVisible();
|
||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
|
|
||||||
// correct password
|
// correct password
|
||||||
@ -328,7 +328,7 @@ describe('BlueWallet UI Tests', () => {
|
|||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
await element(by.type('android.widget.EditText')).typeText('pass');
|
await element(by.type('android.widget.EditText')).typeText('pass');
|
||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
await expect(element(by.text('Wrong password, please try again.'))).toBeVisible();
|
await expect(element(by.text('Incorrect password, please try again.'))).toBeVisible();
|
||||||
await element(by.text('OK')).tap();
|
await element(by.text('OK')).tap();
|
||||||
|
|
||||||
// correct password
|
// correct password
|
||||||
|
Loading…
Reference in New Issue
Block a user