ES256
ES256
__construct(string $appid)
construct object on which to operate
string | $appid | a string identifying your app, typically the domain of your website which people are using the key to log in to. If you have the URL (ie including the https:// on the front) to hand, give that; if it's not https, well what are you doing using this code? |
prepareChallengeForRegistration( $username, $userid) : string
generate a challenge ready for registering a hardware key, fingerprint or whatever:
$username | string by which the user is known potentially displayed on the hardware key |
|
$userid | string by which the user can be uniquely identified. Don't use email address as this can change, user perhaps the database record id |
pass this JSON string back to the browser
register(string $info, string $userwebauthn) : string
registers a new key for a user requires info from the hardware via javascript given below
string | $info | supplied to the PHP script via a POST, constructed by the Javascript given below, ultimately provided by the key |
string | $userwebauthn | the exisitng webauthn field for the user from your database (it's actaully a JSON string, but that's entirely internal to this code) |
modified to store in the user's webauthn field in your database
prepareForLogin(string $userwebauthn) : string
generates a new key string for the physical key, fingerprint reader or whatever to respond to on login
string | $userwebauthn | the existing webauthn field for the user from your database |
to pass to javascript webauthnAuthenticate
authenticate(string $info, string $userwebauthn) : boolean
validates a response for login or 2fa requires info from the hardware via javascript given below
string | $info | supplied to the PHP script via a POST, constructed by the Javascript given below, ultimately provided by the key |
string | $userwebauthn | the exisiting webauthn field for the user from your database (it's actaully a JSON string, but that's entirely internal to this code) |
true for valid authentication or false for failed validation