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

npm / CommonJS compat #19

Closed
ryanflorence opened this issue May 10, 2011 · 20 comments
Closed

npm / CommonJS compat #19

ryanflorence opened this issue May 10, 2011 · 20 comments
Assignees

Comments

@ryanflorence
Copy link

Would be great :D

@bitwiseshiftleft
Copy link
Owner

I'm confused. Does SJCL not work with Node or CommonJS servlets? Or are you requesting some kind of packaging?

@ryanflorence
Copy link
Author

Sorry, I opened the issue too fast.

A package.json would be great, publishing to npm even better.

I scanned through the source, couldn't find any objects being exported for use on the server side like so:

var sjcl = require('sjcl');
sjcl.hash.sha1 // etc.

@jamesonjlee
Copy link

exports.sjcl = function sjcl {
///all the code
}

then when you run require, you should do
var sjcl = require('./sjcl.js').sjcl

@alessioalex
Copy link

@bitwiseshiftleft all you have to do is add the following code to ensure CommonJS compatibility for SJCL (thus to be able to have it running on Node.js out of the box):

if (module && module.exports) {
  module.exports = sjcl;
}

@bitwiseshiftleft
Copy link
Owner

Sorry to be so slow in responding to this.

These lines are already in master and ecc; I'm not sure they belong in version-0.8, though, which should really be more stable by now.

@tanx
Copy link
Contributor

tanx commented Apr 5, 2013

Hi. Added a package.json file in the following pull request:
#80

Installing it locally worked fine. Now someone just need to publish it in the npm registry:
https://npmjs.org/doc/developers.html

On a side note, I also added entropy collection for node.js in the following pull request:
#81

Looking forward to your feedback. Thanks!

@TheRook
Copy link

TheRook commented Apr 5, 2013

Adding something is still better than adding nothing. Also does this module support mobile devices yet?

@dscape
Copy link

dscape commented Apr 27, 2013

@tanx I suggest you repackage this in it's own repo and publish to npm yourself. perhaps require('cryptojs')

it's obvious that whoever put this in github is not paying attention (or cares about node)

I would also advertise in the node mailing list :)

@bitwiseshiftleft
Copy link
Owner

Yeah, sorry, I don't know anything about node, don't have a node install, and don't spend a ton of time maintaining SJCL, so it gets into a backlog.

So, what exactly are you asking me to do? Install node, then adduser and publish? And that's all I have to do, and then node will work forever, or are there more steps?

Thanks,
-- Mike

On Apr 27, 2013, at 7:12 AM, Nuno Job notifications@github.com wrote:

@tanx I suggest you repackage this in it's own repo and publish to npm yourself. perhaps `require('cryptojs')

it's obvious that whoever put this in github is not paying attention (or cares about node)

I would also advertise in the node mailing list :)


Reply to this email directly or view it on GitHub.

@tanx
Copy link
Contributor

tanx commented Apr 28, 2013

No problem. Yeah it actually is that easy. When ever you make a change to the gihtub repo, you may also want to bump the version in the package.json file so the npm registry will see the updates.

The upside is that it will make the project more visible to the node community and perhaps increase traction a bit.

@creationix
Copy link

If you don't want to maintain the node version by yourself, you can add npm
owners to a package. It works like github collaborators. These other
owners can push new updates for you to npm so that you don't need to fire
up node every time you release a new version.

On Sun, Apr 28, 2013 at 2:48 AM, Tankred Hase notifications@github.comwrote:

No problem. Yeah it actually is that easy. When ever you make a change to
the gihtub repo, you may also want to bump the version in the package.json
file so the npm registry will see the updates.

The upside is that it will make the project more visible to the node
community and perhaps increase traction a bit.


Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-17130221
.

@tanx
Copy link
Contributor

tanx commented Apr 28, 2013

@bitwiseshiftleft if you would like some help maintaining this repo (especially the node.js stuff), I would be glad to help out. We are using sjcl in a production environment in node at our company, so its definitely in our interest to invest some time.

Handling all the pull requests yourself doesn't scale too well if you don't have a lot of time, and I don't think it's in the interest of your project to be forked for node.js. What do you think? Thanks

@tanx
Copy link
Contributor

tanx commented May 14, 2013

For those of you looking for a crypto lib, that has good node.js and browser support. I can suggest forge. It's a complete TLS implementation in js with great RSA support and various hashing methods. It even supports RSA key generation in web worker threads.

The AES bits seem to be forked from sjcl.

https://github.com/digitalbazaar/forge

@tanx
Copy link
Contributor

tanx commented May 17, 2013

I wrote a high level crypto lib on top of forge that works on node.js and the browser go ahead and check it out:

https://github.com/whiteout-io/crypto-lib

@mikolalysenko
Copy link

Adding a +1 to publishing this to npm. This is a pretty easy thing to do if you already have node installed. Here is the relevant documentation:

https://npmjs.org/doc/publish.html

@Nilos
Copy link
Collaborator

Nilos commented Sep 6, 2013

There is an open PR for this:
#81
I would also love to have this merged but there are 1-2 discussion points left.
Mainly: do we want to add entropy in a synchronous or asynchronous way?
Also another thing I would like to discuss is:
if we add entropy in node and we have a long running system should we not add bits of randomness later on?
Otherwise if somebody gets to know the internal system state (e.g. via hacking the server) he could decrypt every message, couldn't he?

@ghost ghost assigned Nilos Sep 6, 2013
@Nilos
Copy link
Collaborator

Nilos commented Sep 10, 2013

Here you are guys:
https://npmjs.org/package/sjcl

@Nilos Nilos closed this as completed Sep 10, 2013
@Tectract
Copy link

It's not working for me. Can't get browserify to play nice with sjcl for the life of me.

Can someone point me to a minified / browserified version of sjcl that contains a proper commonJS wrapper, please?

@Tectract
Copy link

sjcl doesn't seem ready to be used in a rails asset pipeline. I was able to get it to precompile finally, but I'm getting sjcl not defined when I try to use it in prod...

@Tectract
Copy link

hmmmmm, I got it working in prod, but I'm not sure how exactly.

I did 'npm i sjcl', then precompiled and it succeeded. Then I REMOVED node_modules/sjcl and it's now seemingly grabbing the sjcl.js version I have from public/assets/ and loading it ok. Still shaky but barely working...

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