Skip to content

Commit

Permalink
Allow configurations to be patched externally (#160)
Browse files Browse the repository at this point in the history
* Allow configurations to be patched externally

- config patches can be pushed to privacypass/ec-commitments
- patches are applied when extension starts
- patches must be verified by same public key used to sign commitments

* updates for armando's comments

* Changes for Peter's feedback
  • Loading branch information
alxdavids committed Apr 21, 2020
1 parent 7396a5c commit f6f71a8
Show file tree
Hide file tree
Showing 14 changed files with 964 additions and 203 deletions.
12 changes: 10 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@
"commitmentsKey": true,
"committedNavigation": true,
"CONFIG_ID": true,
"CONFIGURATION_URL": true,
"countStoredTokens": true,
"createShake256": true,
"dev": true,
"extVersion": true,
"futureReload": true,
"GenerateNewTokens": true,
"getActiveECSettings": true,
"getBigNumFromBytes": true,
"getVerificationKey": true,
"getConfigForId": true,
"getConfigId": true,
"getConfigName": true,
"getCurvePoints": true,
Expand All @@ -65,6 +68,7 @@
"patternToRegExp": true,
"PEM": true,
"PPConfigs": true,
"processConfigPatches": true,
"processHeaders": true,
"processRedirect": true,
"redeemMethod": true,
Expand All @@ -73,6 +77,7 @@
"reloadTabForCookie": true,
"requestIdentifiers": true,
"resetSpendVars": true,
"retrieveConfiguration": true,
"sec1DecodeFromBase64": true,
"sec1DecodeFromBytes": true,
"sec1EncodeToBase64": true,
Expand All @@ -98,9 +103,12 @@
"updateBrowserTab": true,
"UpdateCallback": true,
"updateIcon": true,
"validConfigIds": true,
"validRedemptionMethods": true,
"verifyCommitments": true,
"verifyProof": true
"verifyConfiguration": true,
"verifyProof": true,
"xhrDone": true,
"xhrGoodStatus": true
},
"rules": {
"new-cap": 0,
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
SOURCES= src/crypto/keccak/keccak.js \
src/crypto/local.js \
src/ext/config.js \
src/ext/background.js \
src/ext/browserUtils.js \
src/ext/config.js \
src/ext/h2c.js \
src/ext/issuance.js \
src/ext/redemption.js \
src/ext/tokens.js \
src/ext/utils.js
LISTENER=src/ext/listeners.js
INIT=src/ext/init.js
ASN1_PATH=src/crypto/asn1
SJCL_PATH=src/crypto/sjcl

Expand Down Expand Up @@ -51,7 +52,7 @@ dist: build
zip -r ext.zip ./dist
rm -rf ./dist

addon/build.js: ${ASN1_PATH}/asn1-parser.js ${SJCL_PATH}/sjcl.js ${SOURCES} ${LISTENER}
addon/build.js: ${ASN1_PATH}/asn1-parser.js ${SJCL_PATH}/sjcl.js ${SOURCES} ${INIT} ${LISTENER}
cat $^ > $@
addon/test.js: ${ASN1_PATH}/asn1-parser.js ${SJCL_PATH}/sjcl.js ${SOURCES}
cat $^ > $@
Expand Down
5 changes: 0 additions & 5 deletions addon/manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
{

"description": "Handles passes containing cryptographically blinded tokens for bypassing internet challenge.",
"manifest_version": 2,
"name": "Privacy Pass",
"version": "2.0.5",
"icons": {
"48": "icons/ticket-48.png"
},

"background": {
"scripts": [
"build.js"
]
},

"permissions": [
"alarms",
"cookies",
Expand All @@ -24,11 +21,9 @@
"webRequestBlocking",
"webNavigation"
],

"browser_action": {
"default_icon": "icons/ticket-empty-32.png",
"default_title": "Privacy Pass",
"default_popup": "popup/bc-plugin.html"
}

}
2 changes: 1 addition & 1 deletion addon/popup/bc-plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div id="popup-http" class="popup-http">
<div class="header">
<span><img id="privacypass" src="../icons/ticket-1.svg"></span>
<h1>Privacy Pass<br><font size="1">Version 2.0.5</font></h1>
<span id="header-text"></span>
</div>

<script src="bc-plugin.js"></script>
Expand Down
8 changes: 8 additions & 0 deletions addon/popup/bc-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@
let background = chrome.extension.getBackgroundPage();
if (background) {
background.UpdateCallback = UpdatePopup;
// update version text
document.getElementById("header-text").innerHTML = `<h1>Privacy Pass<br><font size="1">Version ${background.extVersion()}</font></h1>`;
} else {
browser.runtime.sendMessage({
callback: UpdatePopup,
});
// update version text
browser.runtime.sendMessage({
version: true,
}).then((extVersion) => {
document.getElementById("header-text").innerHTML = `<h1>Privacy Pass<br><font size="1">Version ${extVersion}</font></h1>`;
});
}

/**
Expand Down
Loading

0 comments on commit f6f71a8

Please sign in to comment.