Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
rjaus committed Jul 7, 2021
0 parents commit dc74898
Show file tree
Hide file tree
Showing 159 changed files with 64,192 additions and 0 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
The Search Share extension is based on the PageSigner project by TLS Notary: https://github.com/tlsnotary

## Thank you
Please accept my massive thank you for trying out this app! I really appreciate any time you spend on it.

# Before using, please read!

Explainer / Blog post: https://github.com/rjaus/search-share-docs/blob/master/README.md
How to use: https://github.com/rjaus/search-share-docs/blob/master/How-to-submit.md

# How to Install this extension

## Requirement:
This extension relys upon the PageSigner companion extension, you will be prompted to install it when attempting to use SearchShare. The companion extension can be found here: https://chrome.google.com/webstore/detail/pagesigner-helper-app/oclohfdjoojomkfddjclanpogcnjhemd

Search Share works with **Chromium-based browsers** (e.g. Chromium, Vivaldi, Brave, Google Chrome)

## Install Instructions:

1. Clone or download (and extract) the [Search Share extension](https://github.com/rjaus/search-share-extension).

- Clone: `clone https://github.com/rjaus/search-share-extension.git`
- Download: https://github.com/rjaus/search-share-extension/archive/refs/heads/master.zip

2. Open Chromium

3. Go to chrome://extensions/ and enable "Developer Mode" (top right hand corner)

4. Click "Load Unpacked"

5. Select the directory where you cloned / extracted the extension

6. Now install the PageSigner Companion app (Chrome App): https://chrome.google.com/webstore/detail/pagesigner-helper-app/oclohfdjoojomkfddjclanpogcnjhemd



## Features:
This extension is a modified version of the PageSigner extension by TLS Notary. It has most of the existing features plus a few more to aid the specific use case of sharing search results.

- upon generating a proof, the proof is immediately uploaded to the Search Share API, for the purpose of sharing publicly.
- The proof is generated for the relevant page/request dependant on the search engine used. This is only relevant to DDG, which retrieves the search results via a JS request

## Permissions:
The extension requests '<all_urls>' permissions which is overkill for it's needs. If you're uncomfortable with that, replace '<all_urls>' with the following. Replace the google url with your desired country edition as required.

"https://*.duckduckgo.com/*",

"https://search.brave.com/*",

"https://bing.com/*",

"https://google.com/*"

Untested, but it should work. Check the console logs for permission errors, you may need to play with the wildcards. (note: you should be watching the console.logs of background.html, accessed via the chromium extensions settings page)
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"manifest_version": 2,

"name": "Search Share Query Proofer",
"description": "Extension to share your search engine results in a verifiable way.",
"version": "1.0",
"author": "Riley James",
"homepage_url": "https://search-share.herokuapp.com",

"permissions": [
"webRequest",
"activeTab",
"tabs",
"<all_urls>"
],

"icons": {
"64": "icon.png"
},

"browser_action": {
"default_icon": "webextension/content/icon.png",
"default_popup": "webextension/content/popup.html"
},

"background": {
"page": "webextension/content/background.html"
}

}
8 changes: 8 additions & 0 deletions webextension/content/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// var link1 = document.getElementById("link1");
// link1.addEventListener("click", function(evt) {
// sendMessage({
// 'destination': 'extension',
// 'message': 'openLink1'
// });
// window.close();
// });
Binary file added webextension/content/arrow16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webextension/content/arrow24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions webextension/content/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<head>
</head>
<body>
<script src="lib/url-pattern.js"></script>
<script type="module" src="pkijs/pagesigner_imports.js"></script>
<!-- <script src="snarkjs/snarkjs.js"></script>
<script src="snarkjs/buffer.js"></script> -->
<script src="socket.js"></script>
<script src="tlsn_utils.js"></script>
<script src="indexeddb.js"></script>
<script src="oracles.js"></script>
<script src="pako.js"></script>
<script src="tlsn.js"></script>
<script src="testing/testing.js"></script>
<script src="verifychain/verifychain.js"></script>
<script src="globals.js"></script>
<script src="main.js"></script>
</body>
</html>
Binary file added webextension/content/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webextension/content/cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions webextension/content/file_picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//Because file picker doesn't work from popup.html we open a new tab just for this purpose
var is_chrome = window.navigator.userAgent.match('Chrome') ? true : false;
var is_file_picker = false; //toggled to true when invoked as a file picker

function prepare_testing(){
var script = document.createElement('script');
script.src = 'testing/file_picker_test.js';
document.body.appendChild(script);
}


//triggered by exrension
function showFilePicker(){
is_file_picker = true
var label = document.getElementById("import_label");
label.style.display = "";

var fileChooser = document.getElementById("import");
fileChooser.addEventListener('change', function(evt) {
var f = evt.target.files[0];
if (f) {
var reader = new FileReader();
reader.onload = onload;
reader.readAsArrayBuffer(f);
}
});
}





function onload(e) {
var loader = document.getElementById("loader");
loader.classList.toggle("m-fadeIn");
loader.removeAttribute('hidden');
var import_label = document.getElementById("import_label");
//import_label.style.display = 'none'
import_label.classList.toggle("m-fadeOut");


var contents = e.target.result;
var view = new DataView(contents);
var int_array = [];
for (var i = 0; i < view.byteLength; i++) {
int_array.push(view.getUint8(i));
}
console.log('will send array now');
if (!is_chrome) {
var port = chrome.runtime.connect({
name: "filepicker-to-extension"
});
port.postMessage({
'destination': 'extension',
'message': 'import',
'args': {
'data': int_array
}
});
} else {
chrome.runtime.sendMessage({
'destination': 'extension',
'message': 'import',
'args': {
'data': int_array
}
});
}
//don't close the window, we reuse it to display html
//window.close();
}

5 changes: 5 additions & 0 deletions webextension/content/globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//globals from main.js cannot be overridden in nodejs unless we put them in a separate file
var chosen_notary;
var is_chrome = window.navigator.userAgent.match('Chrome') ? true : false;
//Future use: use TLS extension when user selects it in options
var use_max_fragment_length = false;
Binary file added webextension/content/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webextension/content/icon_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webextension/content/import.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dc74898

Please sign in to comment.