Add skeleton for WebExtensions wallet

This commit is contained in:
Florian Dold 2015-11-25 20:41:31 +01:00
commit 7b6706bee3
11 changed files with 143 additions and 0 deletions

8
README Normal file
View File

@ -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.

View File

@ -0,0 +1,2 @@
// Nothing here yet.
// Eventually, the backend for the wallet will be implemented here.

View File

@ -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");

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

41
extension/manifest.json Normal file
View File

@ -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"]
}
}

View File

@ -0,0 +1,7 @@
<!doctype html>
<a href="javascript:history.back()">Back</a>
<p />
Your reserves are listed here.

View File

@ -0,0 +1,7 @@
<!doctype html>
<a href="javascript:history.back()">Back</a>
<p />
Your past transactions are listed here.

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
This is the Taler wallet.
<p />
<a href='reserves.html'>Reserves</a>
<a href='transactions.html'>Transaction History</a>
<p />
Your balance will be displayed here.
</body>
</html>

12
pack Executable file
View File

@ -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 *

11
serve-testpages Executable file
View File

@ -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

View File

@ -0,0 +1,16 @@
<!doctype html>
<script type="text/javascript">
"use strict";
function talerHandshake() {
document.addEventListener('taler-wallet-present', function(e) {
var x = document.getElementById('indicator');
x.innerHTML = 'found!';
});
var evt = new Event('taler-checkout-probe');
document.dispatchEvent(evt);
}
window.onload = (e) => talerHandshake();
</script>
Waiting for Taler wallet ... <span id='indicator'></span>