Skip to content

Commit

Permalink
Add additional check for window.crypto.random (#10)
Browse files Browse the repository at this point in the history
* Add additional check for window.crypto.random

* Add android crossbrowser test

* Add additional check for window.crypto.random

* Add android crossbrowser test

* Test on Android 6

* Does requirejs test pass?

* Does webpack test work?

* Keep webpack test
  • Loading branch information
sHesl authored Aug 7, 2018
1 parent a9ea66a commit 753e0b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ravelinjs",
"version": "0.0.7",
"version": "0.0.8",
"description": "Ravelin Browser Card Encryption Library.",
"main": "ravelin.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions ravelin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
}(typeof self !== 'undefined' ? self : this, function () {

var version = '0.0.7';
var version = '0.0.8';

var RSAKey = (function(){
// prng4.js - uses Arcfour as a PRNG
Expand Down Expand Up @@ -93,7 +93,7 @@
for(t = 0; t < 32; ++t)
rng_pool[rng_pptr++] = ua[t];
}
if(typeof navigator !== 'undefined' && navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto) {
if(typeof navigator !== 'undefined' && navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto && window.crypto.random) {
// Extract entropy (256 bits) from NS4 RNG if available
var z = window.crypto.random(32);
for(t = 0; t < z.length; ++t)
Expand Down
10 changes: 10 additions & 0 deletions test/crossbrowser.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ exports.config = Object.assign(base, {

webpackTestDisabled: true,
},

// Android
{
build: 'ravelinjs 1.0',
browserName: 'Chrome',
deviceName: 'Nexus 9',
platformVersion: '6.0',
platformName: 'Android',
deviceOrientation: 'portrait',
},
].filter(
// Filter the capabilities by name if there's a BROWSERS envvar.
!process.env.BROWSERS ? () => true : (b) => !!~b.name.toLowerCase().indexOf(process.env.BROWSERS.toLowerCase())
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('ravelinjs', function() {
c.cardCiphertext != "" && c.cardCiphertext.length > 10 &&
c.aesKeyCiphertext != "" && c.aesKeyCiphertext.length > 10 &&
c.algorithm == "RSA_WITH_AES_256_GCM" &&
c.ravelinjsVersion == "0.0.7"
c.ravelinjsVersion == "0.0.8"
);
}

Expand Down

0 comments on commit 753e0b5

Please sign in to comment.