©2018 Wantedly, Inc.
Registration credentials with Authenticator
var publicKey = {
// The challenge is produced by the server; see the Security Considerations
challenge: challenge,
// Relying Party:
rp: {
name: "ACME Corporation",
},
// User
user: {
id: userId,
name: "
[email protected]",
displayName: "Alex P. Müller",
icon: "https://pics.example.com/00/p/aBjjjpqPb.png",
},
// This Relying Party will accept either an ES256 or RS256 credential, but
// prefers an ES256 credential.
pubKeyCredParams: [
{
type: "public-key",
alg: -7, // "ES256" as registered in the IANA COSE Algorithms registry
},
],
// 1 minute
timeout: 60000,
// No exclude list of PKCredDescriptors
excludeCredentials: [],
// Include location information
extensions: { loc: true },
};
https://w3c.github.io/webauthn/#sample-authentication
// Note: The following call will cause
// the authenticator to display UI.
navigator.credentials
.create({ publicKey })
.then(function(newCredentialInfo) {
// Send new credential info to server
// for verification and registration.
})
.catch(function(err) {
// No acceptable authenticator or
// user refused consent. Handle appropriately.
});
PublicKeyCredential