Callback

To Start

You will receive a json file from the web browser. It's need to be controlled before accepting the registration.

The json file must have this structure :

{
    "id": "BP63qesxI-...",
    "rawId": "BP63qesxI-...",
    "response": {
        "attestationObject": "o2NmbXRmcGFja2VkZ2F0dFN0bXSj...",
        "clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uY3J...",
        "transports": ["nfc", "usb"],
        "publicKeyAlgorithm": -8,
        "publicKey": "MCowBQYDK2VwAyE...",
        "authenticatorData": "pwU_KOYP8gQFgRDoKV9JAJG_LMGwWBtPT..."
    },
    "type": "public-key",
    "authenticatorAttachment": "cross-platform"
};

The id is the id generated by the authenticator (crendential.id).

First of all, instantiate the client and the RP has defined previously :

Perform the validation

Do the Validation

This exemple is a base of use :

Get the response of the authenticator

You will receive an array :

  • userHandle : the user.id

  • credentialId : the id given by the authentificator

  • jsonData : the datas of the process in a json string.

Example of a result of jsonData :

Without attestation, it's someting like that :

Explanation :

  • 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 can give the json like that :

$aaguid = $webauthn->register()->aaguid($jsonString);

MetaData Service

Basic usage

MDS is needed to verify attestation. The library accept the value in a json string.

Example :

To validate with MDS :

Using MDS from FIDO Alliance

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.

The library save the MDS3 BLOB in your temp dir and parse in it the datas.

The update(

?string $fido_url = null,

?string $fido_cert = null,

array $requestParams = []

) method can take 3 parameters :

The fido_cert is used to verify the JWT obtain bye the fido_url. If theses urls change in futur, the call must be :

If you need to validate attestation with a MDS from FIDO Alliance :

  • From your database

  • From your server temp dir after getting the MDS3 Blob

Last updated