date : give the date of the registration of the device. The update date is the same as the create date.
userHandle : is the user.id given to make the registration
credential :
alg : the algorithm used by the device to sign the datas. The same algorithm will be used to sign datas for the authentication process
id : the key.id of the device
publicKeyCredentialSource : the datas to do the authentication process
info : informations about the user and the device. You can use them to do more verifications or, for example, using the icon of the device in your app.
What to save in your DataBase
For the authentication process, you will need to give back the jsonData string.
You may be need to index in your dataBase for tje authentication process :
userHandle
credentialId
In the example, you don't give the json response of the web browser. The library take it from php://input.
You will have an exception if you asked in the parameters to have an attestation without MDS json given. You need to give a MDS (MetaData Service) to verify the attestation.
MetaData Service
Basic usage
MDS is needed to verify attestation. The library accept the value in a json string.
The FIDO Alliance offer for free an API to the MDS3 BLOB (link to the webpage). It's a JWT. You can use this library to get all the datas.
You must not get the MDS3 BLOB from Fido Alliance every time. You need to save the datas in your database and call the update when needed. The JWT give the date of the next update : please, use it.
The library save the MDS3 BLOB in your temp dir and parse in it the datas.
$webauthn->fido->update();//Get the next update date :$date = $webauthn->fido->nextUpdate(); //2023-12-01 -> save it in your database//Get all MDS in json string formatforeach( $webauthn->fido->get_tmp_mds()as $aaguid => $json){//process the save in your dataBase with :// key : $aaguid (string)// value : $json (string)}
requestParams : to add params to the request to get the datas like a proxy. Based on Guzzle, you can see the possibilities here.
The fido_cert is used to verify the JWT obtain bye the fido_url. If theses urls change in futur, the call must be :
$webauthn->fido->update( fido_url:"https://newUrlFromFidoAlliance", fido_cert:"http://newRootCaUrl");// using a proxy $webauthn->fido->update(requestParams: ['proxy'=>'http://localhost:8125']);//OR$webauthn->fido->update(requestParams: ['proxy'=> ['http'=>'http://localhost:8125',// Use this proxy with "http"'https'=>'http://localhost:9124',// Use this proxy with "https",'no'=> ['.mit.edu','foo.com'] // Don't use a proxy with these ]]);
If you need to validate attestation with a MDS from FIDO Alliance :
From your database
$aaguid = $webauthn->register()->aaguid();//...// Process to get the json string from your dataBase using the $aaguid key//...$webauthn->mds->load($jsonString);$ret = $webauthn->register()->validate(); //return a json string
From your server temp dir after getting the MDS3 Blob