Skip to content

Commit

Permalink
Move to sjcl, add SRI for all js dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaals committed Aug 18, 2016
1 parent 568a118 commit d89ee30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
<!-- Bootstrap Core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.5/flatly/bootstrap.min.css" rel="stylesheet" integrity="sha256-sHwgyDk4CGNYom267UJX364ewnY4Bh55d53pxP5WDug= sha512-mkkeSf+MM3dyMWg3k9hcAttl7IVHe2BA1o/5xKLl4kBaP0bih7Mzz/DBy4y6cNZCHtE2tPgYBYH/KtEjOQYKxA==" crossorigin="anonymous">
<!-- JS --->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js" integrity="sha256-6Sr0HqNgUf/p88g6vsl87CrAnNqiOWhjlY6LS8jeWHA= sha384-V6/dyDFv85/V/Ktq3ez5B80/c9ZY7jV9c/319rqwNOz3h9CIPdd2Eve0UQBYMMr/ sha512-Lrd4lY1eAdzAhDC85I72/+oDee8Zut38nRh9fKQsssTHhm91CRwwOAwjPB0M7UtSlWryD1dHVTBbyLadXwUJDA==" crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-route.min.js" integrity="sha256-cSGSOcFF66XhVJmkBJLDSHDSYEd32PmWU4Wpc+0oRXk= sha384-vKUG6ZisndNtIFOTSdC1VoTcFLTD9Iv5KMkeIAYhTVQvXaDs6zCW1M3ceLyVccge sha512-nQ5xr3a2uSzXywQV3u71CO+D02Lw126IFf8aj5epptUpmtRwDzI4ri+DbZBYQOpGWnmWIYHHQ1Ybyo4qg0i/7A==" crossorigin="anonymous"></script>

<script type="text/javascript" src="js/app.js"></script>
<script src="https://cdn.rawgit.com/zenorocha/clipboard.js/master/dist/clipboard.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.12/clipboard.min.js" integrity="sha256-YPxFEfHAzLj9n2T+2UXAKGNCRUINk0BexppujiVhRH0= sha384-zD0rXhmVlFWUQYNE6qhnghclEAj+YgdpXMO/izgNBWhg9CZTYfQx/LlgPCUfSH7V sha512-KFWecP2K4Gw2jaWso5S9+6pOt0/Kb9O5QI/itUPLoXajRaRqLXVMPfyBWtf75VB0DO7hBhbyMINtXdLfiYrqWQ==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sjcl/1.0.0/sjcl.min.js" integrity="sha256-UC26B+OwjcmDTkG0Sn5QqmxxJMGtiTMa3hsqp4m0JdI= sha384-4ZQxwTQVe6JKB1ZW/OMGW4b82BLHuCAhJoMCHS9TKe3pflXqmyezPpR5AnxqBqs0 sha512-w+6QCvB8/xlf0o6j69H2R2am+X7PR4isJxWRXDDrRXOPLaf4r0wqHZL9rR72SWM6jPUCUD8jteKqbOULtemUcw==" crossorigin="anonymous"></script>

<!-- Custom CSS -->
<style>
body {
Expand Down
5 changes: 3 additions & 2 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ app.controller('createController', function($scope, $http) {
s.expiration = 3600;
}
var decryption_key = randomString();
encrypted = CryptoJS.AES.encrypt(s.secret, decryption_key);

encrypted = sjcl.encrypt(decryption_key, s.secret);

$http.post('/secret', {secret: encrypted.toString(), expiration: parseInt(s.expiration)})
.success(function(data, status, headers, config) {
Expand All @@ -40,7 +41,7 @@ app.controller('ViewController', function($scope, $routeParams, $http) {
$http.get('/secret/'+$routeParams.key)
.success(function(data, status, headers, config) {
$scope.display_form = false;
var secret = CryptoJS.AES.decrypt(data.secret, $decryption_key).toString(CryptoJS.enc.Utf8);
var secret = sjcl.decrypt($decryption_key, data.secret);
if(secret == "") {
$scope.errorMessage = true;
return;
Expand Down

0 comments on commit d89ee30

Please sign in to comment.