Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EricLarch committed Dec 4, 2015
0 parents commit d6c20bf
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ledger Blue : chrome extension for Slack

This is a proof of concept to showcase how the Ledger Blue can be used to secure communication channels such as Slack.
1 change: 1 addition & 0 deletions background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello!
8 changes: 8 additions & 0 deletions bridge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
injectScript(chrome.extension.getURL( "/" ), "inject.js");

function injectScript (aBasePath, aScriptURL) {
var codeInjection = document.createElement("script");
codeInjection.src = aBasePath + aScriptURL;
codeInjection.async = false;
(document.body || document.head || document.documentElement).appendChild(codeInjection);
}
31 changes: 31 additions & 0 deletions inject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
initSlackBridge();

function initSlackBridge() {
$("#message-input").off("keydown");
$("#message-input").on("keydown", function(event) {
if (event.which == 13) {
onMessageSubmit();
}
});
$("#message-form").attr('onsubmit', "onMessageSubmit(); return false;");
}
function onMessageSubmit() {
message = $("#message-input").val();
message = message.rot13();
$("#message-input").val(message)
TS.view.submit();
$("#message-input").val(undefined)
}
function unscramble() {
$.each($(".message_body"), function(index,e) {
text = $(e).text();
$(e).text(text.rot13());
});
}

String.prototype.rot13 = function(){
return this.replace(/[a-zA-Z]/g, function(c){
return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
});
};

4 changes: 4 additions & 0 deletions jquery-2.1.4.min.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Ledger Blue Slack extension",
"description": "Encrypt a slack chat room using the Blue API",
"version": "0.1",
"content_scripts": [
{
"matches": ["https://*.slack.com/*"],
"js": ["jquery-2.1.4.min.js", "bridge.js"]
}
],
"background": {
"page": "background.html"
},
"web_accessible_resources": [ "inject.js" ],
"manifest_version": 2
}

0 comments on commit d6c20bf

Please sign in to comment.