const publicKeyCreateOptions = {
challenge: "randomStringFromServer", // needs to be converted to ArrayBuffer
rp: {
name: ”WebAuthn Demo",
id: ”webauthn-demo.mybluemix.net",
},
user: {
id: ”uniqueUserId", // needs to be converted to ArrayBuffer
name: "
[email protected]",
displayName: "Jane Smith",
},
pubKeyCredParams: [{alg: -7, type: "public-key"}],
authenticatorSelection: {
userVerification: "preferred",
},
timeout: 60000,
attestation: "none"
};
const credential = await navigator.credentials.create({
publicKey: publicKeyCreateOptions
});
Creating a public key credential in the browser