Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
New version, 0_1_23, with option to prevent device fingerprinting
Browse files Browse the repository at this point in the history
  • Loading branch information
sponglord committed Oct 19, 2018
1 parent faa6f1e commit 8d7c4e3
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 44 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ var cseInstance = adyenEncrypt.createEncryption(key, options);

# Version History

JavaScript version 0_1_23
-------

* Options object for createEncryption can contain a boolean: 'stopDeviceFingerprint'. If set to true then device fingerprinting will not happen.

JavaScript version 0_1_22
-------

Expand Down
2 changes: 1 addition & 1 deletion adyen.encrypt.nodom.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- N.B. Make sure the library is *NOT* loaded in the "head" of the HTML document -->


<script type="text/javascript" src="js/adyen.encrypt.nodom.min.js?0_1_22"></script>
<script type="text/javascript" src="js/adyen.encrypt.nodom.min.js?0_1_23"></script>
<script type="text/javascript">

// the public key
Expand Down
4 changes: 2 additions & 2 deletions adyen.encrypt.simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

<!-- How to use the Adyen encryption client-side JS library -->
<!-- N.B. Make sure the library is *NOT* loaded in the "head" of the HTML document -->
<script type="text/javascript" src="js/adyen.encrypt.min.js?0_1_22"></script>
<!-- <script type="text/javascript" src="js/addOns/adyen.cardtype.min.js?0_1_22"></script>-->
<script type="text/javascript" src="js/adyen.encrypt.min.js?0_1_23"></script>
<!-- <script type="text/javascript" src="js/addOns/adyen.cardtype.min.js?0_1_23"></script>-->

<script type="text/javascript">

Expand Down
2 changes: 1 addition & 1 deletion js/addOns/adyen.cardtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
};

adyen.CardTypeDetection = {
version : '0_1_22',
version : '0_1_23',
getHandler : function ( cardTypeElement ) {
return function ( ev ) {

Expand Down
2 changes: 1 addition & 1 deletion js/addOns/adyen.cardtype.min.js

Large diffs are not rendered by default.

34 changes: 19 additions & 15 deletions js/adyen.encrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* * Stanford Javascript Crypto Library | http://crypto.stanford.edu/sjcl/
* * JSON in JavaScript | http://www.JSON.org/
*
* Version: 0_1_22
* Version: 0_1_23
* Author: ADYEN (c) 2014
<!DOCTYPE html>
Expand Down Expand Up @@ -62,8 +62,8 @@
<!-- How to use the Adyen encryption client-side JS library -->
<!-- N.B. Make sure the library is *NOT* loaded in the "head" of the HTML document -->
<script type="text/javascript" src="js/adyen.encrypt.min.js?0_1_22"></script>
<!-- <script type="text/javascript" src="js/addOns/adyen.cardtype.min.js?0_1_22"></script>-->
<script type="text/javascript" src="js/adyen.encrypt.min.js?0_1_23"></script>
<!-- <script type="text/javascript" src="js/addOns/adyen.cardtype.min.js?0_1_23"></script>-->
<script type="text/javascript">
Expand Down Expand Up @@ -139,7 +139,7 @@
( function (root, fnDefine) {

// Prevent libraries to die on AMD patterns
var define, exports, df = function() {return "";};
var define, exports, doDeviceFingerprint = true, df = function() {return "";};

/* typedarray.js */
(function(){try{var b=[new Uint8Array(1),new Uint32Array(1),new Int32Array(1)];return}catch(g){}function f(e,a){return this.slice(e,a)}function c(j,e){if(arguments.length<2){e=0}for(var a=0,h=j.length;a<h;++a,++e){this[e]=j[a]&255}}function d(e){var a;if(typeof e==="number"){a=new Array(e);for(var h=0;h<e;++h){a[h]=0}}else{a=e.slice(0)}a.subarray=f;a.buffer=a;a.byteLength=a.length;a.set=c;if(typeof e==="object"&&e.buffer){a.buffer=e.buffer}return a}try{window.Uint8Array=d}catch(g){}try{window.Uint32Array=d}catch(g){}try{window.Int32Array=d}catch(g){}})();(function(){try{if(typeof window==="undefined"){return}if("btoa" in window){return}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";window.btoa=function(h){var f="";var g,e;for(g=0,e=h.length;g<e;g+=3){var l=h.charCodeAt(g)&255;var k=h.charCodeAt(g+1)&255;var j=h.charCodeAt(g+2)&255;var d=l>>2,c=((l&3)<<4)|(k>>4);var o=g+1<e?((k&15)<<2)|(j>>6):64;var m=g+2<e?(j&63):64;f+=a.charAt(d)+a.charAt(c)+a.charAt(o)+a.charAt(m)}return f}}catch(b){}})();
Expand Down Expand Up @@ -276,7 +276,7 @@
}


encrypt.version = '0_1_22';
encrypt.version = '0_1_23';


/*
Expand Down Expand Up @@ -452,16 +452,20 @@
var Encryption = function ( key, options ) {
try {
if(options.randomBytes){
sjcl.random.addEntropy(options.randomBytes, 1024, "crypto.randomBytes")
sjcl.random.addEntropy(options.randomBytes, 1024, "crypto.randomBytes");
}
sjcl.random.startCollectors();
} catch ( e ) {
// what to do?
}
try {
df();
} catch (e) {


if(options.stopDeviceFingerprint === true){// if explicitly set to true

This comment has been minimized.

Copy link
@MattHeard

MattHeard May 24, 2019

This line change assumes that options is not undefined, which previously wasn't assumed. I have experienced failures because of this undocumented change in options becoming required.

I would supply a patch but the repo is marked as deprecated, so I doubt the patch would be accepted and published.

doDeviceFingerprint = false;
}
if(doDeviceFingerprint){
try {
df();
} catch (e) {}
}

this.key = key;
Expand Down Expand Up @@ -617,12 +621,12 @@

evLog('extend', data);

try {
data.dfValue = df();
} catch (e) {

if(doDeviceFingerprint){
try {
data.dfValue = df();
} catch (e) {}
}

rsa = this.createRSAKey();
aes = this.createAESKey();

Expand Down
12 changes: 6 additions & 6 deletions js/adyen.encrypt.min.js

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions js/adyen.encrypt.nodom.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* * Stanford Javascript Crypto Library | http://crypto.stanford.edu/sjcl/
* * JSON in JavaScript | http://www.JSON.org/
*
* Version: 0_1_22
* Version: 0_1_23
* Author: ADYEN (c) 2014
<!DOCTYPE html>
Expand All @@ -31,7 +31,7 @@
<!-- N.B. Make sure the library is *NOT* loaded in the "head" of the HTML document -->
<script type="text/javascript" src="js/adyen.encrypt.nodom.min.js?0_1_22"></script>
<script type="text/javascript" src="js/adyen.encrypt.nodom.min.js?0_1_23"></script>
<script type="text/javascript">
// the public key
Expand Down Expand Up @@ -138,7 +138,7 @@
( function (root, fnDefine) {

// Prevent libraries to die on AMD patterns
var define, exports, df = function() {return "";};
var define, exports, doDeviceFingerprint = true, df = function() {return "";};

/* typedarray.js */
(function(){try{var b=[new Uint8Array(1),new Uint32Array(1),new Int32Array(1)];return}catch(g){}function f(e,a){return this.slice(e,a)}function c(j,e){if(arguments.length<2){e=0}for(var a=0,h=j.length;a<h;++a,++e){this[e]=j[a]&255}}function d(e){var a;if(typeof e==="number"){a=new Array(e);for(var h=0;h<e;++h){a[h]=0}}else{a=e.slice(0)}a.subarray=f;a.buffer=a;a.byteLength=a.length;a.set=c;if(typeof e==="object"&&e.buffer){a.buffer=e.buffer}return a}try{window.Uint8Array=d}catch(g){}try{window.Uint32Array=d}catch(g){}try{window.Int32Array=d}catch(g){}})();(function(){try{if(typeof window==="undefined"){return}if("btoa" in window){return}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";window.btoa=function(h){var f="";var g,e;for(g=0,e=h.length;g<e;g+=3){var l=h.charCodeAt(g)&255;var k=h.charCodeAt(g+1)&255;var j=h.charCodeAt(g+2)&255;var d=l>>2,c=((l&3)<<4)|(k>>4);var o=g+1<e?((k&15)<<2)|(j>>6):64;var m=g+2<e?(j&63):64;f+=a.charAt(d)+a.charAt(c)+a.charAt(o)+a.charAt(m)}return f}}catch(b){}})();
Expand Down Expand Up @@ -193,7 +193,7 @@
encrypt.errors = encrypt.errors || {};


encrypt.version = '0_1_22';
encrypt.version = '0_1_23';



Expand Down Expand Up @@ -323,16 +323,20 @@
var Encryption = function ( key, options ) {
try {
if(options.randomBytes){
sjcl.random.addEntropy(options.randomBytes, 1024, "crypto.randomBytes")
sjcl.random.addEntropy(options.randomBytes, 1024, "crypto.randomBytes");
}
sjcl.random.startCollectors();
} catch ( e ) {
// what to do?
}
try {
df();
} catch (e) {


if(options.stopDeviceFingerprint === true){// if explicitly set to true
doDeviceFingerprint = false;
}
if(doDeviceFingerprint){
try {
df();
} catch (e) {}
}

this.key = key;
Expand Down Expand Up @@ -488,12 +492,12 @@

evLog('extend', data);

try {
data.dfValue = df();
} catch (e) {

if(doDeviceFingerprint){
try {
data.dfValue = df();
} catch (e) {}
}

rsa = this.createRSAKey();
aes = this.createAESKey();

Expand Down
6 changes: 3 additions & 3 deletions js/adyen.encrypt.nodom.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adyen-cse-js",
"version": "0.1.22",
"version": "0.1.23",
"description": "Adyen javascript client-side encryption library",
"main": "js/adyen.encrypt.nodom.js",
"repository": {
Expand Down

0 comments on commit 8d7c4e3

Please sign in to comment.