forked from passwordless-id/webauthn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basic.html
57 lines (54 loc) · 2.15 KB
/
basic.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/buefy/dist/buefy.min.css">
<style>
main.container {
max-width: 640px !important;
text-align: center;
}
</style>
</head>
<body>
<main id="app" class="section container">
<img src="img/banner-biometric-auth.svg" />
<b-tag>Please note: this is a demo. Nothing is stored server side.</b-tag>
<br/>
<br/>
<template v-if="!isAuthenticated">
<b-field>
<b-input v-model="username" placeholder="Username" @input="checkIsRegistered()" autocomplete="webauthn username"></b-input>
</b-field>
<b-field>
<b-checkbox v-model="isRoaming">Use roaming authenticator (phone, usb key...)</b-checkbox>
</b-field>
<div>
<b-button type="is-primary" @click="register()" :disabled="!username">Register device</b-button>
<b-button type="is-primary" @click="login()" :disabled="!isRegistered">Authenticate</b-button>
</div>
</template>
<template v-if="isAuthenticated">
<p>{{'Hello ' + username + '!'}}</p>
<section v-if="registrationData && !authenticationData" style="text-align: left;">
<p><b>Credential ID:</b> {{registrationData.credential.id}}</p>
<p><b>Public Key:</b> {{registrationData.credential.publicKey.substring(0,32)}}...</p>
<p><b>Algorithm:</b> {{registrationData.credential.algorithm}}</p>
<p><b>Authenticator Name:</b> {{registrationData.authenticator.name}}</p>
</section>
<section v-if="authenticationData" style="text-align: left;">
<p><b>Credential ID:</b> {{authenticationData.credentialId}}</p>
<p><b>Signature:</b> {{authenticationData.signature.substring(0,32)}}...</p>
</section>
<div>
<b-button type="is-primary" @click="logout()">Sign Out</b-button>
</div>
</template>
</main>
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/buefy.min.js"></script>
<script src="https://unpkg.com/browse/[email protected]/dist/axios.min.js"></script>
<script type="module" src="js/basic.js"></script>
</body>
</html>