Add es6-promise dependency
Since it needed only for node version.
This commit is contained in:
parent
6bd50e7ddd
commit
600dc6e4bb
|
@ -4,12 +4,6 @@ JavaScript Bitmessage library for both browserify and node.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
You need ES6 Promise available in order to use this module. Use some sort of ES6 runtime or just apply polyfill:
|
|
||||||
|
|
||||||
```js
|
|
||||||
require("es6-promise").polyfill();
|
|
||||||
```
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var bitmessage = require("bitmessage");
|
var bitmessage = require("bitmessage");
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
var Promise = require("es6-promise").Promise; // jshint ignore:line
|
||||||
var crypto = require("crypto");
|
var crypto = require("crypto");
|
||||||
|
|
||||||
exports.sha512 = function(buf) {
|
exports.sha512 = function(buf) {
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
"homepage": "https://github.com/nekogrid/bitmessage",
|
"homepage": "https://github.com/nekogrid/bitmessage",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "*",
|
"chai": "*",
|
||||||
"es6-promise": "^2.0.1",
|
|
||||||
"jshint": "*",
|
"jshint": "*",
|
||||||
"mocha": "*"
|
"mocha": "*"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"es6-promise": "^2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
test.js
7
test.js
|
@ -1,11 +1,10 @@
|
||||||
var expect = require("chai").expect;
|
var expect = require("chai").expect;
|
||||||
|
|
||||||
require("es6-promise").polyfill();
|
var bmcrypto = require("./lib/crypto");
|
||||||
var crypto = require("./lib/crypto");
|
|
||||||
|
|
||||||
describe("crypto", function() {
|
describe("Bitmessage crypto", function() {
|
||||||
it("should calculate sha512 hash for both node and browserify", function(done) {
|
it("should calculate sha512 hash for both node and browserify", function(done) {
|
||||||
crypto.sha512(new Buffer("test")).then(function(res) {
|
bmcrypto.sha512(new Buffer("test")).then(function(res) {
|
||||||
expect(res.toString("hex")).to.equal("ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff");
|
expect(res.toString("hex")).to.equal("ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user