-
Notifications
You must be signed in to change notification settings - Fork 9
/
wallet-worker.html
40 lines (36 loc) · 1.28 KB
/
wallet-worker.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<title>Minimal Dev Wallet - Worker</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="https://unpkg.com/[email protected]/dist/credential-handler-polyfill.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/web-credential-handler.min.js"></script>
<script src="config.js"></script>
</head>
<body>
<script>
async function activateWalletEventHandler() {
try {
await credentialHandlerPolyfill.loadOnce(MEDIATOR);
} catch(e) {
console.error('Error in loadOnce:', e);
}
console.log('Worker Polyfill loaded, mediator:', MEDIATOR);
return WebCredentialHandler.activateHandler({
mediatorOrigin: MEDIATOR,
async get(event) {
console.log('WCH: Received get() event:', event);
return {type: 'redirect', url: WALLET_LOCATION + 'wallet-ui-get.html'};
},
async store(event) {
console.log('WCH: Received store() event:', event);
return {type: 'redirect', url: WALLET_LOCATION + 'wallet-ui-store.html'};
}
})
}
console.log('worker.html: Activating handler, WALLET_LOCATION:', WALLET_LOCATION);
activateWalletEventHandler();
</script>
</body>
</html>