Add skeleton for WebExtensions wallet
This commit is contained in:
commit
7b6706bee3
8
README
Normal file
8
README
Normal 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.
|
||||||
|
|
2
extension/background/wallet.js
Normal file
2
extension/background/wallet.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Nothing here yet.
|
||||||
|
// Eventually, the backend for the wallet will be implemented here.
|
18
extension/content_scripts/notify.js
Normal file
18
extension/content_scripts/notify.js
Normal 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");
|
||||||
|
|
BIN
extension/icons/taler-logo-24.png
Normal file
BIN
extension/icons/taler-logo-24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
41
extension/manifest.json
Normal file
41
extension/manifest.json
Normal 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"]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
7
extension/popup/reserves.html
Normal file
7
extension/popup/reserves.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<a href="javascript:history.back()">Back</a>
|
||||||
|
|
||||||
|
<p />
|
||||||
|
|
||||||
|
Your reserves are listed here.
|
7
extension/popup/transactions.html
Normal file
7
extension/popup/transactions.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<a href="javascript:history.back()">Back</a>
|
||||||
|
|
||||||
|
<p />
|
||||||
|
|
||||||
|
Your past transactions are listed here.
|
21
extension/popup/wallet.html
Normal file
21
extension/popup/wallet.html
Normal 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
12
pack
Executable 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
11
serve-testpages
Executable 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
|
16
testpages/testpage_merchant.html
Normal file
16
testpages/testpage_merchant.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user