chore: update aegir

This commit is contained in:
David Dias 2017-03-21 15:05:22 +00:00
parent e0ecce18ce
commit 2f065167fa
10 changed files with 72 additions and 45 deletions

View File

@ -34,12 +34,12 @@
"license": "MIT",
"dependencies": {
"asn1.js": "^4.9.1",
"async": "^2.1.4",
"async": "^2.1.5",
"browserify-aes": "^1.0.6",
"keypair": "^1.0.1",
"libp2p-crypto-secp256k1": "^0.1.3",
"multihashing-async": "~0.4.2",
"nodeify": "^1.0.0",
"libp2p-crypto-secp256k1": "^0.1.4",
"multihashing-async": "~0.4.4",
"nodeify": "^1.0.1",
"pem-jwk": "^1.5.1",
"protocol-buffers": "^3.2.1",
"rsa-pem-to-jwk": "^1.1.3",
@ -48,13 +48,14 @@
"webcrypto-shim": "github:dignifiedquire/webcrypto-shim#master"
},
"devDependencies": {
"aegir": "^10.0.0",
"aegir": "^11.0.0",
"benchmark": "^2.1.3",
"chai": "^3.5.0",
"dirty-chai": "^1.2.2",
"pre-commit": "^1.2.2"
},
"optionalDependencies": {
"node-webcrypto-ossl": "^1.0.17"
"node-webcrypto-ossl": "^1.0.21"
},
"pre-commit": [
"lint",
@ -84,4 +85,4 @@
"greenkeeperio-bot <support@greenkeeper.io>",
"nikuda <nikuda@gmail.com>"
]
}
}

View File

@ -2,7 +2,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const series = require('async/series')
const Buffer = require('safe-buffer').Buffer
@ -25,7 +28,7 @@ describe('AES-CTR', () => {
iv.fill(1)
crypto.aes.create(key, iv, (err, cipher) => {
expect(err).to.not.exist
expect(err).to.not.exist()
series([
encryptAndDecrypt(cipher),
@ -46,17 +49,17 @@ describe('AES-CTR', () => {
iv.fill(1)
crypto.aes.create(key, iv, (err, cipher) => {
expect(err).to.not.exist
expect(err).to.not.exist()
series(fixtures[byte].inputs.map((rawIn, i) => (cb) => {
const input = Buffer.from(rawIn)
const output = Buffer.from(fixtures[byte].outputs[i])
cipher.encrypt(input, (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res).to.have.length(output.length)
expect(res).to.be.eql(output)
cipher.decrypt(res, (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res).to.be.eql(input)
cb()
})
@ -79,17 +82,17 @@ describe('AES-CTR', () => {
iv.fill(1)
crypto.aes.create(key, iv, (err, cipher) => {
expect(err).to.not.exist
expect(err).to.not.exist()
series(goFixtures[byte].inputs.map((rawIn, i) => (cb) => {
const input = Buffer.from(rawIn)
const output = Buffer.from(goFixtures[byte].outputs[i])
cipher.encrypt(input, (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res).to.have.length(output.length)
expect(res).to.be.eql(output)
cipher.decrypt(res, (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res).to.be.eql(input)
cb()
})
@ -105,9 +108,9 @@ function encryptAndDecrypt (cipher) {
data.fill(Math.ceil(Math.random() * 100))
return (cb) => {
cipher.encrypt(data, (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
cipher.decrypt(res, (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(res).to.be.eql(data)
cb()
})

View File

@ -1,7 +1,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const Buffer = require('safe-buffer').Buffer
const crypto = require('../src')
@ -231,7 +234,7 @@ describe('ed25519', () => {
let privateKey
before((done) => {
crypto.unmarshalPrivateKey(fixtures.verify.privateKey, (err, key) => {
expect(err).to.not.exist
expect(err).to.not.exist()
privateKey = key
done()
})
@ -242,7 +245,7 @@ describe('ed25519', () => {
key.verify(fixtures.verify.data, fixtures.verify.signature, (err, ok) => {
if (err) throw err
expect(err).to.not.exist
expect(err).to.not.exist()
expect(ok).to.be.eql(true)
done()
})
@ -250,7 +253,7 @@ describe('ed25519', () => {
it('generates the same signature as go', (done) => {
privateKey.sign(fixtures.verify.data, (err, sig) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(sig).to.deep.equal(fixtures.verify.signature)
done()
})

View File

@ -2,7 +2,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const parallel = require('async/parallel')
const fixtures = require('./fixtures/go-elliptic-key')
@ -27,12 +30,12 @@ describe('generateEphemeralKeyPair', () => {
(cb) => crypto.generateEphemeralKeyPair(curve, cb),
(cb) => crypto.generateEphemeralKeyPair(curve, cb)
], (err, keys) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(keys[0].key).to.have.length(lengths[curve])
expect(keys[1].key).to.have.length(lengths[curve])
keys[0].genSharedKey(keys[1].key, (err, shared) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(shared).to.have.length(secretLengths[curve])
done()
})
@ -48,7 +51,7 @@ describe('generateEphemeralKeyPair', () => {
(cb) => crypto.generateEphemeralKeyPair(curve, cb),
(cb) => crypto.generateEphemeralKeyPair(curve, cb)
], (err, res) => {
expect(err).to.not.exist
expect(err).to.not.exist()
const alice = res[0]
const bob = res[1]
bob.key = fixtures.bob.public
@ -57,7 +60,7 @@ describe('generateEphemeralKeyPair', () => {
(cb) => alice.genSharedKey(bob.key, cb),
(cb) => bob.genSharedKey(alice.key, fixtures.bob, cb)
], (err, secrets) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(
secrets[0]

View File

@ -3,7 +3,10 @@
'use strict'
const Buffer = require('safe-buffer').Buffer
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const crypto = require('../src')
@ -13,10 +16,10 @@ describe('HMAC', () => {
hashes.forEach((hash) => {
it(`${hash} - sign and verify`, (done) => {
crypto.hmac.create(hash, Buffer.from('secret'), (err, hmac) => {
expect(err).to.not.exist
expect(err).to.not.exist()
hmac.digest(Buffer.from('hello world'), (err, sig) => {
expect(err).to.not.exist
expect(err).to.not.exist()
expect(sig).to.have.length(hmac.length)
done()
})

View File

@ -2,8 +2,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const crypto = require('../src')
const fixtures = require('./fixtures/go-key-rsa')

View File

@ -2,8 +2,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const crypto = require('../src')
const fixtures = require('./fixtures/go-stretch-key')
@ -39,8 +41,8 @@ describe('keyStretcher', () => {
return done(err)
}
expect(keys.k1).to.exist
expect(keys.k2).to.exist
expect(keys.k1).to.exist()
expect(keys.k2).to.exist()
done()
})
})

View File

@ -1,7 +1,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const Buffer = require('safe-buffer').Buffer
const crypto = require('../src')
@ -169,8 +172,8 @@ describe('RSA', () => {
key.verify(fixtures.verify.data, fixtures.verify.signature, (err, ok) => {
if (err) throw err
expect(err).to.not.exist
expect(ok).to.be.eql(true)
expect(err).to.not.exist()
expect(ok).to.equal(true)
done()
})
})

View File

@ -1,7 +1,10 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const fixtures = require('./fixtures/secp256k1')
const crypto = require('../src')
@ -48,7 +51,7 @@ describe('with libp2p-crypto-secp256k1 module present', () => {
it('generates a valid key', (done) => {
expect(
key
).to.exist
).to.exist()
done()
})
@ -82,16 +85,16 @@ describe('with libp2p-crypto-secp256k1 module present', () => {
describe('without libp2p-crypto-secp256k1 module present', () => {
it('fails to generate a secp256k1 key', (done) => {
crypto.generateKeyPair('secp256k1', 256, (err, key) => {
expect(err).to.exist
expect(key).to.not.exist
expect(err).to.exist()
expect(key).to.not.exist()
done()
})
})
it('fails to unmarshal a secp256k1 private key', (done) => {
crypto.unmarshalPrivateKey(fixtures.pbmPrivateKey, (err, key) => {
expect(err).to.exist
expect(key).to.not.exist
expect(err).to.exist()
expect(key).to.not.exist()
done()
})
})

View File

@ -2,7 +2,11 @@
/* eslint-env mocha */
'use strict'
const expect = require('chai').expect
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const util = require('../src/crypto/util')
const BN = require('bn.js')