warchant/ed25519 compiled with Emscripten and wrapper for it. Use wisely in your node package.
Yarn: yarn add ed25519.js
NPM: npm install ed25519.js
After it, you can use it with require('ed25519.js')
This library produces buffers of bytes and requires buffers as input
Generating keypair
var ed25519 = require('ed25519.js')
var keys = ed25519.createKeyPair() //Generate keypair
console.log(keys.publicKey) // Generated public key, stored as buffer
console.log(keys.privateKey) // Generated private key, stored as buffer
Deriving public key, signing and verifying message
var ed25519 = require('ed25519.js')
// Example private key, parsed from hex string as buffer
var privateKey = Buffer.from('9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60', 'hex')
// Derived public key, stored as buffer
var publicKey = ed25519.derivePublicKey(privateKey)
// Message, stored as buffer
var message = Buffer.from('Cool message', 'utf8')
// Signing message
var signature = ed25519.sign(message, publicKey, privateKey)
// Verifying message
var isVerified = ed25519.verify(signature, message, publicKey)
console.log(isVerified)
You can test typescript examples by running this command
node -r ts-node/register .examples/createKeyPair.ts
- Write tests
- Use Standard.js
- Add PreCommit/Push hooks
- Write an example to readme
- License
- Create NPM package
- Migrate code to TS
- Code examples in TS
- Uglify/Minify
- TSDoc
- Compile library from C++ on the fly
- More tests