aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2018-02-06 10:14:22 +1100
committerIan Coleman <ian@iancoleman.io>2018-02-06 10:14:22 +1100
commite21e32da3199b9c8471bb44707f1f228a62f339b (patch)
treea4deabd759db7e14ac00123ec0bd682401145eaa /tests
parentba678b11475fab61811c67e91e19828e16d989d5 (diff)
downloadBIP39-e21e32da3199b9c8471bb44707f1f228a62f339b.tar.gz
BIP39-e21e32da3199b9c8471bb44707f1f228a62f339b.tar.zst
BIP39-e21e32da3199b9c8471bb44707f1f228a62f339b.zip
Add BIP38 test
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/tests.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index b30cbe4..9a80424 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -33,6 +33,7 @@ var driver = null;
33var generateDelay = 1500; 33var generateDelay = 1500;
34var feedbackDelay = 500; 34var feedbackDelay = 500;
35var entropyFeedbackDelay = 500; 35var entropyFeedbackDelay = 500;
36var bip38delay = 15000;
36 37
37// url uses file:// scheme 38// url uses file:// scheme
38var path = require('path') 39var path = require('path')
@@ -2876,4 +2877,34 @@ it('LeftPads ethereum keys that are less than 32 bytes', function(done) {
2876 }); 2877 });
2877}); 2878});
2878 2879
2880it('Can encrypt private keys using BIP38', function(done) {
2881 // see https://github.com/iancoleman/bip39/issues/140
2882 driver.executeScript(function() {
2883 $(".use-bip38").prop("checked", true);
2884 });
2885 driver.findElement(By.css('.bip38-password'))
2886 .sendKeys('bip38password');
2887 driver.findElement(By.css('.rows-to-add'))
2888 .clear();
2889 driver.findElement(By.css('.rows-to-add'))
2890 .sendKeys('1');
2891 driver.findElement(By.css('.phrase'))
2892 .sendKeys('abandon abandon ability');
2893 driver.sleep(bip38delay).then(function() {
2894 // address
2895 getFirstRowValue(function(address) {
2896 expect(address).toBe("1NCvSdumA3ngMM9c4aqU56AM6rqXddfuXB");
2897 // pubkey
2898 getFirstRowValue(function(pubkey) {
2899 expect(pubkey).toBe("043f5aed5f6cfbafaf223188095b5980814897295f723815fea5d3f4b648d0d0b3884a74447ea901729b1e73a999b7520e7cb55b4120e6432c64153ccab8a848e1");
2900 // privkey
2901 getFirstRowValue(function(privkey) {
2902 expect(privkey).toBe("6PRNRiFnj1RoR3sXhymdCvoZCgnUHQpfupNdKkFbWJkwWQEKesWt1EDMDM");
2903 done();
2904 }, ".privkey");
2905 }, ".pubkey");
2906 }, ".address");
2907 });
2908}, bip38delay + 5000);
2909
2879}); 2910});