Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "bitstore", | ||
"version": "1.0.0", | ||
"description": "A content-addressable cloud storage web service that uses Bitcoin public key infrastructure for authentication and payment.", | ||
"main": "./src/index.js", | ||
"main": "./lib/index.js", | ||
"scripts": { | ||
"browserify": "./node_modules/.bin/browserify ./src/index.js -s bitstore -o ./browser/bundle.js", | ||
"test": "mocha --timeout=5000 --reporter=spec test/" | ||
"lint": "eslint ./src ./test", | ||
"test": "mocha test/ --opts mocha.opts", | ||
"pretest": "npm run lint", | ||
"prepublish": "babel ./src --out-dir ./lib --copy-files", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
}, | ||
"release": { | ||
"debug": false, | ||
"verifyConditions": "semantic-release/dist/lib/plugin-noop" | ||
}, | ||
"bin": { | ||
"bitstore": "./src/cli.js" | ||
"bitstore": "./lib/cli.js" | ||
}, | ||
@@ -38,6 +44,13 @@ "repository": { | ||
"devDependencies": { | ||
"babel": "^5.8.23", | ||
"babel-eslint": "^4.1.3", | ||
"browserify": "^10.2.0", | ||
"chai": "^3.3.0", | ||
"cz-conventional-changelog": "^1.1.2", | ||
"eslint": "^1.6.0", | ||
"eslint-config-airbnb": "^0.1.0", | ||
"mocha": "^2.2.4", | ||
"should": "^6.0.1" | ||
} | ||
} | ||
"semantic-release": "^4.3.5" | ||
}, | ||
"version": "1.1.0" | ||
} |
@@ -1,15 +0,15 @@ | ||
var should = require('should'); | ||
var bitstore = require('../src/'); | ||
var bitcoin = require('bitcoinjs-lib'); | ||
import { expect } from 'chai'; | ||
import bitstore from '../src'; | ||
import bitcoin from 'bitcoinjs-lib'; | ||
describe('bitstore-client', function () { | ||
var client; | ||
describe('bitstore-client', () => { | ||
let client; | ||
it('should throw an error if no private key provided', function () { | ||
(function () { | ||
it('should throw an error if no private key provided', () => { | ||
expect(() => { | ||
client = bitstore(); | ||
}).should.throw(/private/i); | ||
}).to.throw(/private/i); | ||
}); | ||
it('should initialize with private key', function () { | ||
it('should initialize with private key', () => { | ||
client = bitstore({ | ||
@@ -22,8 +22,8 @@ privateKey: 'KyjhazeX7mXpHedQsKMuGh56o3rh8hm8FGhU3H6HPqfP9pA4YeoS', | ||
it('should get wallet', function (done) { | ||
client.wallet.get(function (err, res) { | ||
it('should get wallet', (done) => { | ||
client.wallet.get((err, res) => { | ||
if (err) return done(err); | ||
var wallet = res.body; | ||
wallet.address.should.equal('n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU'); | ||
wallet.total_balance.should.be.a.Number; | ||
const wallet = res.body; | ||
expect(wallet.address).to.equal('n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU'); | ||
expect(wallet.total_balance).to.be.a('number'); | ||
done(); | ||
@@ -33,20 +33,20 @@ }); | ||
it('should initialize with signMessage function', function () { | ||
it('should initialize with signMessage function', () => { | ||
client = bitstore({ | ||
network: 'testnet', | ||
address: 'n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU', | ||
signMessage: function (message) { | ||
var key = bitcoin.ECKey.fromWIF('KyjhazeX7mXpHedQsKMuGh56o3rh8hm8FGhU3H6HPqfP9pA4YeoS'); | ||
var network = bitcoin.networks.testnet; | ||
signMessage: (message) => { | ||
const key = bitcoin.ECKey.fromWIF('KyjhazeX7mXpHedQsKMuGh56o3rh8hm8FGhU3H6HPqfP9pA4YeoS'); | ||
const network = bitcoin.networks.testnet; | ||
return bitcoin.Message.sign(key, message, network).toString('base64'); | ||
} | ||
}, | ||
}); | ||
}); | ||
it('should get wallet', function (done) { | ||
client.wallet.get(function (err, res) { | ||
it('should get wallet', (done) => { | ||
client.wallet.get((err, res) => { | ||
if (err) return done(err); | ||
var wallet = res.body; | ||
wallet.address.should.equal('n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU'); | ||
wallet.total_balance.should.be.a.Number; | ||
const wallet = res.body; | ||
expect(wallet.address).to.equal('n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU'); | ||
expect(wallet.total_balance).to.be.a('number'); | ||
done(); | ||
@@ -56,26 +56,25 @@ }); | ||
it('should initialize with async signMessage function', function () { | ||
it('should initialize with async signMessage function', () => { | ||
client = bitstore({ | ||
network: 'testnet', | ||
address: 'n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU', | ||
signMessage: function (message, cb) { | ||
var key = bitcoin.ECKey.fromWIF('KyjhazeX7mXpHedQsKMuGh56o3rh8hm8FGhU3H6HPqfP9pA4YeoS'); | ||
var network = bitcoin.networks.testnet; | ||
setImmediate(function () { | ||
signMessage: (message, cb) => { | ||
const key = bitcoin.ECKey.fromWIF('KyjhazeX7mXpHedQsKMuGh56o3rh8hm8FGhU3H6HPqfP9pA4YeoS'); | ||
const network = bitcoin.networks.testnet; | ||
setImmediate(() => { | ||
cb(null, bitcoin.Message.sign(key, message, network).toString('base64')); | ||
}); | ||
} | ||
}, | ||
}); | ||
}); | ||
it('should get wallet', function (done) { | ||
client.wallet.get(function (err, res) { | ||
it('should get wallet', (done) => { | ||
client.wallet.get((err, res) => { | ||
if (err) return done(err); | ||
var wallet = res.body; | ||
wallet.address.should.equal('n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU'); | ||
wallet.total_balance.should.be.a.Number; | ||
const wallet = res.body; | ||
expect(wallet.address).to.equal('n3PDRtKoHXHNt8FU17Uu9Te81AnKLa7oyU'); | ||
expect(wallet.total_balance).to.be.a('number'); | ||
done(); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
438067
16
9
13619