ln.vue/js/ln.vue.webauthn.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-11-04 09:57:00 +01:00
(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(){
};
})();