+it('LeftPads ethereum keys that are less than 32 bytes', function(done) {
+ // see https://github.com/iancoleman/bip39/issues/155
+ selectNetwork("ETH - Ethereum");
+ driver.findElement(By.css('#bip32-tab a'))
+ .click()
+ driver.findElement(By.css('#bip32-path'))
+ .clear();
+ driver.findElement(By.css('#bip32-path'))
+ .sendKeys("m/44'/60'/0'");
+ driver.findElement(By.css('.phrase'))
+ .sendKeys('scout sort custom elite radar rare vivid thing trophy gesture cover snake change narrow kite list nation sustain buffalo erode open balance system young');
+ driver.sleep(generateDelay).then(function() {
+ getFirstAddress(function(address) {
+ expect(address).toBe("0x8943E785B4a5714FC87a3aFAad1eB1FeB602B118");
+ done();
+ });
+ });
+});
+
+it('Can encrypt private keys using BIP38', function(done) {
+ // see https://github.com/iancoleman/bip39/issues/140
+ driver.executeScript(function() {
+ $(".use-bip38").prop("checked", true);
+ });
+ driver.findElement(By.css('.bip38-password'))
+ .sendKeys('bip38password');
+ driver.findElement(By.css('.rows-to-add'))
+ .clear();
+ driver.findElement(By.css('.rows-to-add'))
+ .sendKeys('1');
+ driver.findElement(By.css('.phrase'))
+ .sendKeys('abandon abandon ability');
+ driver.sleep(bip38delay).then(function() {
+ // address
+ getFirstRowValue(function(address) {
+ expect(address).toBe("1NCvSdumA3ngMM9c4aqU56AM6rqXddfuXB");
+ // pubkey
+ getFirstRowValue(function(pubkey) {
+ expect(pubkey).toBe("043f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3884a74447ea901729b1e73a999b7520e7cb55b4120e6432c64153ccab8a848e1");
+ // privkey
+ getFirstRowValue(function(privkey) {
+ expect(privkey).toBe("6PRNRiFnj1RoR3sXhymdCvoZCgnUHQpfupNdKkFbWJkwWQEKesWt1EDMDM");
+ done();
+ }, ".privkey");
+ }, ".pubkey");
+ }, ".address");
+ });
+}, bip38delay + 5000);
+
+it('Shows the checksum for the entropy', function(done) {
+ driver.findElement(By.css('.use-entropy'))
+ .click();
+ driver.findElement(By.css('.entropy'))
+ .sendKeys("00000000000000000000000000000000");
+ driver.sleep(generateDelay).then(function() {
+ driver.findElement(By.css('.checksum'))
+ .getText()
+ .then(function(text) {
+ expect(text).toBe("1");
+ done();
+ });
+ });
+});
+
+it('Shows the checksum for the entropy with the correct groupings', function(done) {
+ driver.findElement(By.css('.use-entropy'))
+ .click();
+ // create a checksum of 20 bits, which spans multiple words
+ driver.findElement(By.css('.entropy'))
+ .sendKeys("F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
+ driver.sleep(generateDelay).then(function() {
+ driver.findElement(By.css('.checksum'))
+ .getText()
+ .then(function(text) {
+ // first group is 9 bits, second group is 11
+ expect(text).toBe("011010111 01110000110");
+ done();
+ });
+ });
+});
+