addressing issues found by codacy

pull/431/head
El RIDO 2018-10-20 22:05:35 +02:00
parent 0f76b9066d
commit 717e5b0e57
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
5 changed files with 8 additions and 10 deletions

View File

@ -13,7 +13,6 @@ env:
node: true
globals:
sjcl: false
DOMPurify: false
after: true
before: true

View File

@ -2,7 +2,7 @@
"bitwise": true,
"curly": true,
"eqeqeq": true,
"esversion": 5,
"esversion": 6,
"forin": true,
"freeze": true,
"futurehostile": true,
@ -39,7 +39,6 @@
"window": true
},
"globals": {
"sjcl": true,
"DOMPurify": true,
"kjua": true
}

View File

@ -736,7 +736,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
{name: 'PBKDF2'}, // we use PBKDF2 for key derivation
false, // the key may not be exported
['deriveKey'] // we may only use it for key derivation
)
);
// derive a stronger key for use with AES
const derivedKey = await window.crypto.subtle.deriveKey(
@ -754,7 +754,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
},
false, // the key may not be exported
['encrypt'] // we may only use it for decryption
)
);
// finally, encrypt message
const encrypted = await window.crypto.subtle.encrypt(
@ -767,7 +767,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
},
derivedKey,
StrToArr(compress(message)) // compressed plain text to encrypt
)
);
object.ct = btoa(ArrToStr(encrypted));
return JSON.stringify(object);
};
@ -821,7 +821,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
},
false, // the key may not be exported
['decrypt'] // we may only use it for decryption
)
);
// finally, decrypt message
const decrypted = await window.crypto.subtle.decrypt(
@ -834,7 +834,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
},
derivedKey,
StrToArr(atob(object.ct)) // cipher text to decrypt
)
);
return decompress(ArrToStr(decrypted));
} catch(err) {
return '';

View File

@ -70,7 +70,7 @@ if ($MARKDOWN):
endif;
?>
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-op63EWMfaSPghE5cG+5iyYHS8Llg12VRNTQNrX1r/ehT78RFJxN6CTFjxq3E0tHd4iCtAtCA1FwrkvVgbX47zw==" crossorigin="anonymous"></script>
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-kn3yqj5KEEjhNS3Z/2WZT/e9vLtpxOXmeBbn1liPgw8EUvlSbDLdrSbcGKrDX16Zochji2pDMNMZOTLuTm9CFA==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->

View File

@ -48,7 +48,7 @@ if ($MARKDOWN):
endif;
?>
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-op63EWMfaSPghE5cG+5iyYHS8Llg12VRNTQNrX1r/ehT78RFJxN6CTFjxq3E0tHd4iCtAtCA1FwrkvVgbX47zw==" crossorigin="anonymous"></script>
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-kn3yqj5KEEjhNS3Z/2WZT/e9vLtpxOXmeBbn1liPgw8EUvlSbDLdrSbcGKrDX16Zochji2pDMNMZOTLuTm9CFA==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->