jaandrle / navigator.credentials.js
Last active 4 months ago
| 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 | }); |