trying to fix

This commit is contained in:
Manuel Araoz 2014-06-12 11:26:39 -03:00
parent 2c7c2d85b3
commit d313ed037e
6 changed files with 18 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@
# run mocha until it fails
COUNTER=0
while [ $? -eq 0 ]; do
mocha
while [ $? -ne 0 ]; do
mocha
done

View File

@ -151,10 +151,10 @@ HierarchicalKey.prototype.buildExtendedPublicKey = function() {
r = r.put(this.eckey.public);
require('chai').should;
console.log('a');
console.log(this.eckey.public.length);
//console.log('');
//this.eckey.public.toString('hex');
this.extendedPublicKey = new Buffer(0);
this.extendedPublicKey = r.buffer();
}
@ -276,9 +276,14 @@ HierarchicalKey.prototype.deriveChild = function(i) {
ret.eckey = new Key();
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.public = Buffer("026557ae0a62c6957e9d9897c23e9846662d29cf9308294fa924bfecbd9522b2c1", 'hex');
ret.hasPrivateKey = true;
} else {
@ -319,7 +324,6 @@ HierarchicalKey.prototype.deriveChild = function(i) {
ret.buildExtendedPublicKey();
ret.buildExtendedPrivateKey();
return ret;
}

View File

@ -291,14 +291,14 @@ Key::GetPublic(Local<String> property, const AccessorInfo& info)
int pub_size = i2o_ECPublicKey(key->ec, NULL);
if (!pub_size) {
// 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;
pub_begin = pub_end = (unsigned char *)malloc(pub_size);
if (i2o_ECPublicKey(key->ec, &pub_end) != pub_size) {
// 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);
memcpy(Buffer::Data(pub_buf), pub_begin, pub_size);

View File

@ -307,7 +307,7 @@ describe('HierarchicalKey', 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 sp = 'm/45';
@ -318,8 +318,6 @@ describe('HierarchicalKey', function() {
//hk.derive(sp).extendedPrivateKeyString().should.equal(hk.derive(sp).extendedPrivateKeyString());
var epk1 = hk.derive(hp).extendedPrivateKeyString();
var epk2 = hk.derive(hp).extendedPrivateKeyString();
console.log(epk1);
console.log(epk2);
epk1.should.equal(epk2);
//hk.derive(hp).extendedPrivateKeyString().should.equal(
// 'tprv8cSDV3fdYmUoTNGu4xRTm6qh3DPrNxPZzukM5FPdWoa9m22ALFJVGbjnU7J4TC5t3MJp293GtZWssAPuV1PNWGjXavQTnXy9xW6Lee2X6rd');

View File

@ -163,4 +163,6 @@ describe('Key', function() {
});
});
});