├── README.adoc
├── examples
├── README.adoc
├── tutorial
│ ├── README.adoc
│ └── README
├── README
├── config.php
└── simple
│ ├── index.php
│ └── u2f-api.js
├── composer.json
├── README
├── COPYING
└── src
├── Exceptions.php
└── Client.php
/README.adoc:
--------------------------------------------------------------------------------
1 | README
--------------------------------------------------------------------------------
/examples/README.adoc:
--------------------------------------------------------------------------------
1 | README
--------------------------------------------------------------------------------
/examples/tutorial/README.adoc:
--------------------------------------------------------------------------------
1 | README
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "yubico/u2fval-client",
3 | "description": "Client library for communicating with a U2FVAL server.",
4 | "license": "BSD-2-Clause",
5 | "require": {
6 | "lib-curl": "*"
7 | },
8 | "autoload": {
9 | "classmap": ["src/"]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/examples/tutorial/README:
--------------------------------------------------------------------------------
1 | == U2FVAL Tutorial
2 | This tutorial will show an example of how to add U2F capability to an existing
3 | username/password based site. To follow along, start by cloning the repository
4 | and checking out the first tutorial git tag: tutorial-1. At each step check out
5 | the contents of this README and take a look at the source code changes from the
6 | previous step by running:
7 |
8 | git diff HEAD~1
9 |
10 | Once ready, move on to the next step:
11 |
12 | git checkout tutorial-N
13 |
14 | ...where N is replaced by the step number, 1-5.
15 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | == u2fval-client
2 | Client library for communicating with a U2FVAL server. This is intended to be
3 | used for PHP applications which wish to implement 2FA using U2F.
4 |
5 | === License
6 | The project is licensed under a BSD license. See the file COPYING for
7 | exact wording. For any copyright year range specified as YYYY-ZZZZ in
8 | this package note that the range specifies every single year in that
9 | closed interval.
10 |
11 | === Dependencies
12 | You require CURL for PHP to use this library.
13 | To setup when composer is available, run:
14 |
15 | $ composer.phar install
16 |
--------------------------------------------------------------------------------
/examples/README:
--------------------------------------------------------------------------------
1 | == Example
2 | A passwordless sample server allowing a user to register and authenticate U2F
3 | devices with a U2FVAL server.
4 |
5 | === Setup
6 | To include the required files
7 |
8 | require_once(dirname(__FILE__)."/../src/Client.php");
9 | require_once(dirname(__FILE__)."/../src/Exceptions.php");
10 | if(!function_exists("curl_init")) die("You require CURL for PHP");
11 |
12 | Or install via Composer using
13 |
14 | $ composer.phar install
15 |
16 | You will also need to configure the endpoint and authentication to use for the
17 | U2FVAL server. Edit config.php and fill in the required values.
18 |
--------------------------------------------------------------------------------
/examples/config.php:
--------------------------------------------------------------------------------
1 |
26 |
--------------------------------------------------------------------------------
/COPYING:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Yubico AB
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or
5 | without modification, are permitted provided that the following
6 | conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | 2. Redistributions in binary form must reproduce the above
11 | copyright notice, this list of conditions and the following
12 | disclaimer in the documentation and/or other materials provided
13 | with the distribution.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 | POSSIBILITY OF SUCH DAMAGE.
27 |
--------------------------------------------------------------------------------
/examples/simple/index.php:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 | ';
14 | exit;
15 | } else { // Register or Login
16 | $user = $_GET["username"];
17 | $isregister = ($_GET["action"] == "register");
18 | if(empty($_GET["data"])) { // Ask user to press yubikey to register or login
19 | $data = $isregister ? $u2fval->register_begin($user) : $u2fval->auth_begin($user);
20 | echo '
21 |
22 |
45 | Please wait...
46 |
Back to Main';
47 | exit;
48 | } else { // Process yubikey data
49 | try {
50 | $data = $isregister ? $u2fval->register_complete($user, $_GET['data']) : $u2fval->auth_complete($user, $_GET["data"]);
51 | echo '