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

Add callback to make key gen async #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

johnhaley81
Copy link

This will allow the caller to pass in a callback so it doesn't block the event loop while generating the key. Pretty simple change, anything else you'd like me to add?

@juliangruber
Copy link
Owner

nice one! would you mind adding documentation as well?

@johnhaley81
Copy link
Author

Nope! I'll get that up right now.

@juliangruber
Copy link
Owner

hmm, so this actually only runs off the event loop if you're on a browser, right? i don't see a child_process.spawn in there. if that's the case, we should make sure to document that as well.

@juliangruber
Copy link
Owner

also, if this only works in webworkers, we would be easier off just requiring the user to use keypair inside a webworker

@mrjonny2
Copy link

When is this pull likely to be merged?

};
}

var keypair = forge.rsa.generateKeyPair(null, null, opts, wrappedCallback);
Copy link

@jgrosso jgrosso Sep 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either null should be undefined or the definition of generateKeyPair should check these parameters for null as well as undefined (https://github.com/juliangruber/keypair/blob/master/index.js#L4310 and https://github.com/juliangruber/keypair/blob/master/index.js#L4313). Otherwise, I don't think the default values for these options will be set correctly.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimmiehansson
Copy link

Keep in mind that spawning a child process is contextually time consuming as well and could block more than simply calculating the entropy

@juliangruber
Copy link
Owner

When is this pull likely to be merged?

When all the concerns are addressed. See my two comments above yours

@johnhaley81
Copy link
Author

@jimmiehansson @juliangruber I definitely don't have the bandwidth to keep moving this along. If somebody wants to jump in, is there a way to change ownership of a PR?

@juliangruber
Copy link
Owner

Afaik they need to create a new one :| But we can link to this one to keep the context

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

Successfully merging this pull request may close these issues.

5 participants