Hi Mozillans,
I’m trying to convert a “jwk” formatted public-key into a PEM formatted public-key. I found a node.js library that does it(jwk-to-pem), installed it, but some of its many dependencies don’t work. And I suspect they will never work in jpm.
Specifically I get this error message after ‘jpm run’.
Message: Module util
is not found at resource://gre/modules/commonjs/util.js
Stack:
@resource://hoba/node_modules/inherits/inherits.js:1:18
@resource://hoba/node_modules/asn1.js/lib/asn1/api.js:2:16
@resource://hoba/node_modules/asn1.js/lib/asn1.js:5:15
@resource://hoba/node_modules/jwk-to-pem/src/ec.js:3:12
@resource://hoba/node_modules/jwk-to-pem/src/jwk-to-pem.js:3:10
@resource://hoba/index.js:8:16
run@resource://gre/modules/commonjs/sdk/addon/runner.js:147:19
startup/</<@resource://gre/modules/commonjs/sdk/addon/runner.js:87:9
Handler.prototype.process@resource://gre/modules/Promise-backend.js:934:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:813:7
this.PromiseWalker.scheduleWalkerLoop/<@resource://gre/modules/Promise-backend.js:747:1
I tried “npm install util --save” but that didn’t help. I don’t know what it wants.
Can I use any node-js libraries when developing in jpm? If so, which ones?
This is a recurring problem I have with doing add-on development. I just don’t know which libraries I can use. Is there an exhaustive list of libraries that I can look at that I know will work?
Or maybe I’m just an idiot and I can easily solve this error message Any help is appreciated.
Thanks,
Andrew