Start to implement node wrapper

This commit is contained in:
Kagami Hiiragi 2014-12-23 23:28:40 +03:00
parent 1ccc88dd97
commit bade7b61fa
3 changed files with 13 additions and 3 deletions

View File

@ -0,0 +1,3 @@
var secp256k1 = require("secp256k1");
exports.getPublic = secp256k1.createPublicKey.bind(null);

View File

@ -5,7 +5,7 @@
"main": "index.js", "main": "index.js",
"browser": "browser.js", "browser": "browser.js",
"scripts": { "scripts": {
"test": "mocha && xvfb-run -a karma start && jshint .", "test": "mocha && jshint .",
"m": "mocha", "m": "mocha",
"k": "xvfb-run -a karma start", "k": "xvfb-run -a karma start",
"kc": "xvfb-run -a karma start --browsers Chromium", "kc": "xvfb-run -a karma start --browsers Chromium",
@ -44,5 +44,8 @@
"karma-mocha": "^0.1.10", "karma-mocha": "^0.1.10",
"karma-mocha-reporter": "^0.3.1", "karma-mocha-reporter": "^0.3.1",
"mocha": "*" "mocha": "*"
},
"dependencies": {
"secp256k1": "~0.0.13"
} }
} }

View File

@ -1,6 +1,10 @@
var expect = require("chai").expect; var expect = require("chai").expect;
var eccrypto = require("./");
describe("test", function() { describe("Key", function() {
it("just test", function() { it("should allow to convert private key to public", function() {
var privateKey = Buffer(32);
privateKey.fill(1);
expect(eccrypto.getPublic(privateKey).toString("hex")).to.equal("041b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f70beaf8f588b541507fed6a642c5ab42dfdf8120a7f639de5122d47a69a8e8d1");
}); });
}); });