Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Cant use this library due to crypto #122

Open
gkucmierz opened this issue Feb 11, 2017 · 12 comments
Open

Cant use this library due to crypto #122

gkucmierz opened this issue Feb 11, 2017 · 12 comments

Comments

@gkucmierz
Copy link

It is trying to use crypto.createHash method
but it is reserved in browser and it has another methods.

@bijeebuss
Copy link

Im getting an Invalid y value for curve. error in my Ionic app when calling

var mnemonic = new Mnemonic(seed);
this.walletHdPrivKey = mnemonic.toHDPrivateKey();

would that be related to this issue? I was also getting the bs58 error but after installing bs58 2.0.0 now im getting this. If so are there currently any work-arounds?

@carlosfaria94
Copy link

I think I have a similar problem with this.

TypeError: crypto.createHash is not a function
    at Object.Hash.sha256 (hash.js:18)
    at Object.Hash.sha256ripemd160 (hash.js:35)
    at Function.Address._transformPublicKey (address.js:227)
    at Function.Address.fromPublicKey (address.js:292)
    at PrivateKey.toAddress (privatekey.js:363)

I'm trying to use this lib with Angular 2 (webpack) and using crypto.createHash is getting me in troubles.

Any solution?

@bijeebuss
Copy link

I manually installed all of bitcore-libs dependencies at their exact versions into my project and it fixed the issue for me (using ionic2).

@carlosfaria94
Copy link

I fixed my problem, changing webpack config file:

node: {
           ...
            crypto: true,
            ...
        }

@rlim19
Copy link

rlim19 commented May 11, 2017

could you point the path for the webpack config file on angular 1.0.3, please? Thanks in advance

@carlosfaria94
Copy link

@rlim19

/node_modules/@angular/cli/models/webpack-configs/common.js

@ben-tuttle
Copy link

I am also getting the Invalid y value for curve. error on a Ionic 2.

I am calling Wallet = HDPrivateKey.fromSeed(seed);

I have manually installed the dependencies, but that seems to have no effect. I have setup local testing and the seeds I am generating work there, but not when I serve the ionic application.

@ben-tuttle
Copy link

I can confirm, if you install the dependencies at the give version it works. Is this a bug with your package and how npm installs it?

@matiu
Copy link
Contributor

matiu commented Sep 22, 2017 via email

@Dkdaniz
Copy link

Dkdaniz commented Feb 17, 2018

hello all,

I'm with the same error, but in Angular 5 + Ionic 3

Can someone help me?

can you tell me the step by step to solve this problem please? I've been trying to solve it for days and I'm not getting it.

` var global_keystore;
var randomSeed = Lightwallet.keystore.generateRandomSeed();
var password = "123";

console.log(randomSeed);
console.log(password);

Lightwallet.keystore.createVault({
  password: password,
  seedPhrase: randomSeed,
  //random salt 
  hdPathString: "m/0'/0'/0'"
}, function (err, ks) {

  global_keystore = ks   
  console.log(global_keystore)          
  
  });

} `

Console.log:
`
fire coast daring wheat road company switch that banana unusual other kit
123

ERRO:
polyfills.js:3 Uncaught Error: Invalid y value for curve.
at Point.validate (point.js:123)
at new PublicKey (publickey.js:53)
at Function.PublicKey.fromPrivateKey (publickey.js:221)
at PrivateKey.toPublicKey (privatekey.js:362)
at HDPrivateKey._buildFromBuffers (hdprivatekey.js:486)
at HDPrivateKey._buildFromObject (hdprivatekey.js:376)
at new HDPrivateKey (hdprivatekey.js:61)
at Function.HDPrivateKey.fromSeed (hdprivatekey.js:422)
at Mnemonic.toHDPrivateKey (mnemonic.js:207)
at KeyStore.init (keystore.js:86)`

@txreplay
Copy link

@Dkdaniz What is your elliptic version in package.json ? I had the same error and update to "^6.4.0" and it's working now.

@aasif
Copy link

aasif commented May 27, 2018

@txreplay I had a similar issue. Updating [email protected] solved my issue. I was using Ionic 3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants