diff --git a/bitcore.js b/bitcore.js index 658a31d20..d9d8cdf4a 100644 --- a/bitcore.js +++ b/bitcore.js @@ -33,7 +33,6 @@ requireWhenAccessed('buffertools', 'buffertools'); requireWhenAccessed('Buffers.monkey', './patches/Buffers.monkey'); requireWhenAccessed('config', './config'); requireWhenAccessed('const', './const'); -requireWhenAccessed('Curve', './lib/Curve'); requireWhenAccessed('Deserialize', './lib/Deserialize'); requireWhenAccessed('ECIES', './lib/ECIES'); requireWhenAccessed('log', './util/log'); diff --git a/browser/build.js b/browser/build.js index a34aae62e..39d10805b 100644 --- a/browser/build.js +++ b/browser/build.js @@ -20,7 +20,6 @@ var modules = [ 'lib/Block', 'lib/Bloom', 'lib/Connection', - 'lib/Curve', 'lib/Deserialize', 'lib/ECIES', 'lib/Electrum', diff --git a/lib/Curve.js b/lib/Curve.js deleted file mode 100644 index 842bea77b..000000000 --- a/lib/Curve.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -var bignum = require('bignum'); -var Point = require('./Point'); - -var n = bignum.fromBuffer(new Buffer("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 'hex'), { - size: 32 -}); - - -var Curve = function() {}; - -/* secp256k1 curve */ -var G; -Curve.getG = function() { - // don't use Point in top scope, causes exception in browser - // when Point is not loaded yet - - // use cached version if available - G = G || new Point(bignum.fromBuffer(new Buffer("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 'hex'), { - size: 32 - }), - bignum.fromBuffer(new Buffer("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 'hex'), { - size: 32 - })); - return G; -}; - -Curve.getN = function() { - return n; -}; - -module.exports = Curve; diff --git a/test/index.html b/test/index.html index 8dd4bd576..aa5363132 100644 --- a/test/index.html +++ b/test/index.html @@ -23,7 +23,6 @@ - diff --git a/test/test.Curve.js b/test/test.Curve.js deleted file mode 100644 index bb6ba049b..000000000 --- a/test/test.Curve.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -var chai = chai || require('chai'); -var bitcore = bitcore || require('../bitcore'); -var coinUtil = coinUtil || bitcore.util; -var buffertools = require('buffertools'); -var bignum = bitcore.Bignum; - -var should = chai.should(); -var assert = chai.assert; - -var Curve = bitcore.Curve; - -describe('Curve', function() { - - it('should initialize the main object', function() { - should.exist(Curve); - }); - - describe('getN', function() { - it('should return a big number', function() { - var N = Curve.getN(); - should.exist(N); - N.toBuffer({size: 32}).toString('hex').length.should.equal(64); - }); - }); - - describe('getG', function() { - it('should return a Point', function() { - var G = Curve.getG(); - should.exist(G.x); - G.x.toBuffer({size: 32}).toString('hex').length.should.equal(64); - G.y.toBuffer({size: 32}).toString('hex').length.should.equal(64); - }); - }); - -}); diff --git a/test/test.Point.js b/test/test.Point.js index 722e49bff..43f7a5bf4 100644 --- a/test/test.Point.js +++ b/test/test.Point.js @@ -184,7 +184,7 @@ describe('Point', function() { describe('secp256k1 test vectors', function() { //test vectors from http://crypto.stackexchange.com/questions/784/are-there-any-secp256k1-ecdsa-test-examples-available - var G = bitcore.Curve.getG(); + var G = Point.getG(); testdata.dataSecp256k1.nTimesG.forEach(function(val) { it('should multiply n by G and get p from test data', function() { var n = new Buffer(val.n, 'hex');