npm module to do general purpose ethereum crypto ops
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.gitignore
Dockerfile
LICENSE
README.md
browserify.sh
package.json

README.md

Ethereum crypto module

Installation

For the mobile device run (it requires Docker to work):

./browserify.sh

The resultant single js file will be saved in bundle.js file in the same directory

To install the module globally for node.js run:

npm install eth-crypto  -g

Usage

const EthCrypto = require('eth-crypto');
var ethCrypto = new EthCrypto();

Every method returns a promise with the result.

Signing message

ethCrypto.signMessage(message,encryptedV3KeyPair,password)
.then(function(signature) {
    //do something with the signature
}).catch(function handleError(error) {
    //your error handling goes here
});

Creating a new account

ethCrypto.ethCrypto.createAccount(password)
.then(function(encryptedV3KeyPair) {
  //do something with the key pair
}).catch(function handleError(error) {
    //your error handling goes here
});

Validate signature

ethCrypto.ethCrypto.validateSignature(message,signature,address);
.then(function(result) {
  if(result) {
    console.log("Bugger.");
  } else {
    console.log("Yupee!");
  }
}).catch(function handleError(error) {
    //your error handling goes here
});

Dependencies