-
-
Save kypflug/15f3f953867bc7d37e79e8b69644a857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makeCredential() { | |
try { | |
var accountInfo = { | |
rpDisplayName: 'Contoso', // Name of relying party | |
displayName: 'John Doe', // Name of user account in relying partying | |
name: 'johndoe@contoso.com',// Detailed name of account | |
id: 'joed', // Account identifier | |
imageUri: imgUserProfile, // user’s account image | |
}; | |
var cryptoParameters = [ | |
{ | |
type: 'ScopedCred', | |
algorithm: 'RSASSA-PKCS1-v1_5' | |
} | |
]; | |
var timeout = { }; | |
var denyList = { }; | |
var ext = { }; | |
var attestationChallenge = getChallengeFromServer(); | |
window.webauthn.makeCredential( | |
accountInfo, | |
cryptoParameters, | |
attestationChallenge, | |
timeout, | |
denyList, | |
ext) | |
.then(function (creds) { | |
// If promised succeeds, send credential information to the server | |
sendToServer(creds); | |
}) | |
.catch(function(reason) { | |
// User may have cancelled the Windows Hello dialog | |
}); | |
} catch(ex) { | |
// The user may not have setup Windows Hello, show instructions | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment