trying to fix
This commit is contained in:
parent
2c7c2d85b3
commit
d313ed037e
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,7 @@
|
||||||
# run mocha until it fails
|
# run mocha until it fails
|
||||||
|
|
||||||
COUNTER=0
|
COUNTER=0
|
||||||
while [ $? -eq 0 ]; do
|
mocha
|
||||||
|
while [ $? -ne 0 ]; do
|
||||||
mocha
|
mocha
|
||||||
done
|
done
|
||||||
|
|
|
@ -151,10 +151,10 @@ HierarchicalKey.prototype.buildExtendedPublicKey = function() {
|
||||||
r = r.put(this.eckey.public);
|
r = r.put(this.eckey.public);
|
||||||
|
|
||||||
|
|
||||||
require('chai').should;
|
//console.log('');
|
||||||
console.log('a');
|
//this.eckey.public.toString('hex');
|
||||||
console.log(this.eckey.public.length);
|
|
||||||
|
|
||||||
|
this.extendedPublicKey = new Buffer(0);
|
||||||
this.extendedPublicKey = r.buffer();
|
this.extendedPublicKey = r.buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,9 +276,14 @@ HierarchicalKey.prototype.deriveChild = function(i) {
|
||||||
|
|
||||||
ret.eckey = new Key();
|
ret.eckey = new Key();
|
||||||
ret.eckey.private = k.toBuffer({
|
ret.eckey.private = k.toBuffer({
|
||||||
size: 32
|
size: 64
|
||||||
});
|
});
|
||||||
|
console.log(k.toBuffer({
|
||||||
|
size: 32
|
||||||
|
}).toString('hex'));
|
||||||
|
//console.log(ret.eckey.private.toString('hex'));
|
||||||
ret.eckey.regenerateSync();
|
ret.eckey.regenerateSync();
|
||||||
|
//ret.eckey.public = Buffer("026557ae0a62c6957e9d9897c23e9846662d29cf9308294fa924bfecbd9522b2c1", 'hex');
|
||||||
ret.hasPrivateKey = true;
|
ret.hasPrivateKey = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -319,7 +324,6 @@ HierarchicalKey.prototype.deriveChild = function(i) {
|
||||||
|
|
||||||
ret.buildExtendedPublicKey();
|
ret.buildExtendedPublicKey();
|
||||||
ret.buildExtendedPrivateKey();
|
ret.buildExtendedPrivateKey();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,14 +291,14 @@ Key::GetPublic(Local<String> property, const AccessorInfo& info)
|
||||||
int pub_size = i2o_ECPublicKey(key->ec, NULL);
|
int pub_size = i2o_ECPublicKey(key->ec, NULL);
|
||||||
if (!pub_size) {
|
if (!pub_size) {
|
||||||
// TODO: ERROR: "Error from i2o_ECPublicKey(key->ec, NULL)"
|
// TODO: ERROR: "Error from i2o_ECPublicKey(key->ec, NULL)"
|
||||||
return scope.Close(Null());
|
return VException("Error from i2o_ECPublicKey(key->ec, NULL)");
|
||||||
}
|
}
|
||||||
unsigned char *pub_begin, *pub_end;
|
unsigned char *pub_begin, *pub_end;
|
||||||
pub_begin = pub_end = (unsigned char *)malloc(pub_size);
|
pub_begin = pub_end = (unsigned char *)malloc(pub_size);
|
||||||
|
|
||||||
if (i2o_ECPublicKey(key->ec, &pub_end) != pub_size) {
|
if (i2o_ECPublicKey(key->ec, &pub_end) != pub_size) {
|
||||||
// TODO: ERROR: "Error from i2o_ECPublicKey(key->ec, &pub)"
|
// TODO: ERROR: "Error from i2o_ECPublicKey(key->ec, &pub)"
|
||||||
return scope.Close(Null());
|
return VException("Error from i2o_ECPublicKey(key->ec, &pub)");
|
||||||
}
|
}
|
||||||
Buffer *pub_buf = Buffer::New(pub_size);
|
Buffer *pub_buf = Buffer::New(pub_size);
|
||||||
memcpy(Buffer::Data(pub_buf), pub_begin, pub_size);
|
memcpy(Buffer::Data(pub_buf), pub_begin, pub_size);
|
||||||
|
|
|
@ -307,7 +307,7 @@ describe('HierarchicalKey', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('derivation in linux', function() {
|
describe('derivation in linux', function() {
|
||||||
it.only('should not be non-deterministic', function(){
|
it('should not be non-deterministic', function(){
|
||||||
var hp = 'm/45\'';
|
var hp = 'm/45\'';
|
||||||
var sp = 'm/45';
|
var sp = 'm/45';
|
||||||
|
|
||||||
|
@ -318,8 +318,6 @@ describe('HierarchicalKey', function() {
|
||||||
//hk.derive(sp).extendedPrivateKeyString().should.equal(hk.derive(sp).extendedPrivateKeyString());
|
//hk.derive(sp).extendedPrivateKeyString().should.equal(hk.derive(sp).extendedPrivateKeyString());
|
||||||
var epk1 = hk.derive(hp).extendedPrivateKeyString();
|
var epk1 = hk.derive(hp).extendedPrivateKeyString();
|
||||||
var epk2 = hk.derive(hp).extendedPrivateKeyString();
|
var epk2 = hk.derive(hp).extendedPrivateKeyString();
|
||||||
console.log(epk1);
|
|
||||||
console.log(epk2);
|
|
||||||
epk1.should.equal(epk2);
|
epk1.should.equal(epk2);
|
||||||
//hk.derive(hp).extendedPrivateKeyString().should.equal(
|
//hk.derive(hp).extendedPrivateKeyString().should.equal(
|
||||||
// 'tprv8cSDV3fdYmUoTNGu4xRTm6qh3DPrNxPZzukM5FPdWoa9m22ALFJVGbjnU7J4TC5t3MJp293GtZWssAPuV1PNWGjXavQTnXy9xW6Lee2X6rd');
|
// 'tprv8cSDV3fdYmUoTNGu4xRTm6qh3DPrNxPZzukM5FPdWoa9m22ALFJVGbjnU7J4TC5t3MJp293GtZWssAPuV1PNWGjXavQTnXy9xW6Lee2X6rd');
|
||||||
|
|
|
@ -163,4 +163,6 @@ describe('Key', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue