From 7b6706bee3cbecc84b330672ecdb5764d7d68756 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 25 Nov 2015 20:41:31 +0100 Subject: [PATCH] Add skeleton for WebExtensions wallet --- README | 8 ++++++ extension/background/wallet.js | 2 ++ extension/content_scripts/notify.js | 18 ++++++++++++ extension/icons/taler-logo-24.png | Bin 0 -> 1452 bytes extension/manifest.json | 41 ++++++++++++++++++++++++++++ extension/popup/reserves.html | 7 +++++ extension/popup/transactions.html | 7 +++++ extension/popup/wallet.html | 21 ++++++++++++++ pack | 12 ++++++++ serve-testpages | 11 ++++++++ testpages/testpage_merchant.html | 16 +++++++++++ 11 files changed, 143 insertions(+) create mode 100644 README create mode 100644 extension/background/wallet.js create mode 100644 extension/content_scripts/notify.js create mode 100644 extension/icons/taler-logo-24.png create mode 100644 extension/manifest.json create mode 100644 extension/popup/reserves.html create mode 100644 extension/popup/transactions.html create mode 100644 extension/popup/wallet.html create mode 100755 pack create mode 100755 serve-testpages create mode 100644 testpages/testpage_merchant.html diff --git a/README b/README new file mode 100644 index 000000000..4bfb203d8 --- /dev/null +++ b/README @@ -0,0 +1,8 @@ +Cross-browser Taler wallet written for the WebExtensions API. +See https://developer.mozilla.org/en-US/Add-ons/WebExtensions + +Installation +============ + +Run ./pack to create the taler-wallet.xpi file. + diff --git a/extension/background/wallet.js b/extension/background/wallet.js new file mode 100644 index 000000000..a7a9c6cb6 --- /dev/null +++ b/extension/background/wallet.js @@ -0,0 +1,2 @@ +// Nothing here yet. +// Eventually, the backend for the wallet will be implemented here. diff --git a/extension/content_scripts/notify.js b/extension/content_scripts/notify.js new file mode 100644 index 000000000..3a0f9001d --- /dev/null +++ b/extension/content_scripts/notify.js @@ -0,0 +1,18 @@ +// Script that is injected into pages in order to allow merchants pages to +// query the availability of Taler. + + +// Listen to messages from the backend. +chrome.runtime.onMessage.addListener( + function(request, sender, sendResponse) { + // do nothing, yet +}); + + +document.addEventListener('taler-checkout-probe', function(e) { + let evt = new Event('taler-wallet-present'); + document.dispatchEvent(evt); +}); + +console.log("Taler wallet: content page loaded"); + diff --git a/extension/icons/taler-logo-24.png b/extension/icons/taler-logo-24.png new file mode 100644 index 0000000000000000000000000000000000000000..00a908e79ca86f2aefa9f167280ab19a2c2395c8 GIT binary patch literal 1452 zcmZ`(c{J2}6#tH0)0$d)5ZdA685vW+$G*Pri?ckc2zcln%q&;8@l9qcW{4#^z?0Ek&x5*;Cwg-k|B z0P?O2nkWePdX zu;>AR;X?q9QSzEdIH(|S*~Wqh4t~kgmeO=6BTTV$xe9>DkzWP_IeE}6~oW!F<)}$c8NTr%Y8#I6jNmrZSc;H#1sB?=H-dmC_Y>B253$F6Naa(W#$A zKM{u#laua1rQ*+sWZA3cH=I8EdD6S2h0AVcXqXu zRn&eSA0JAyFU`T&iG;Gtmj%~Jp)&-*f>Z|87?Gd9)GbBtWcy*7+(;RDD%KTDmEih| z^8Fi+OyFG$8kuTdKdv)IuGFOn`UP~eA|@OH0yxJP!go3v8a6ZK<(C{$=~ERIEba|k z+YC#0_b2Y<8N2db`?VMAsbrTQC8fR!;@=h*(TbVWCI!BKIyd>-8xvmG{E+tUY8Hxo>i`p`YQT>K!*AZj%dZt|0p+nufT zr8$C=^^NnQ#rl2MNj{P^U2zK?&O3ZjCgPR7&ZC#rp&fPO7~6W+@<5)g&Y_`o89R~R zh2*$AtJ^qn1>DPL#l^Fg^#Py4Th=!JLOw`Jzg#0^t-7--i2v<&!EsrQqom67{iCCV z^Up8Q+uPe$dKi7P0h_0TGv}Z8q$dudV719o;jgfQRKHfEFOFs z5^g}jdoqG;iX8_kGNYIkYEpK>LVw3Fhp))!2QxfkV&DvINzc>`@Cfl z1Py;)dS)$(rYpwKM!%o)&6m7>N&fBf5rX7mviVmLmYcB$gH`(sYrWu5<4g;db@m&2 zV?ZPjF>(n=%}I1T!s9ZtGiVH^RAi}IhwBrZ-xF_(a0|b7jbweiHTnL1!(*DRGkI%f zAp=}vQ3;8T&T3&YwuqdCv!0$%v?WaLT&L3h)+R*lG zp`1@nq;taqGcz-Z>ifLC8&vrRmV6^G+)sAh-;bA3e{5o#&gX2`&* zccXC9lx!l91N?yhD_A+O*h}v>p=_z`EA3?!K_BcyxS4Y}*)!bR&@0Rv0-%G|*404& wQYUR~Lk!jsja5hM7^2bU^D_AV5Q0L;{ytIvPtb3Az6TM2m6<)U%G4wNU$$C>wg3PC literal 0 HcmV?d00001 diff --git a/extension/manifest.json b/extension/manifest.json new file mode 100644 index 000000000..b0ad9720e --- /dev/null +++ b/extension/manifest.json @@ -0,0 +1,41 @@ +{ + "description": "Privacy preserving and transparent payments", + "manifest_version": 2, + "name": "Taler Wallet", + "version": "1.0", + + "applications": { + "gecko": { + "id": "devs@taler.net" + } + }, + + "permissions": [ + "http://*/*", + "https://*/*" + ], + + "browser_action": { + "default_icon": "icons/taler-logo-24.png", + "default_title": "Taler", + "default_popup": "popup/wallet.html" + }, + + "web_accessible_resources": [ + "popup/reserves.html", + "popup/wallet.html" + ], + + "content_scripts": [ + { + "matches": ["*://*/*"], + "js": ["content_scripts/notify.js"], + "run_at": "document_start" + } + ], + + "background": { + "scripts": ["background/wallet.js"] + } + +} diff --git a/extension/popup/reserves.html b/extension/popup/reserves.html new file mode 100644 index 000000000..63db032e5 --- /dev/null +++ b/extension/popup/reserves.html @@ -0,0 +1,7 @@ + + +Back + +

+ +Your reserves are listed here. diff --git a/extension/popup/transactions.html b/extension/popup/transactions.html new file mode 100644 index 000000000..427100853 --- /dev/null +++ b/extension/popup/transactions.html @@ -0,0 +1,7 @@ + + +Back + +

+ +Your past transactions are listed here. diff --git a/extension/popup/wallet.html b/extension/popup/wallet.html new file mode 100644 index 000000000..f27387b1d --- /dev/null +++ b/extension/popup/wallet.html @@ -0,0 +1,21 @@ + + + + + + + + + This is the Taler wallet. + +

+ + Reserves + Transaction History + +

+ + Your balance will be displayed here. + + + diff --git a/pack b/pack new file mode 100755 index 000000000..a8779b37c --- /dev/null +++ b/pack @@ -0,0 +1,12 @@ +#!/bin/bash + +# Pack up the extension as an xpi file. + +set +x + +# directory where our script resides +mydir="$(dirname "$(readlink -f "$0")")" + +cd "$mydir/extension" + +exec zip -r ../taler-wallet.xpi * diff --git a/serve-testpages b/serve-testpages new file mode 100755 index 000000000..b0451cd1f --- /dev/null +++ b/serve-testpages @@ -0,0 +1,11 @@ +#!/bin/bash + +# Start a web server on port 8000 to serve test pages for the wallet extension. + +set +x + +# directory where our script resides +mydir="$(dirname "$(readlink -f "$0")")" + +cd "$mydir/testpages/" +exec python3 -m http.server 8000 diff --git a/testpages/testpage_merchant.html b/testpages/testpage_merchant.html new file mode 100644 index 000000000..1598cc046 --- /dev/null +++ b/testpages/testpage_merchant.html @@ -0,0 +1,16 @@ + + + +Waiting for Taler wallet ...