oidc-lib
Version:
A library for creating OIDC Service Providers
124 lines (97 loc) • 4.48 kB
HTML
<!--
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
<head>
<title>Minimal Dev Wallet - Wallet Get UI</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link href="/personal/css/bootstrap.css" rel="stylesheet">
<link href="/personal/css/personal.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://unpkg.com/credential-handler-polyfill@2.1.1/dist/credential-handler-polyfill.min.js"></script>
<script src="https://unpkg.com/web-credential-handler@1.0.1/dist/web-credential-handler.min.js"></script>
<script src="config.js"></script>
<script src="js-helpers.js"></script>
<script src="mock-user-management.js"></script>
<!--Simple cookie lib-->
<script src="https://cdn.jsdelivr.net/npm/js-cookie@beta/dist/js.cookie.min.js"></script> </head>
<body>
<div id="render">
</div>
<div class="container">
<h5>Wallet get() event</h5>
<div class="card-panel hide" id="logged-in">
<div id="confirm">
<p>Origin <span id="requestOrigin"></span> is requesting information:</p>
<p><span id="requestReason"></span></p>
</div>
<div id="userArea">
<p><strong>Logged in:</strong> <span id="username"></span></p>
<a class="waves-effect waves-light btn-small" id="logoutButton">Reset and Logout</a>
<h6>Wallet Contents:</h6>
<ol id="walletContents"></ol>
</div>
</div>
<div class="card-panel hide" id="logged-out">
<p>
In order to share a credential with the requesting party:
</p>
<ol>
<li>Register a wallet with your browser (for example,
the <a href="https://chapi-demo-wallet.digitalbazaar.com/">Demo Wallet</a>).</li>
<li>Click the <strong>Login</strong> button.</li>
<li>Click on a Share button next to an appropriate credential.</li>
</ol>
<a class="waves-effect waves-light btn" id="loginButton">Login</a>
</div>
</div>
<!--script src="/personal/pwa_start.js"></script-->
<script src="/personal/js/pk.js"></script>
<script src="/personal/js/claimerClientLib.js"></script>
<script src="/personal/js/appOP.js"></script>
<script src="/personal/js/jquery-3.2.1.slim.min.js"></script>
<script src="/personal/js/popper.min.js"></script>
<script src="/personal/js/bootstrap.min.js"></script>
<script>
async function handleGetEvent() {
const event = await WebCredentialHandler.receiveCredentialEvent();
console.log('Wallet processing get() event:', event);
document.getElementById('requestOrigin').innerHTML = event.credentialRequestOrigin;
const vp = event.credentialRequestOptions.web.VerifiablePresentation;
const query = Array.isArray(vp.query) ? vp.query[0] : vp.query;
if(!query.type === 'QueryByExample') {
throw new Error('Only QueryByExample requests are supported in demo wallet.');
}
const requestReason = query.credentialQuery.reason;
document.getElementById('requestReason').innerHTML = requestReason;
refreshUserArea({
shareButton: {
text: 'Share',
sourceEvent: event
}
});
}
onDocumentReady(() => {
document.getElementById('loginButton').addEventListener('click', login);
document.getElementById('logoutButton').addEventListener('click', logout);
})
function _personal_wallet_worker_wallet_ui_get_html(){
credentialHandlerPolyfill
.loadOnce(MEDIATOR)
.then(handleGetEvent);
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
</html>