Skip to content

Instantly share code, notes, and snippets.

@kypflug
Created April 12, 2016 00:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kypflug/15f3f953867bc7d37e79e8b69644a857 to your computer and use it in GitHub Desktop.
Save kypflug/15f3f953867bc7d37e79e8b69644a857 to your computer and use it in GitHub Desktop.
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