Last active
March 15, 2024 03:13
-
-
Save MeiyappanKannappa/942642e3ff02b0e0ff7525f29b97247a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Simulate the server response with registration options | |
| const registrationOptions = { | |
| challenge: new Uint8Array(32), | |
| rp: { name: 'Example Corp', domain:'example.com' }, | |
| user: { | |
| id: new TextEncoder().encode(username), | |
| name: username, | |
| displayName: username | |
| }, | |
| pubKeyCredParams: [ | |
| { type: 'public-key', alg: -7 } | |
| ] | |
| }; | |
| // Use the WebAuthn API to create a new credential | |
| const credential = await navigator.credentials.create({ publicKey: registrationOptions }); | |
| // Simulate sending the new credential to the server for verification and storage | |
| console.log('Credential:', credential); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment