master
Harald Wolff 2019-11-04 09:57:00 +01:00
parent 0de72abc3d
commit d1663cbbbe
3 changed files with 74 additions and 0 deletions

View File

@ -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(()=>{

View File

@ -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 100644
View File

@ -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>