Harald Wolff 2 years ago
parent
commit
d1663cbbbe
  1. 20
      demo.html
  2. 45
      js/ln.vue.webauthn.js
  3. 9
      webauthn.html

20
demo.html

@ -11,6 +11,7 @@
<script type="text/javascript" src="js/ln.vue.js"></script>
<script type="text/javascript" src="js/ln.vue.components.js"></script>
<script type="text/javascript" src="js/ln.vue.table.js"></script>
<script type="text/javascript" src="js/ln.vue.webauthn.js"></script>
<style>
table#controls > tbody > tr > td:nth-child(3) {
@ -177,6 +178,25 @@
}
});
app.addModule({
navigation: {
protocols: {
label: 'Protocols',
navigation: {
webauthn: {
label: 'webauthn',
path: '/protocols/webauthn',
}
}
}
},
routes: {
'/protocols/webauthn': {
url: '/webauthn.html',
}
},
});
app.Start();
LNVue.onidle(()=>{

45
js/ln.vue.webauthn.js

@ -0,0 +1,45 @@
(function(){
LNVue.prototype.createCredentials = function(_challenge,rp,userId,crossplatform,attestation){
crossplatform = crossplatform ? true : false;
if (!attestation)
attestation = "none";
let credCreateOptions = {
challenge: Uint8Array.from(_challenge, c => c.charCodeAt(0)),
rp: {
id: rp,
name: 'LN.Vue Demo Application',
},
user: {
id: Int8Array.from(userId, c => c.charCodeAt(0)),
name: 'SomeUser',
displayName: "Some user for now...",
},
pubKeyCredParams: [
{
type: 'public-key',
alg: -7,
}
],
authenticatorSelection: {
authenticatorAttachment: crossplatform ? 'cross-platform' : 'platform',
},
timeout: 60000,
attestation: attestation,
};
console.log(credCreateOptions);
navigator.credentials.create({
publicKey: credCreateOptions
});
};
LNVue.prototype.createAuthToken = function(){
};
})();

9
webauthn.html

@ -0,0 +1,9 @@
<div>
<h1>webauthn - demo</h1>
<div>Use the buttons to start demo action...</div>
<button
@click="LNVue.createCredentials('ABCDEFGHIJKLMNOPQRSTUVWXYZ','LNVue Demo Application','1234567890',true);"
>Register</button>
</div>
Loading…
Cancel
Save