Implementation of strong authentication with the webauthn standard and FIDO2. Strong authentication is an authentication method using a physical key.
npm install @webauthn/clientImplementation of strong authentication with the webauthn standard and FIDO2.
Strong authentication is an authentication method using a physical key.
For a more thorough introduction see these two nice articles:
- introduction
- verifying fido2 responses
``js`
npm install @webauthn/client
npm install @webauthn/server
Webauthn is composed of two parts @webauthn/client and @webauthn/server
`js`
import {
solveRegistrationChallenge,
solveLoginChallenge
} from '@webauthn/client';
- solveRegistrationChallenge:solveLoginChallenge
convert the challenge returned by the server on the register route into the response to be returned
- :
convert the challenge returned by the server on the login route into the response to be returned
See an example in example/front
`js`
import {
parseRegisterRequest,
generateRegistrationChallenge,
parseLoginRequest,
generateLoginChallenge,
verifyAuthenticatorAssertion,
} from '@webauthn/server';
- parseRegisterRequest:generateRegistrationChallenge
Extract challenge and key from the register request body. The challenge allow to retrieve the user, and the key must be stored server side linked to the user.
- :{ relyingParty, user }
Generate a challenge from a relying party and a user to be sent back to the client, in order to registerparseLoginRequest
- :generateLoginChallenge
Extract challenge and KeyId from the login request.
- :verifyAuthenticatorAssertion`:
Generate challengeResponse from the key sent by the client during login. challengeResponse.challenge should be stored serverside linked to the corresponding user
-
Take the loginChallenge request body and the key stored with the user, and return true if it passes the authenticator assertion
See an example in example/server
For now only fido-u2f and packed format are implemented
- Implement android-key format
- Implement android-safetynet format
- Implement tpm format