-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dignifiedquire/aegir
refactor: use aegir
- Loading branch information
Showing
20 changed files
with
512 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
|
||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 4 | ||
- 5 | ||
|
||
# Make sure we have new NPM. | ||
before_install: | ||
- npm install -g npm | ||
|
||
script: | ||
- npm run lint | ||
- npm test | ||
- npm run coverage | ||
|
||
addons: | ||
firefox: 'latest' | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
|
||
after_success: | ||
- npm run coverage-publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
machine: | ||
node: | ||
version: stable | ||
|
||
dependencies: | ||
pre: | ||
- google-chrome --version | ||
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | ||
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | ||
- sudo apt-get update | ||
- sudo apt-get --only-upgrade install google-chrome-stable | ||
- google-chrome --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
'use strict' | ||
|
||
require('./create-hash') | ||
require('./create-hmac') | ||
if (!process.browser) { | ||
require('./dh') | ||
} | ||
require('./dh') | ||
|
||
require('./pbkdf2') | ||
|
||
var secure = true | ||
try { | ||
require('randombytes')(8) | ||
} catch (e) { | ||
secure = false | ||
console.log('no secure rng available') | ||
} | ||
|
||
if (secure) { | ||
require('./ecdh') | ||
require('./public-encrypt') | ||
require('./random-bytes') | ||
require('./sign') | ||
} catch (e) { | ||
console.log('no secure rng avaiable') | ||
} | ||
|
||
require('./aes') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,49 @@ | ||
var test = require('tape') | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
var expect = require('chai').expect | ||
var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'] | ||
var encodings = ['hex', 'base64'] // FIXME: test binary | ||
var vectors = require('hash-test-vectors') | ||
|
||
testLib('createHash in crypto-browserify', require('../src').createHash) | ||
describe('createHash', function () { | ||
testLib('in crypto-browserify', require('../src').createHash) | ||
|
||
function testLib (name, createHash) { | ||
algorithms.forEach(function (algorithm) { | ||
runTest(name, createHash, algorithm) | ||
}) | ||
} | ||
function testLib (name, createHash) { | ||
algorithms.forEach(function (algorithm) { | ||
runTest(name, createHash, algorithm) | ||
}) | ||
} | ||
|
||
function runTest (name, createHash, algorithm) { | ||
test(name + ' test ' + algorithm + ' against test vectors', function (t) { | ||
run(0) | ||
function run (i) { | ||
if (i >= vectors.length) { | ||
return t.end() | ||
} | ||
var obj = vectors[i] | ||
|
||
var input = new Buffer(obj.input, 'base64') | ||
var node = obj[algorithm] | ||
var js = createHash(algorithm).update(input).digest('hex') | ||
if (js !== node) { | ||
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node) | ||
} | ||
function runTest (name, createHash, algorithm) { | ||
it(name + ' test ' + algorithm + ' against test vectors', function (done) { | ||
run(0) | ||
function run (i) { | ||
if (i >= vectors.length) { | ||
return done() | ||
} | ||
var obj = vectors[i] | ||
|
||
encodings.forEach(function (encoding) { | ||
var input = new Buffer(obj.input, 'base64').toString(encoding) | ||
var input = new Buffer(obj.input, 'base64') | ||
var node = obj[algorithm] | ||
var js = createHash(algorithm).update(input, encoding).digest('hex') | ||
if (js !== node) { | ||
t.equal(js, node, algorithm + '(testVector[' + i + '], ' + encoding + ') == ' + node) | ||
} | ||
}) | ||
input = new Buffer(obj.input, 'base64') | ||
node = obj[algorithm] | ||
var hash = createHash(algorithm) | ||
hash.end(input) | ||
js = hash.read().toString('hex') | ||
if (js !== node) { | ||
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node) | ||
var js = createHash(algorithm).update(input).digest('hex') | ||
expect(js).to.be.eql(node) | ||
|
||
encodings.forEach(function (encoding) { | ||
var input = new Buffer(obj.input, 'base64').toString(encoding) | ||
var node = obj[algorithm] | ||
var js = createHash(algorithm).update(input, encoding).digest('hex') | ||
expect(js).to.be.eql(node) | ||
}) | ||
input = new Buffer(obj.input, 'base64') | ||
node = obj[algorithm] | ||
var hash = createHash(algorithm) | ||
hash.end(input) | ||
js = hash.read().toString('hex') | ||
expect(js).to.be.eql(node) | ||
|
||
setTimeout(run, 0, i + 1) | ||
} | ||
setTimeout(run, 0, i + 1) | ||
} | ||
}) | ||
} | ||
}) | ||
} | ||
}) |
Oops, something went wrong.