Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

NPM (nodejs) module not working #5

Closed
gregmac opened this issue Feb 9, 2015 · 5 comments
Closed

NPM (nodejs) module not working #5

gregmac opened this issue Feb 9, 2015 · 5 comments

Comments

@gregmac
Copy link

gregmac commented Feb 9, 2015

There are a few problems, just want to collect them here:

  • There is a separate dist/ directory with a checked-in build artifact from the other files, making it hard to contribute and potentially setting up difficulties (Use TravisCI for testing master/pull requests #3 should fix this)
  • There is no index.js and no "main" defined in package.json (this means to include it, you have to awkwardly do require('./node_modules/jose-jwe/dist/jose-jwt.js')
  • There are no module exports defined
  • Unit tests are only in-browser; no npm test command
  • The code uses btoa() which doesn't exist in node
@alokmenghrajani
Copy link
Contributor

Thanks for your feedback. The readme file clearly states: "This library is designed to work in the browser" which is why node.js hasn't been a priority. Adding node.js support might involve writing (or importing) a crypto polyfill (afaik node.js's crypto API is not the same as http://www.w3.org/TR/WebCryptoAPI/).

We could also keep the same JoseJWE API but build against Node's crypto API.

If you think node.js support will be valuable and you are interested to work on it, I'll be thrilled to help and/or discuss things with you!

@gregmac
Copy link
Author

gregmac commented Feb 9, 2015

Right now I'm just experimenting, but I wanted to open this issue just so there was a discussion on it.

Glad to hear you're open to contributions in this direction. If I do end up going ahead with this I will definitely start submitting some PR's.

Sounds like porting tests over will be a first step, at least to see how much is broken with node's crypto API.

@hildjj
Copy link

hildjj commented Aug 25, 2015

+1. Remove this from npm if you're not going to support node, please.

@rmhrisk
Copy link
Contributor

rmhrisk commented Aug 26, 2015

If anyone is interested in working on a polyfill for webcrypto that supports just enough to make this work, reach out to me.

alokmenghrajani pushed a commit that referenced this issue Sep 9, 2015
get rid of a console.warn that could mess with karma:with_coverage. Perhaps Travis needs it
@rmhrisk
Copy link
Contributor

rmhrisk commented Mar 25, 2016

This can probably be closed now, we are using this with node-webcrypto-ossl.

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

4 participants