Create params
To start
This section explain you how to create the json to send to the client browser.
First of all, you need to instantiate the client
<?php
use Svgta\WebAuthn\client;
$webauthn = new client();To process
As for registration, you have to give your Relaying Party, ex :
$webauthn->rp->set(
name: 'My wonderful project',
);AllowCredentials : now, give all credentials ID (credential.id) of the devices saved for the user :
$webauthn->allowCredentials->add(
id: "O1kSf7QDZGYUcZXpMdRFM...",
type: "public-key",
);
$webauthn->allowCredentials->add(
id: "other key",
type: "public-key",
);Then, you will get the parameters to send with :
You will get something like that :
Set userVerification
By default, user verification is set to "preferred". You can force it with :
Anonymous authentication
You can do an anonymous authentication (without knowing the user before the process). In this case :
In the registration phase you needed :
force the userVerification to required
force the residentKey to required
In authentication phase :
You can't give any allowCredentials
You need to force the userVerification to required
Full authentication example :
Json sent :
Last updated