I have cloned git repository https://github.com/thejh/node-curve25519 and next used npm link
inside it. I am using this library in suggested way: var curve = require('curve25519');
. But I am getting this error on the line curve.makeSecretKey()
in this fragment:
temp.secret = crypto.randomBytes(32);
curve.makeSecretKey(temp.secret);
This is error message:
/Users/username/Workspaces/nodejs/myproject/server.js:59
curve.makeSecretKey(ctx.private);
^
TypeError: Object #<Object> has no method 'makeSecretKey'
at handlers.(anonymous function) (/Users/username/Workspaces/nodejs/myprojet/server.js:59:8)
at Socket.<anonymous> (/Users/username/Workspaces/nodejs/myproject/server.js:198:3)
at Socket.EventEmitter.emit (events.js:98:17)
at UDP.onMessage (dgram.js:440:8)
What am I doing wrong? This library should contains such method. As you can see: https://github.com/thejh/node-curve25519/blob/master/index.js
You need to also link the library from your project directory.
An example from the docs:
cd ~/projects/node-redis # go into the package directory
npm link # creates global link
cd ~/projects/node-bloggy # go into some other package directory.
npm link redis # link-install the package
In your case, the first package directory is the curve25519
git repo and if I understood your question correctly, the line you need to run in your project directory is npm link curve25519