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

Using ssh2 in the browser with forge? #331

Closed
creationix opened this issue Oct 15, 2015 · 7 comments
Closed

Using ssh2 in the browser with forge? #331

creationix opened this issue Oct 15, 2015 · 7 comments

Comments

@creationix
Copy link

I know you're writing this for node using the built-in ssh bindings, but I wonder how much work it would be to have the option to work in the browser using the API provided by https://github.com/digitalbazaar/forge?

@mscdex
Copy link
Owner

mscdex commented Oct 15, 2015

As long as it provides all the necessary crypto pieces with the same API as node, it should work fine. However, forge doesn't seem to provide the same API and is also currently missing some needed functionality like DiffieHellman and Signing/Verifying support.

Another problem will be getting TCP socket support in the browser. This could be done with a Flash or WebSocket bridge I suppose, but such a bridge again would need to be node API compatible. I know someone had written a browserify module specifically for Chrome Apps that provided a net module, but I'm not sure if it's maintained and/or what the compatibility is like for that.

@creationix
Copy link
Author

Right, implementing the node APIs in the browser would work, but that's a lot of work in some cases. Node streams, for example, are incredibly complex.

It's probably not worth your trouble since this is an edge cases (ssh from the browser), but an easier method overall would be to design a simple abstraction layer used internally and write adaptors to consume both node and the other APIs.

@creationix
Copy link
Author

See the comments at creationix/js-git#122 (comment) for motivation in my use case.

@mscdex
Copy link
Owner

mscdex commented Oct 15, 2015

Right, implementing the node APIs in the browser would work, but that's a lot of work in some cases. Node streams, for example, are incredibly complex.

Doesn't readable-stream already work in the browser?

@creationix
Copy link
Author

Right, there are probably already a couple implementations of node streams, but why include all that code weight and complexity when it's not visible to the end user and you only need a fraction of the capabilities anyway?

@calvinmetcalf
Copy link

judging from browserify/diffie-hellman#16 it is at least somewhat possible to use crypto browserify with it

@mscdex
Copy link
Owner

mscdex commented Mar 5, 2016

Closing this for now as this module's main focus is node. If third-party modules like browserify and others can make this module run in the browser, then great. This module even supports using a generic stream as its underlying socket (in case you want to do it over websockets or anything else), so it should be easy to use in the browser once you have the crypto API compatibility and node streams support.

@mscdex mscdex closed this as completed Mar 5, 2016
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

3 participants