diff --git a/.aegir.js b/.aegir.js new file mode 100644 index 0000000..25fbe20 --- /dev/null +++ b/.aegir.js @@ -0,0 +1,3 @@ +module.exports = { + bundlesize: { maxSize: '155kB' } +} diff --git a/.travis.yml b/.travis.yml index 88040e7..00e0e5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ jobs: include: - stage: check script: - - npx aegir commitlint --travis + - npx aegir build --bundlesize - npx aegir dep-check - npm run lint diff --git a/package.json b/package.json index abc1dd9..ad300c5 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "release-minor": "aegir release --type minor", "release-major": "aegir release --type major", "coverage": "aegir coverage --ignore src/keys/keys.proto.js", - "size": "bundlesize -f dist/index.min.js -s 139kB" + "size": "aegir build --bundlesize" }, "keywords": [ "IPFS", @@ -36,7 +36,7 @@ "license": "MIT", "dependencies": { "asmcrypto.js": "^2.3.2", - "asn1.js": "^5.0.1", + "asn1.js": "^5.2.0", "bn.js": "^5.0.0", "browserify-aes": "^1.2.0", "bs58": "^4.0.1", @@ -44,22 +44,21 @@ "iso-random-stream": "^1.1.0", "keypair": "^1.0.1", "libp2p-crypto-secp256k1": "~0.4.0", - "multihashing-async": "~0.7.0", + "multihashing-async": "~0.8.0", "node-forge": "~0.9.1", "pem-jwk": "^2.0.0", "protons": "^1.0.1", "rsa-pem-to-jwk": "^1.1.3", "tweetnacl": "^1.0.1", - "ursa-optional": "~0.10.0" + "ursa-optional": "~0.10.1" }, "devDependencies": { - "aegir": "^19.0.5", + "aegir": "^20.4.1", "benchmark": "^2.1.4", - "bundlesize": "~0.18.0", "chai": "^4.2.0", "chai-string": "^1.5.0", "dirty-chai": "^2.0.1", - "sinon": "^7.3.2" + "sinon": "^7.5.0" }, "engines": { "node": ">=10.0.0", diff --git a/src/keys/index.js b/src/keys/index.js index 205d108..7775c71 100644 --- a/src/keys/index.js +++ b/src/keys/index.js @@ -25,7 +25,7 @@ const ErrMissingSecp256K1 = { } function typeToKey (type) { - let key = supportedKeys[type.toLowerCase()] + const key = supportedKeys[type.toLowerCase()] if (!key) { const supported = Object.keys(supportedKeys).join(' / ') throw errcode(new Error(`invalid or unsupported key type ${type}. Must be ${supported}`), 'ERR_UNSUPPORTED_KEY_TYPE') diff --git a/src/keys/key-stretcher.js b/src/keys/key-stretcher.js index cca8178..c9c5366 100644 --- a/src/keys/key-stretcher.js +++ b/src/keys/key-stretcher.js @@ -29,7 +29,7 @@ module.exports = async (cipherType, hash, secret) => { } if (!hash) { - throw errcode(new Error(`missing hash type`), 'ERR_MISSING_HASH_TYPE') + throw errcode(new Error('missing hash type'), 'ERR_MISSING_HASH_TYPE') } const cipherKeySize = cipher.keySize @@ -41,7 +41,7 @@ module.exports = async (cipherType, hash, secret) => { const m = await hmac.create(hash, secret) let a = await m.digest(seed) - let result = [] + const result = [] let j = 0 while (j < resultLength) { diff --git a/src/util.js b/src/util.js index e5f7b6b..3624bfe 100644 --- a/src/util.js +++ b/src/util.js @@ -6,7 +6,7 @@ const BN = require('asn1.js').bignum // Adapted from https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#appendix-C exports.toBase64 = function toBase64 (bn, len) { // if len is defined then the bytes are leading-0 padded to the length - let s = bn.toArrayLike(Buffer, 'be', len).toString('base64') + const s = bn.toArrayLike(Buffer, 'be', len).toString('base64') return s .replace(/(=*)$/, '') // Remove any trailing '='s diff --git a/test/helpers/test-garbage-error-handling.js b/test/helpers/test-garbage-error-handling.js index 324789c..75d8ab2 100644 --- a/test/helpers/test-garbage-error-handling.js +++ b/test/helpers/test-garbage-error-handling.js @@ -14,7 +14,7 @@ function doTests (fncName, fnc, num, skipBuffersAndStrings) { // skip this garbage because it's a buffer or a string and we were told do do that return } - let args = [] + const args = [] for (let i = 0; i < num; i++) { args.push(garbage) } diff --git a/test/keys/ephemeral-keys.spec.js b/test/keys/ephemeral-keys.spec.js index 5ad6645..57fcb00 100644 --- a/test/keys/ephemeral-keys.spec.js +++ b/test/keys/ephemeral-keys.spec.js @@ -61,7 +61,7 @@ describe('generateEphemeralKeyPair', () => { }) }) - it(`handles bad curve name`, async () => { + it('handles bad curve name', async () => { try { await crypto.keys.generateEphemeralKeyPair('bad name') } catch (err) { diff --git a/test/util.spec.js b/test/util.spec.js index bf66ccd..3688861 100644 --- a/test/util.spec.js +++ b/test/util.spec.js @@ -24,7 +24,7 @@ describe('Util', () => { }) it('toBase64 zero padding', (done) => { - let bnpad = new BN('ff', 16) + const bnpad = new BN('ff', 16) expect(util.toBase64(bnpad, 2)).to.eql('AP8') done() })