Compare commits
No commits in common. "6ec1ae888f1bf5692e3736c9a5297a6bec18006b" and "399e227815e893d3c6ed5de465d52cef249491c7" have entirely different histories.
6ec1ae888f
...
399e227815
|
@ -1,13 +0,0 @@
|
||||||
FROM node:16
|
|
||||||
|
|
||||||
RUN apt-get update
|
|
||||||
RUN apt-get install -yq --no-install-suggests --no-install-recommends xauth xvfb
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
ADD src ./src
|
|
||||||
COPY package*.json binding.gyp ./
|
|
||||||
|
|
||||||
RUN npm install
|
|
||||||
# RUN npm audit fix
|
|
||||||
|
|
||||||
COPY . .
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
mkdir -p ../out
|
|
||||||
cp package*.json ../out
|
|
||||||
npm pack
|
|
||||||
mv *.tgz ../out/
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
npm test
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
docker build --tag bitmessage-js -f .buildbot/node/Dockerfile .
|
|
||||||
docker run -it --rm bitmessage-js:latest .buildbot/node/test.sh
|
|
|
@ -104,15 +104,17 @@ var encrypted = exports.encrypted = {
|
||||||
assert(buf.readUInt16BE(16, true) === SECP256K1_TYPE, "Bad curve type");
|
assert(buf.readUInt16BE(16, true) === SECP256K1_TYPE, "Bad curve type");
|
||||||
assert(buf.readUInt16BE(18, true) === 32, "Bad Rx length");
|
assert(buf.readUInt16BE(18, true) === 32, "Bad Rx length");
|
||||||
assert(buf.readUInt16BE(52, true) === 32, "Bad Ry length");
|
assert(buf.readUInt16BE(52, true) === 32, "Bad Ry length");
|
||||||
var iv = Buffer.alloc(16);
|
var iv = new Buffer(16);
|
||||||
buf.copy(iv, 0, 0, 16);
|
buf.copy(iv, 0, 0, 16);
|
||||||
var ephemPublicKey = Buffer.alloc(70);
|
var ephemPublicKey = new Buffer(65);
|
||||||
buf.copy(ephemPublicKey, 0, 16, 86);
|
ephemPublicKey[0] = 0x04;
|
||||||
|
buf.copy(ephemPublicKey, 1, 20, 52);
|
||||||
|
buf.copy(ephemPublicKey, 33, 54, 86);
|
||||||
// NOTE(Kagami): We do copy instead of slice to protect against
|
// NOTE(Kagami): We do copy instead of slice to protect against
|
||||||
// possible source buffer modification by user.
|
// possible source buffer modification by user.
|
||||||
var ciphertext = Buffer.alloc(buf.length - 118);
|
var ciphertext = new Buffer(buf.length - 118);
|
||||||
buf.copy(ciphertext, 0, 86, buf.length - 32);
|
buf.copy(ciphertext, 0, 86, buf.length - 32);
|
||||||
var mac = Buffer.alloc(32);
|
var mac = new Buffer(32);
|
||||||
buf.copy(mac, 0, buf.length - 32);
|
buf.copy(mac, 0, buf.length - 32);
|
||||||
return {
|
return {
|
||||||
iv: iv,
|
iv: iv,
|
||||||
|
@ -124,13 +126,19 @@ var encrypted = exports.encrypted = {
|
||||||
|
|
||||||
encode: function(opts) {
|
encode: function(opts) {
|
||||||
assert(opts.iv.length === 16, "Bad IV");
|
assert(opts.iv.length === 16, "Bad IV");
|
||||||
assert(opts.ephemPublicKey.length === 70, "Bad public key");
|
assert(opts.ephemPublicKey.length === 65, "Bad public key");
|
||||||
assert(
|
|
||||||
opts.ephemPublicKey.readUInt16BE(0, true) === SECP256K1_TYPE,
|
|
||||||
"Bad curve type");
|
|
||||||
assert(opts.mac.length === 32, "Bad MAC");
|
assert(opts.mac.length === 32, "Bad MAC");
|
||||||
return Buffer.concat(
|
// 16 + 2 + 2 + 32 + 2 + 32 + ? + 32
|
||||||
[opts.iv, opts.ephemPublicKey, opts.ciphertext, opts.mac])
|
var buf = new Buffer(118 + opts.ciphertext.length);
|
||||||
|
opts.iv.copy(buf);
|
||||||
|
buf.writeUInt16BE(SECP256K1_TYPE, 16, true); // Curve type
|
||||||
|
buf.writeUInt16BE(32, 18, true); // Rx length
|
||||||
|
opts.ephemPublicKey.copy(buf, 20, 1, 33); // Rx
|
||||||
|
buf.writeUInt16BE(32, 52, true); // Ry length
|
||||||
|
opts.ephemPublicKey.copy(buf, 54, 33); // Ry
|
||||||
|
opts.ciphertext.copy(buf, 86);
|
||||||
|
opts.mac.copy(buf, 86 + opts.ciphertext.length);
|
||||||
|
return buf;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
29
package.json
29
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@bitmessage/bitmessage",
|
"name": "bitmessage",
|
||||||
"version": "0.6.7",
|
"version": "0.6.6",
|
||||||
"description": "JavaScript Bitmessage library",
|
"description": "JavaScript Bitmessage library",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.bitmessage.org/lee.miller/bitmessage-js.git"
|
"url": "https://github.com/bitchan/bitmessage.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bitmessage",
|
"bitmessage",
|
||||||
|
@ -29,29 +29,28 @@
|
||||||
"author": "Kagami Hiiragi",
|
"author": "Kagami Hiiragi",
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://git.bitmessage.org/lee.miller/bitmessage-js/issues"
|
"url": "https://github.com/bitchan/bitmessage/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://git.bitmessage.org/lee.miller/bitmessage-js",
|
"homepage": "https://github.com/bitchan/bitmessage",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"browserify": "16.5.0",
|
|
||||||
"chai": "*",
|
"chai": "*",
|
||||||
"jsdoc": "^3.3.2",
|
"jsdoc": "^3.3.2",
|
||||||
"jshint": "*",
|
"jshint": "*",
|
||||||
"karma": "6.4.1",
|
"karma": "^0.12.31",
|
||||||
"karma-browserify": "8.1.0",
|
"karma-browserify": "^2.0.0",
|
||||||
"karma-chrome-launcher": "3.1.0",
|
"karma-chrome-launcher": "^0.1.7",
|
||||||
"karma-cli": "2.0.0",
|
"karma-cli": "~0.0.4",
|
||||||
"karma-env-preprocessor": "^0.1.0",
|
"karma-env-preprocessor": "^0.1.0",
|
||||||
"karma-firefox-launcher": "1.2.0",
|
"karma-firefox-launcher": "^0.1.4",
|
||||||
"karma-mocha": "2.0.1",
|
"karma-mocha": "^0.1.10",
|
||||||
"karma-mocha-reporter": "2.2.5",
|
"karma-mocha-reporter": "^0.3.1",
|
||||||
"mocha": "*"
|
"mocha": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bn.js": "^3.0.1",
|
"bn.js": "^3.0.1",
|
||||||
"bs58": "^2.0.0",
|
"bs58": "^2.0.0",
|
||||||
"buffer-equal": "~0.0.1",
|
"buffer-equal": "~0.0.1",
|
||||||
"eccrypto": "git+https://git.bitmessage.org/Bitmessage/eccrypto.git#tests",
|
"eccrypto": "^1.0.3",
|
||||||
"es6-promise": "^3.0.2",
|
"es6-promise": "^3.0.2",
|
||||||
"hash.js": "^1.0.2",
|
"hash.js": "^1.0.2",
|
||||||
"nan": "^2.1.0",
|
"nan": "^2.1.0",
|
||||||
|
@ -60,6 +59,6 @@
|
||||||
"webworkify": "^1.0.1"
|
"webworkify": "^1.0.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"bignum": "^0.13.1"
|
"bignum": "^0.11.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <nan.h>
|
#include <nan.h>
|
||||||
#include "./pow.h"
|
#include "./pow.h"
|
||||||
|
|
||||||
// using v8::Handle;
|
using v8::Handle;
|
||||||
using v8::Local;
|
using v8::Local;
|
||||||
using v8::FunctionTemplate;
|
using v8::FunctionTemplate;
|
||||||
using v8::Function;
|
using v8::Function;
|
||||||
|
@ -71,8 +71,8 @@ NAN_METHOD(PowAsync) {
|
||||||
return Nan::ThrowError("Bad input");
|
return Nan::ThrowError("Bad input");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t pool_size = (size_t)Nan::To<uint32_t>(info[0]).FromJust();
|
size_t pool_size = info[0]->Uint32Value();
|
||||||
uint64_t target = Nan::To<int64_t>(info[1]).FromJust();
|
uint64_t target = info[1]->IntegerValue();
|
||||||
char* buf = node::Buffer::Data(info[2]);
|
char* buf = node::Buffer::Data(info[2]);
|
||||||
size_t length = node::Buffer::Length(info[2]);
|
size_t length = node::Buffer::Length(info[2]);
|
||||||
if (pool_size < 1 ||
|
if (pool_size < 1 ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user