Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navigator is not defined #5

Closed
kYuZz opened this issue Dec 15, 2016 · 11 comments
Closed

navigator is not defined #5

kYuZz opened this issue Dec 15, 2016 · 11 comments

Comments

@kYuZz
Copy link

kYuZz commented Dec 15, 2016

To reproduce, create an empty file and save it with the name index.js:

require('pidcrypt/seedrandom')
const pidCrypt = require('pidcrypt')
require('pidcrypt/rsa')

Running node index.js outputs this error:

node_modules/pidcrypt/jsbn.js:100
if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
            ^

ReferenceError: navigator is not defined
    at Object.<anonymous> (/home/kyuzz/Projects/test-ig-api/node_modules/pidcrypt/jsbn.js:100:13)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/kyuzz/Projects/test-ig-api/node_modules/pidcrypt/rsa.js:63:18)
    at Module._compile (module.js:556:32)
@rabbitlair
Copy link

Same here, I have the exact same error when using last pidCrypt version.

@kambajwa
Copy link

same issue here, any updates ??

@kambajwa
Copy link

Any updates on this issue ??

@joseSantacruz
Copy link

any update???

@kambajwa
Copy link

@joseSantacruz sorry, i'haven't received any updates either but i comment out the

&& (navigator.appName == "Microsoft Internet Explorer")
or you can always use
navigator = {appName:'VM'};

as a temporary fix until you have any thing..

@kevinkga
Copy link
Contributor

kevinkga commented Jul 15, 2019

It'd be quite easy to fix. I wonder why nobody has bothered? Just swap the following lines

if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {

with
``
if(j_lm && typeof navigator !== 'undefined' && (navigator.appName == "Microsoft Internet Explorer")) {
BigInteger.prototype.am = am2;
dbits = 30;
}
else if(j_lm && typeof navigator !== 'undefined' && (navigator.appName != "Netscape")) {
BigInteger.prototype.am = am1;
dbits = 26;
}

@ChristophDietrich
Copy link

ChristophDietrich commented Jun 6, 2020

Please make all forkers a happy day, do an update here ;)

Would be awesome! @nikvdp

@nikvdp
Copy link
Owner

nikvdp commented Jun 13, 2020

merged!

@nikvdp nikvdp closed this as completed Jun 13, 2020
@esellin
Copy link

esellin commented Aug 6, 2020

A new version published on NPM would be awesome!

@kea0811
Copy link

kea0811 commented Feb 18, 2021

@nikvdp hello, will you consider to published the merge version in npm?

@nikvdp
Copy link
Owner

nikvdp commented Feb 18, 2021

@kea0811 @esellin published!

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

No branches or pull requests

9 participants