Skip to content

Commit 6373a97

Browse files
committed
reactivate older browsers
1 parent 6c6664d commit 6373a97

File tree

4 files changed

+42
-25
lines changed

4 files changed

+42
-25
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ matrix:
1313
- node_js: '4'
1414
env: TEST_SUITE=standard
1515
- node_js: '4'
16-
env: TEST_SUITE=browser BROWSER_NAME=ie BROWSER_VERSION="11..latest"
16+
env: TEST_SUITE=browser BROWSER_NAME=ie BROWSER_VERSION="9..latest"
1717
- node_js: '4'
1818
env: TEST_SUITE=browser BROWSER_NAME=chrome BROWSER_VERSION="44..beta"
1919
- node_js: '4'
@@ -23,9 +23,11 @@ matrix:
2323
- node_js: '4'
2424
env: TEST_SUITE=browser BROWSER_NAME=iphone BROWSER_VERSION="8.0..latest"
2525
- node_js: '4'
26-
env: TEST_SUITE=browser BROWSER_NAME=safari BROWSER_VERSION="6..latest"
26+
env: TEST_SUITE=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
2727
- node_js: '4'
2828
env: TEST_SUITE=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest"
29+
- node_js: '4'
30+
env: TEST_SUITE=browser BROWSER_NAME=opera BROWSER_VERSION="11..latest"
2931
script: "npm run-script $TEST_SUITE"
3032
env:
3133
global:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"devDependencies": {
3333
"hash-test-vectors": "~1.3.2",
34+
"pseudorandombytes": "^2.0.0",
3435
"standard": "^5.0.2",
3536
"tape": "~2.3.2",
3637
"zuul": "^3.6.0"

test/aes.js

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
var test = require('tape')
22
var crypto = require('browserify-cipher/browser')
3-
var randomBytes = require('randombytes')
3+
var randomBytes = require('pseudorandombytes')
44

5-
crypto.listCiphers().forEach(function (cipher) {
6-
test('ciphers: ' + cipher, function (t) {
7-
t.plan(1)
8-
var data = randomBytes(562)
9-
var password = randomBytes(20)
10-
var crypter = crypto.createCipher(cipher, password)
11-
var decrypter = crypto.createDecipher(cipher, password)
12-
var out = []
13-
out.push(decrypter.update(crypter.update(data)))
14-
out.push(decrypter.update(crypter.final()))
15-
if (cipher.indexOf('gcm') > -1) {
16-
decrypter.setAuthTag(crypter.getAuthTag())
17-
}
18-
out.push(decrypter.final())
19-
t.equals(data.toString('hex'), Buffer.concat(out).toString('hex'))
5+
function runIt (i) {
6+
crypto.listCiphers().forEach(function (cipher) {
7+
test('run: ' + i, function (t) {
8+
t.test('ciphers: ' + cipher, function (t) {
9+
t.plan(1)
10+
var data = randomBytes(562)
11+
var password = randomBytes(20)
12+
var crypter = crypto.createCipher(cipher, password)
13+
var decrypter = crypto.createDecipher(cipher, password)
14+
var out = []
15+
out.push(decrypter.update(crypter.update(data)))
16+
out.push(decrypter.update(crypter.final()))
17+
if (cipher.indexOf('gcm') > -1) {
18+
decrypter.setAuthTag(crypter.getAuthTag())
19+
}
20+
out.push(decrypter.final())
21+
t.equals(data.toString('hex'), Buffer.concat(out).toString('hex'))
22+
})
23+
})
2024
})
21-
})
22-
25+
if (i < 4) {
26+
setTimeout(runIt, 0, i + 1)
27+
}
28+
}
29+
runIt(1)
2330
test('getCiphers', function (t) {
2431
t.plan(1)
2532
t.ok(crypto.getCiphers().length, 'get ciphers returns an array')

test/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
require('./aes')
1+
22
require('./create-hash')
33
require('./create-hmac')
44
if (!process.browser) {
55
require('./dh')
66
}
7-
require('./ecdh')
7+
88
require('./pbkdf2')
9-
require('./public-encrypt')
10-
require('./random-bytes')
11-
require('./sign')
9+
try {
10+
require('randombytes')(8)
11+
require('./ecdh')
12+
require('./public-encrypt')
13+
require('./random-bytes')
14+
require('./sign')
15+
} catch (e) {
16+
console.log('no secure rng avaiable')
17+
}
18+
require('./aes')

0 commit comments

Comments
 (0)