-
{ id: "nZOlyXf57erlQbudIIuOrQEdRUs", rawId: [ArrayBuffer], response: { attestationObject: [ArrayBuffer], clientDataJSON: [ArrayBuffer], }, type: "public-key", }
-
const body = JSON.stringify(attestation); const response = await fetch(`/register`, { method: "POST", body, });
-
const { credentialId } = await response.json(); localStorage.setItem('credentialId', credentialId);
-
Логин с помощью платформенного ключа:
- Проверяем есть ли сохраненный Сredential Id
- Запрашиваем на сервере проверочный объект
-
Логин с помощью платформенного ключа:
- Передаём его платформе и получаем PublicKeyCredential
- Отправляем PublicKeyCredential на сервер для проверки
-
const credentialId = localStorage.getItem('credentialId'); if (credentialId === null) return;
-
const response = await fetch( '/challenge/login', { method: 'POST' } ); const options = await response.json();
-
const { challenge } = options; const credentialId = localStorage.getItem('credentialId'); options.allowCredentials = [{ type: "public-key", id: toBuffer(credentialId), }];
-
const credential = await navigator.credentials.get({ publicKey: options });
-
-
{ id: "FtjWT4fIT9…zs2LRxuG5fBRj9bA", rawId: [ArrayBuffer], response: { authenticatorData: [ArrayBuffer], clientDataJSON: [ArrayBuffer], signature: [ArrayBuffer], userHandle: null, }, type: "public-key", }
-
const body = JSON.stringify(authenticator); await fetch('/login', { method: "POST", body });
-
-
WebAuthn demo application
-
Emulate Authenticators and Debug WebAuthn in Chrome DevTools
-
A curated list of awesome WebAuthn/FIDO2 resources
-
WebAuthn guide
-
Introduction to WebAuthn API (Yuriy Ackermann)
-
Meet Face ID and Touch ID for the web (WWDC 2020 video)
-
Meet Face ID and Touch ID for the web (Webkit blog post)
-
Web Authentication and Windows Hello
-
Enabling Strong Authentication with WebAuthn
-
Fido Alliance
-
Verifiable Credentials Data Model
-
Yubico (YubiKey)
-
Web Authentication: An API for accessing Public Key Credentials
-