README.md
· 268 B · Markdown
Sin formato
## How To Setup Fingerprint Auth In JavaScript
- [WebDevSimplified/webauthn-basic-authentication](https://github.com/WebDevSimplified/webauthn-basic-authentication)
- [How To Setup Fingerprint Auth In JavaScript - YouTube](https://www.youtube.com/watch?v=viZs1iVsLpA)
How To Setup Fingerprint Auth In JavaScript
Sin formato
const temp0= await navigator.credentials.create({
publicKey: {
challenge: new Uint8Array([0, 1, 2, 3, 4, 5, 6]),
rp: { name: "Web Dev Simplified" },
user: {
id: new Uint8Array(16),
name: "andrle.jan@centrum.cz",
displayName: ""
},
pubKeyCredParams: [
{ type: "public-key", alg: -7 },
{ type: "public-key", alg: -8 },
{ type: "public-key", alg: -257 },
]
},
});
await navigator.credentials.get({
publicKey: {
challenge: new Uint8Array([0, 1, 2, 3, 4, 5, 6]),
rpId: location.host,
allowCredentials: [
{ type: "public-key", id: temp0.rawId },
],
},
});
| 1 | const temp0= await navigator.credentials.create({ |
| 2 | publicKey: { |
| 3 | challenge: new Uint8Array([0, 1, 2, 3, 4, 5, 6]), |
| 4 | rp: { name: "Web Dev Simplified" }, |
| 5 | user: { |
| 6 | id: new Uint8Array(16), |
| 7 | name: "andrle.jan@centrum.cz", |
| 8 | displayName: "" |
| 9 | }, |
| 10 | pubKeyCredParams: [ |
| 11 | { type: "public-key", alg: -7 }, |
| 12 | { type: "public-key", alg: -8 }, |
| 13 | { type: "public-key", alg: -257 }, |
| 14 | ] |
| 15 | }, |
| 16 | }); |
| 17 | await navigator.credentials.get({ |
| 18 | publicKey: { |
| 19 | challenge: new Uint8Array([0, 1, 2, 3, 4, 5, 6]), |
| 20 | rpId: location.host, |
| 21 | allowCredentials: [ |
| 22 | { type: "public-key", id: temp0.rawId }, |
| 23 | ], |
| 24 | }, |
| 25 | }); |