FIDO2
A passwordless authentication standard
A passwordless authentication standard
FIDO2 is a passwordless authentication standard jointly developed by the FIDO Alliance and the W3C. It consists of two core specifications: WebAuthn (Web Authentication API) and CTAP (Client to Authenticator Protocol). Users authenticate securely through biometrics (fingerprint, face), security keys, PINs, and more.
The core of FIDO2 is public-key cryptography. During registration, a public/private key pair is generated on the user's device, and the private key is stored securely on the device. Only the public key is sent to and stored on the server, so even if the server is hacked, the private key is not leaked. Phishing attacks are also blocked at the source.
The authentication flow uses a Challenge-Response method. When the server sends a random challenge, the client signs it with the private key and responds. The server verifies the signature with the stored public key. Because the private key never leaves the device, it is also safe against Man-in-the-Middle attacks.
FIDO2 is supported by all major browsers (Chrome, Safari, Firefox, Edge) and operating systems (Windows Hello, macOS Touch ID, Android). Passkey, WebAuthn, and security keys (such as YubiKey) are all based on FIDO2. In enterprise environments, it is used as a strong second factor for MFA.
// FIDO2/WebAuthn λ±λ‘ (Registration)
async function registerCredential(userId: string, userName: string) {
// μλ²μμ challenge λ° μ΅μ
κ°μ Έμ€κΈ°
const optionsRes = await fetch('/api/webauthn/register/options', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userId, userName })
});
const options = await optionsRes.json();
// Base64URL β ArrayBuffer λ³ν
options.challenge = base64URLToBuffer(options.challenge);
options.user.id = base64URLToBuffer(options.user.id);
// λΈλΌμ°μ WebAuthn API νΈμΆ - μ체μΈμ/보μν€ ν둬ννΈ
const credential = await navigator.credentials.create({
publicKey: {
...options,
authenticatorSelection: {
authenticatorAttachment: 'platform', // λ΄μ₯ μΈμ¦κΈ° (Touch ID λ±)
userVerification: 'required', // μ체μΈμ νμ
residentKey: 'required' // Passkey μ§μ
},
pubKeyCredParams: [
{ type: 'public-key', alg: -7 }, // ES256 (ECDSA)
{ type: 'public-key', alg: -257 } // RS256 (RSA)
]
}
});
// μλ²λ‘ credential μ μ‘νμ¬ λ±λ‘ μλ£
await fetch('/api/webauthn/register/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: credential.id,
rawId: bufferToBase64URL(credential.rawId),
type: credential.type,
response: {
clientDataJSON: bufferToBase64URL(credential.response.clientDataJSON),
attestationObject: bufferToBase64URL(credential.response.attestationObject)
}
})
});
}
// FIDO2/WebAuthn μΈμ¦ (Authentication)
async function authenticate() {
const optionsRes = await fetch('/api/webauthn/authenticate/options');
const options = await optionsRes.json();
options.challenge = base64URLToBuffer(options.challenge);
// μ¬μ©μμκ² μΈμ¦ ν둬ννΈ νμ
const assertion = await navigator.credentials.get({
publicKey: options,
mediation: 'optional' // Passkey μλμμ± μ§μ
});
// μλ²μμ μλͺ
κ²μ¦
const verifyRes = await fetch('/api/webauthn/authenticate/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: assertion.id,
response: {
authenticatorData: bufferToBase64URL(assertion.response.authenticatorData),
clientDataJSON: bufferToBase64URL(assertion.response.clientDataJSON),
signature: bufferToBase64URL(assertion.response.signature)
}
})
});
return verifyRes.json();
}
In a security team meeting:
"The OTP method was breached because of MFA fatigue attacks. Switching to FIDO2 security keys will block phishing and also improve the user experience. You can distribute YubiKeys, or even just use platform authenticators like Windows Hello/Touch ID."
In a technical interview:
"Why is FIDO2 resistant to phishing?" - "Thanks to origin binding. When a credential is created, the domain is bound to it, so the credential cannot be used on an attacker's site. The server challenge also prevents replay attacks."
In architecture design:
"Can we completely eliminate passwords with Passkey?" - "Yes, we can. But the account recovery flow is important. You need to design it together with things like having users register Passkeys on multiple devices, backup codes, and trusted-contact recovery."
Take a mock interview on this topic β WIA SOOM AI Interview Β· Start for free