]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/blobdiff - tests/spec/tests.js
Pad eth private keys correctly
[perso/Immae/Projets/Cryptomonnaies/BIP39.git] / tests / spec / tests.js
index f350fa7a3d60db80a1d60138f54b97fa7db4f964..d57b7536ddf68d22f96bf963e663194297ada03d 100644 (file)
@@ -651,7 +651,7 @@ it('Allows selection of namecoin', function(done) {
         phrase: "abandon abandon ability",
         firstAddress: "Mw2vK2Bvex1yYtYF6sfbEg2YGoUc98YUD2",
         firstPubKey: "0398066486fe87cbcb9da8e29d180b44937b6c43ad1ec4d3bddd77b7905765937e",
-        firstPrivKey: "L4A8sSkrGndiXyZdj6Fnju8Wu76s96cdHHmPxV3C5M2R2w4GVNco",
+        firstPrivKey: "TkJvbqVdNnGsCtFaV2nE8x3qqhYnYriRkGAB4747cEDRg9VUKKiz",
     };
     testNetwork(done, params);
 });
@@ -917,6 +917,16 @@ it('Allows selection of Aryacoin', function(done) {
     };
     testNetwork(done, params);
 });
+it('Allows selection of Cosmos Hub', function(done) {
+    var params = {
+        selectText: "ATOM - Cosmos Hub",
+        phrase: "abandon abandon ability",
+        firstAddress: "cosmos17mkch9syem8gtf6wh7p38thdgav6dwezpkylny",
+        firstPubKey: "cosmospub1addwnpepq0sgn66ty4suk5vx3hsmxxqd5z3amegqwlu59funrzyz5u8r9758qhl84ys",
+        firstPrivKey: "zUnETPxmE2vkHzLHTAlO9wg8PL/GEEBc1I4yVwvSV8M=",
+    };
+    testNetwork(done, params);
+});
 it('Allows selection of Auroracoin', function(done) {
     var params = {
         selectText: "AUR - Auroracoin",
@@ -1641,7 +1651,7 @@ it('Allows selection of Ritocoin', function(done) {
         phrase: "abandon abandon ability",
         firstAddress: "BMbHdwDiuaZh4ATp8Xapf4srv3swzAGgkf",
         firstPubKey: "036f5f55dc37fa97294a2a5ae4d92735d4392d4405cbbebebf2d70d5d6781be622",
-        firstPrivKey: "L1CyVD5ADNgSUxZn6kRpJe9e17FDuAZzRGwNjvDBnEqRWjo4SEAX",
+        firstPrivKey: "Mdaumz3494kxCeiEBame4ZBzjtTQ5mYzD8notv2EBW8FcNy3PiYd",
     };
     testNetwork(done, params);
 });
@@ -5112,4 +5122,26 @@ it('Generates ethereum addresses from a public key', function(done) {
     });
 });
 
+// https://github.com/iancoleman/bip39/issues/469
+fit('Generates ethereum private keys with the correct padding', function(done) {
+  var phrase = "flip vicious divorce angle toward say derive blue refuse load word creek once expire bounce";
+  let withoutPadding = "0x53121fc5d193e623d2dbf43b2a96640bbed16bd530947fff8dda12f1aec828";
+  let withPadding = "0x0053121fc5d193e623d2dbf43b2a96640bbed16bd530947fff8dda12f1aec828";
+  let skIndex = 15;
+  driver.findElement(By.css('.phrase'))
+      .sendKeys(phrase);
+    selectNetwork('ETH - Ethereum');
+    driver.sleep(generateDelay).then(function() {
+        driver.findElements(By.css(".privkey"))
+            .then(function(els) {
+                els[skIndex].getText()
+                    .then(function(sk) {
+                        expect(sk).toBe(withPadding);
+                        expect(sk).not.toBe(withoutPadding);
+                        done();
+                    });
+            })
+    });
+});
+
 });