You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+134-4Lines changed: 134 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ FIDO's U2F enables you to add a simple unobtrusive method of 2nd factor authenti
17
17
1.[Registration Process Flow](#registration-process-flow)
18
18
1.[Authentication Process Flow](#authentication-process-flow)
19
19
6.[Example Code](#example-code)
20
+
1.[Compatibility Check](#compatibility-code)
20
21
1.[Registration Code](#registration-code)
21
22
1.[Authentication Code](#authentication-code)
22
23
7.[Frameworks](#frameworks)
@@ -37,11 +38,11 @@ A few **things you need** to know before working with this:
37
38
1.[**_OpenSSL_**](#openssl)
38
39
2.[**_A Datastore_**](#recommended-datastore-structure) You need some kind of datastore for all your U2F registered users (although if you have a system with user authentication I'm presuming you've got this one sorted).
39
40
3.[**_Client-side Handling_**](#client-side) You need to be able to communicate with a some kind of device.
40
-
4.[**_A HTTPS URL_**](#https-and-ssl) This is very important, without HTTPS Chrome will refuse to communicate with you.
41
+
4.[**_A HTTPS URL_**](#https-and-ssl) This is very important, without HTTPS U2F simply will not work.
41
42
42
43
### OpenSSL
43
44
44
-
... Info about installing OpenSSL ...
45
+
This repository requires OpenSSL 1.0.0 or higher. For further details on installing OpenSSL please refer to the php manual http://php.net/manual/en/openssl.installation.php.
45
46
46
47
### Client-side (The magic JavaScript Bit of talking with a USB device)
47
48
@@ -52,7 +53,7 @@ My presumption is that if you are looking to add U2F authentication to a php sys
52
53
53
54
### HTTPS and SSL
54
55
55
-
Without a HTTPS URL your code won't work, so get one for your localhost, get one for your production. https://letsencrypt.org/
56
+
For U2F to work your website/service must use a HTTPS URL. Without a HTTPS URL your code won't work, so get one for your localhost, get one for your production. https://letsencrypt.org/
56
57
57
58
58
59
## Terminology
@@ -80,6 +81,7 @@ TODO the descriptions
80
81
### Registration Process Flow
81
82
82
83
1. User navigates to a 2nd factor authentication page in your application.
84
+
... TODO add the rest of the registration process flow ...
83
85
84
86
### Authentication Process Flow
85
87
@@ -107,16 +109,144 @@ You can also install it with the following:
You'll only ever need to use this method call once per installation and only in the context of debugging if the class is giving you unexpected errors. This method call wil check your OpenSSL version and ensure it is at least 1.0.0 .
115
+
116
+
```php
117
+
<?php
118
+
119
+
require('vendor/autoload.php');
120
+
use Samyoul\U2F;
121
+
122
+
var_dump(U2F::checkOpenSSLVersion());
123
+
```
124
+
110
125
### Registration Code
111
126
127
+
**Starting the registration process:**
128
+
129
+
We assume that user has successfully authenticated and wishes to register.
130
+
131
+
```php
132
+
<?php
133
+
134
+
require('vendor/autoload.php');
135
+
use Samyoul\U2F;
136
+
137
+
session_start();
138
+
139
+
// This can be anything, but usually easier if you choose your applications domain and top level domain.
140
+
$appId = "yourdomain.tld";
141
+
142
+
// Call the makeRegistration method, passing in the app ID
Non-AJAX client-side registration of U2F key token. AJAX can of course be used in your application, but it is easier to demonstrate a linear process without AJAX and callbacks.
159
+
160
+
```
161
+
<html>
162
+
<head>
163
+
<title>U2F Key Registration</title>
164
+
</head>
165
+
<body>
166
+
<h1>U2F Registration</h1>
167
+
<h2>Please enter your FIDO U2F device into your computer's USB port. Then confirm registration on the device.</h2>
0 commit comments