'
- ;
-
- $qrCode = Encoder::encode(
- $content,
- new ErrorCorrectionLevel(ErrorCorrectionLevel::L),
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->assertEquals($expected, $this->renderer->render($qrCode));
- }
-
- public function testSetStyle()
- {
- $content = 'foobar';
- $qrCode = Encoder::encode(
- $content,
- new ErrorCorrectionLevel(ErrorCorrectionLevel::L),
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->renderer->setStyle('bar');
- $this->assertEquals('bar', $this->renderer->getStyle());
- $this->assertStringMatchesFormat('%astyle="bar"%a', $this->renderer->render($qrCode));
- }
-
- public function testSetClass()
- {
- $content = 'foobar';
- $qrCode = Encoder::encode(
- $content,
- new ErrorCorrectionLevel(ErrorCorrectionLevel::L),
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->renderer->setClass('bar');
- $this->assertEquals('bar', $this->renderer->getClass());
- $this->assertStringMatchesFormat('%aclass="bar"%a', $this->renderer->render($qrCode));
- }
-}
diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php
deleted file mode 100644
index d94e8e5d..00000000
--- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php
+++ /dev/null
@@ -1,149 +0,0 @@
-renderer = new Plain();
- $this->writer = new Writer($this->renderer);
- }
-
- public function testBasicRender()
- {
- $content = 'foobar';
- $expected =
- " \n" .
- " ███████ █████ ███████ \n" .
- " â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ \n" .
- " █ ███ █ ██ █ ███ █ \n" .
- " █ ███ █ ███ █ ███ █ \n" .
- " █ ███ █ █ █ █ ███ █ \n" .
- " █ █ ██ █ █ \n" .
- " ███████ █ █ █ ███████ \n" .
- " █████ \n" .
- " ██ ██ █ ██ █ █ █ \n" .
- " ██ ██ █ █ ██ \n" .
- " ████████ █ ██ █ ██ \n" .
- " ██ █ █ \n" .
- " ██ ███ █ █ █ █ \n" .
- " █ ███ █ █ \n" .
- " ███████ ██ ██████ \n" .
- " █ █ ████ ██ \n" .
- " █ ███ █ ██ ██ ██ █ ██ \n" .
- " █ ███ █ ██ ██ █ ██ \n" .
- " █ ███ █ █ █ ██ ██ \n" .
- " █ █ ███ ███ ████ \n" .
- " ███████ ████ ██ \n" .
- " \n"
- ;
-
- $qrCode = Encoder::encode(
- $content,
- new ErrorCorrectionLevel(ErrorCorrectionLevel::L),
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->assertEquals($expected, $this->renderer->render($qrCode));
- }
-
- public function testBasicRenderNoMargins()
- {
- $content = 'foobar';
- $expected =
- "███████ █████ ███████\n" .
- "â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ â–ˆ\n" .
- "█ ███ █ ██ █ ███ █\n" .
- "█ ███ █ ███ █ ███ █\n" .
- "█ ███ █ █ █ █ ███ █\n" .
- "█ █ ██ █ █\n" .
- "███████ █ █ █ ███████\n" .
- " █████ \n" .
- "██ ██ █ ██ █ █ █\n" .
- " ██ ██ █ █ ██ \n" .
- " ████████ █ ██ █ ██\n" .
- " ██ █ █\n" .
- " ██ ███ █ █ █ █\n" .
- " █ ███ █ █ \n" .
- "███████ ██ ██████ \n" .
- "█ █ ████ ██ \n" .
- "█ ███ █ ██ ██ ██ █ ██\n" .
- "█ ███ █ ██ ██ █ ██ \n" .
- "█ ███ █ █ █ ██ ██\n" .
- "█ █ ███ ███ ████\n" .
- "███████ ████ ██ \n"
- ;
-
- $qrCode = Encoder::encode(
- $content,
- new ErrorCorrectionLevel(ErrorCorrectionLevel::L),
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->renderer->setMargin(0);
- $this->assertEquals(0, $this->renderer->getMargin());
- $this->assertEquals($expected, $this->renderer->render($qrCode));
- }
-
- public function testBasicRenderCustomChar()
- {
- $content = 'foobar';
- $expected =
- "-----------------------\n" .
- "-#######-#####-#######-\n" .
- "-#-----#--#-#--#-----#-\n" .
- "-#-###-#--##---#-###-#-\n" .
- "-#-###-#--###--#-###-#-\n" .
- "-#-###-#---#-#-#-###-#-\n" .
- "-#-----#----##-#-----#-\n" .
- "-#######-#-#-#-#######-\n" .
- "---------#####---------\n" .
- "-##-##-#--##-#-#-----#-\n" .
- "----##----##-#-#-##----\n" .
- "--########-#--##-#--##-\n" .
- "-----------##------#-#-\n" .
- "--##--###--#---#--#--#-\n" .
- "---------#-###----#-#--\n" .
- "-#######--##-######----\n" .
- "-#-----#---####---##---\n" .
- "-#-###-#-##-##-##-#-##-\n" .
- "-#-###-#-##-##--#-##---\n" .
- "-#-###-#---#---#-##-##-\n" .
- "-#-----#-###--###-####-\n" .
- "-#######-####---##-----\n" .
- "-----------------------\n"
- ;
-
- $qrCode = Encoder::encode(
- $content,
- new ErrorCorrectionLevel(ErrorCorrectionLevel::L),
- Encoder::DEFAULT_BYTE_MODE_ECODING
- );
- $this->renderer->setFullBlock('#');
- $this->renderer->setEmptyBlock('-');
- $this->assertEquals('#', $this->renderer->getFullBlock());
- $this->assertEquals('-', $this->renderer->getEmptyBlock());
- $this->assertEquals($expected, $this->renderer->render($qrCode));
- }
-}
diff --git a/vendor/bacon/bacon-qr-code/tests/bootstrap.php b/vendor/bacon/bacon-qr-code/tests/bootstrap.php
deleted file mode 100644
index 05a49415..00000000
--- a/vendor/bacon/bacon-qr-code/tests/bootstrap.php
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- .
-
-
-
- ../src/
-
-
-
diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php
index 43c2713f..9e00f8d3 100644
--- a/vendor/composer/autoload_namespaces.php
+++ b/vendor/composer/autoload_namespaces.php
@@ -6,7 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
- 'ZendXml\\' => array($vendorDir . '/zendframework/zendxml/library'),
'PicoFeed' => array($vendorDir . '/fguillot/picofeed/lib'),
- 'BaconQrCode' => array($vendorDir . '/bacon/bacon-qr-code/src'),
);
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
index 00ff6f81..5b6cc63b 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
- 'RobThree\\Auth\\' => array($vendorDir . '/robthree/twofactorauth/lib'),
+ 'ZendXml\\' => array($vendorDir . '/zendframework/zendxml/src'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
);
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index 6b54c4e2..47980419 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -7,9 +7,9 @@ namespace Composer\Autoload;
class ComposerStaticInitda370287ab6d5b8a28188afe08f659c5
{
public static $prefixLengthsPsr4 = array (
- 'R' =>
+ 'Z' =>
array (
- 'RobThree\\Auth\\' => 14,
+ 'ZendXml\\' => 8,
),
'C' =>
array (
@@ -18,9 +18,9 @@ class ComposerStaticInitda370287ab6d5b8a28188afe08f659c5
);
public static $prefixDirsPsr4 = array (
- 'RobThree\\Auth\\' =>
+ 'ZendXml\\' =>
array (
- 0 => __DIR__ . '/..' . '/robthree/twofactorauth/lib',
+ 0 => __DIR__ . '/..' . '/zendframework/zendxml/src',
),
'Composer\\Semver\\' =>
array (
@@ -29,13 +29,6 @@ class ComposerStaticInitda370287ab6d5b8a28188afe08f659c5
);
public static $prefixesPsr0 = array (
- 'Z' =>
- array (
- 'ZendXml\\' =>
- array (
- 0 => __DIR__ . '/..' . '/zendframework/zendxml/library',
- ),
- ),
'P' =>
array (
'PicoFeed' =>
@@ -43,13 +36,6 @@ class ComposerStaticInitda370287ab6d5b8a28188afe08f659c5
0 => __DIR__ . '/..' . '/fguillot/picofeed/lib',
),
),
- 'B' =>
- array (
- 'BaconQrCode' =>
- array (
- 0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src',
- ),
- ),
);
public static function getInitializer(ClassLoader $loader)
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 3d350743..9f764edc 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1,52 +1,4 @@
[
- {
- "name": "bacon/bacon-qr-code",
- "version": "1.0.3",
- "version_normalized": "1.0.3.0",
- "source": {
- "type": "git",
- "url": "https://github.com/Bacon/BaconQrCode.git",
- "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee",
- "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee",
- "shasum": ""
- },
- "require": {
- "ext-iconv": "*",
- "php": "^5.4|^7.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.8"
- },
- "suggest": {
- "ext-gd": "to generate QR code images"
- },
- "time": "2017-10-17T09:59:25+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "BaconQrCode": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-2-Clause"
- ],
- "authors": [
- {
- "name": "Ben Scholzen 'DASPRiD'",
- "email": "mail@dasprids.de",
- "homepage": "http://www.dasprids.de",
- "role": "Developer"
- }
- ],
- "description": "BaconQrCode is a QR code generator for PHP.",
- "homepage": "https://github.com/Bacon/BaconQrCode"
- },
{
"name": "composer/semver",
"version": "1.4.2",
@@ -167,92 +119,40 @@
"homepage": "https://github.com/miniflux/picoFeed",
"abandoned": true
},
- {
- "name": "robthree/twofactorauth",
- "version": "1.6.1",
- "version_normalized": "1.6.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/RobThree/TwoFactorAuth.git",
- "reference": "a77e7d822343bb88112baef808839cfae7bc5abb"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/a77e7d822343bb88112baef808839cfae7bc5abb",
- "reference": "a77e7d822343bb88112baef808839cfae7bc5abb",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "phpunit/phpunit": "@stable"
- },
- "time": "2017-11-06T17:55:56+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "RobThree\\Auth\\": "lib"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Rob Janssen",
- "homepage": "http://robiii.me",
- "role": "Developer"
- }
- ],
- "description": "Two Factor Authentication",
- "homepage": "https://github.com/RobThree/TwoFactorAuth",
- "keywords": [
- "Authentication",
- "MFA",
- "Multi Factor Authentication",
- "Two Factor Authentication",
- "authenticator",
- "authy",
- "php",
- "tfa"
- ]
- },
{
"name": "zendframework/zendxml",
- "version": "1.0.2",
- "version_normalized": "1.0.2.0",
+ "version": "1.1.0",
+ "version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/ZendXml.git",
- "reference": "7b64507bc35d841c9c5802d67f6f87ef8e1a58c9"
+ "reference": "267db6a2c431a08a8f8ff0f1f4c302a5ba6f5b99"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zendframework/ZendXml/zipball/7b64507bc35d841c9c5802d67f6f87ef8e1a58c9",
- "reference": "7b64507bc35d841c9c5802d67f6f87ef8e1a58c9",
+ "url": "https://api.github.com/repos/zendframework/ZendXml/zipball/267db6a2c431a08a8f8ff0f1f4c302a5ba6f5b99",
+ "reference": "267db6a2c431a08a8f8ff0f1f4c302a5ba6f5b99",
"shasum": ""
},
"require": {
- "php": "^5.3.3 || ^7.0"
+ "php": "^5.6 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "^3.7 || ^4.0",
- "squizlabs/php_codesniffer": "^1.5"
+ "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4",
+ "zendframework/zend-coding-standard": "~1.0.0"
},
- "time": "2016-02-04T21:02:08+00:00",
+ "time": "2018-04-30T15:11:04+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "1.1.x-dev",
+ "dev-develop": "1.2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
- "psr-0": {
- "ZendXml\\": "library/"
+ "psr-4": {
+ "ZendXml\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -260,11 +160,11 @@
"BSD-3-Clause"
],
"description": "Utility library for XML usage, best practices, and security in PHP",
- "homepage": "http://packages.zendframework.com/",
"keywords": [
+ "ZendFramework",
"security",
"xml",
- "zf2"
+ "zf"
]
}
]
diff --git a/vendor/robthree/twofactorauth/.gitignore b/vendor/robthree/twofactorauth/.gitignore
deleted file mode 100644
index 8a25841c..00000000
--- a/vendor/robthree/twofactorauth/.gitignore
+++ /dev/null
@@ -1,189 +0,0 @@
-## Ignore Visual Studio temporary files, build results, and
-## files generated by popular Visual Studio add-ons.
-
-# User-specific files
-*.suo
-*.user
-*.sln.docstates
-
-# Build results
-[Dd]ebug/
-[Dd]ebugPublic/
-[Rr]elease/
-[Rr]eleases/
-x64/
-x86/
-build/
-bld/
-[Bb]in/
-[Oo]bj/
-
-# Roslyn cache directories
-*.ide/
-
-# MSTest test Results
-[Tt]est[Rr]esult*/
-[Bb]uild[Ll]og.*
-
-#NUNIT
-*.VisualState.xml
-TestResult.xml
-
-# Build Results of an ATL Project
-[Dd]ebugPS/
-[Rr]eleasePS/
-dlldata.c
-
-*_i.c
-*_p.c
-*_i.h
-*.ilk
-*.meta
-*.obj
-*.pch
-*.pdb
-*.pgc
-*.pgd
-*.rsp
-*.sbr
-*.tlb
-*.tli
-*.tlh
-*.tmp
-*.tmp_proj
-*.log
-*.vspscc
-*.vssscc
-.builds
-*.pidb
-*.svclog
-*.scc
-
-# Chutzpah Test files
-_Chutzpah*
-
-# Visual C++ cache files
-ipch/
-*.aps
-*.ncb
-*.opensdf
-*.sdf
-*.cachefile
-
-# Visual Studio profiler
-*.psess
-*.vsp
-*.vspx
-
-# TFS 2012 Local Workspace
-$tf/
-
-# Guidance Automation Toolkit
-*.gpState
-
-# ReSharper is a .NET coding add-in
-_ReSharper*/
-*.[Rr]e[Ss]harper
-*.DotSettings.user
-
-# JustCode is a .NET coding addin-in
-.JustCode
-
-# TeamCity is a build add-in
-_TeamCity*
-
-# DotCover is a Code Coverage Tool
-*.dotCover
-
-# NCrunch
-_NCrunch_*
-.*crunch*.local.xml
-
-# MightyMoose
-*.mm.*
-AutoTest.Net/
-
-# Web workbench (sass)
-.sass-cache/
-
-# Installshield output folder
-[Ee]xpress/
-
-# DocProject is a documentation generator add-in
-DocProject/buildhelp/
-DocProject/Help/*.HxT
-DocProject/Help/*.HxC
-DocProject/Help/*.hhc
-DocProject/Help/*.hhk
-DocProject/Help/*.hhp
-DocProject/Help/Html2
-DocProject/Help/html
-
-# Click-Once directory
-publish/
-
-# Publish Web Output
-*.[Pp]ublish.xml
-*.azurePubxml
-# TODO: Comment the next line if you want to checkin your web deploy settings
-# but database connection strings (with potential passwords) will be unencrypted
-*.pubxml
-*.publishproj
-
-# NuGet Packages
-*.nupkg
-# The packages folder can be ignored because of Package Restore
-**/packages/*
-# except build/, which is used as an MSBuild target.
-!**/packages/build/
-# If using the old MSBuild-Integrated Package Restore, uncomment this:
-#!**/packages/repositories.config
-
-# Windows Azure Build Output
-csx/
-*.build.csdef
-
-# Windows Store app package directory
-AppPackages/
-
-# Others
-sql/
-*.Cache
-ClientBin/
-[Ss]tyle[Cc]op.*
-~$*
-*~
-*.dbmdl
-*.dbproj.schemaview
-*.pfx
-*.publishsettings
-node_modules/
-
-# RIA/Silverlight projects
-Generated_Code/
-
-# Backup & report files from converting an old project file
-# to a newer Visual Studio version. Backup files are not needed,
-# because we have git ;-)
-_UpgradeReport_Files/
-Backup*/
-UpgradeLog*.XML
-UpgradeLog*.htm
-
-# SQL Server files
-*.mdf
-*.ldf
-
-# Business Intelligence projects
-*.rdl.data
-*.bim.layout
-*.bim_*.settings
-
-# Microsoft Fakes
-FakesAssemblies/
-
-# Composer
-/vendor
-
-# .vs
-.vs/
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/.travis.yml b/vendor/robthree/twofactorauth/.travis.yml
deleted file mode 100644
index 204dc63a..00000000
--- a/vendor/robthree/twofactorauth/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: php
-
-dist: trusty
-matrix:
- include:
- - php: 5.3
- dist: precise
-
-php:
- - 5.4
- - 5.5
- - 5.6
- - 7.0
- - 7.1
- - hhvm
-
-script:
- - if [[ "$TRAVIS_PHP_VERSION" == '5.6' ]]; then phpunit --coverage-text tests ; fi
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/LICENSE b/vendor/robthree/twofactorauth/LICENSE
deleted file mode 100644
index 75a96312..00000000
--- a/vendor/robthree/twofactorauth/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014-2015 Rob Janssen
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/vendor/robthree/twofactorauth/README.md b/vendor/robthree/twofactorauth/README.md
deleted file mode 100644
index ba6cfeab..00000000
--- a/vendor/robthree/twofactorauth/README.md
+++ /dev/null
@@ -1,197 +0,0 @@
-#  PHP library for Two Factor Authentication
-
-[](https://travis-ci.org/RobThree/TwoFactorAuth/) [](https://packagist.org/packages/robthree/twofactorauth) [](LICENSE) [](https://packagist.org/packages/robthree/twofactorauth) [](http://hhvm.h4cc.de/package/robthree/twofactorauth) [](https://codeclimate.com/github/RobThree/TwoFactorAuth) [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6MB5M2SQLP636 "Keep me off the streets")
-
-PHP library for [two-factor (or multi-factor) authentication](http://en.wikipedia.org/wiki/Multi-factor_authentication) using [TOTP](http://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm) and [QR-codes](http://en.wikipedia.org/wiki/QR_code). Inspired by, based on but most importantly an *improvement* on '[PHPGangsta/GoogleAuthenticator](https://github.com/PHPGangsta/GoogleAuthenticator)'. There's a [.Net implementation](https://github.com/RobThree/TwoFactorAuth.Net) of this library as well.
-
-
-
-
-
-## Requirements
-
-* Tested on PHP 5.3, 5.4, 5.5 and 5.6, 7.0, 7.1 and HHVM
-* [cURL](http://php.net/manual/en/book.curl.php) when using the provided `GoogleQRCodeProvider` (default), `QRServerProvider` or `QRicketProvider` but you can also provide your own QR-code provider.
-* [random_bytes()](http://php.net/manual/en/function.random-bytes.php), [MCrypt](http://php.net/manual/en/book.mcrypt.php), [OpenSSL](http://php.net/manual/en/book.openssl.php) or [Hash](http://php.net/manual/en/book.hash.php) depending on which built-in RNG you use (TwoFactorAuth will try to 'autodetect' and use the best available); however: feel free to provide your own (CS)RNG.
-
-## Installation
-
-Run the following command:
-
-`php composer.phar require robthree/twofactorauth`
-
-## Quick start
-
-If you want to hit the ground running then have a look at the [demo](demo/demo.php). It's very simple and easy!
-
-## Usage
-
-Here are some code snippets that should help you get started...
-
-````php
-// Create a TwoFactorAuth instance
-$tfa = new RobThree\Auth\TwoFactorAuth('My Company');
-````
-
-The TwoFactorAuth class constructor accepts 7 parameters (all optional):
-
-Parameter | Default value | Use
-------------------|---------------|--------------------------------------------------
-`$issuer` | `null` | Will be displayed in the app as issuer name
-`$digits` | `6` | The number of digits the resulting codes will be
-`$period` | `30` | The number of seconds a code will be valid
-`$algorithm` | `sha1` | The algorithm used
-`$qrcodeprovider` | `null` | QR-code provider (more on this later)
-`$rngprovider` | `null` | Random Number Generator provider (more on this later)
-`$timeprovider` | `null` | Time provider (more on this later)
-
-These parameters are all '`write once`'; the class will, for it's lifetime, use these values when generating / calculating codes. The number of digits, the period and algorithm are all set to values Google's Authticator app uses (and supports). You may specify `8` digits, a period of `45` seconds and the `sha256` algorithm but the authenticator app (be it Google's implementation, Authy or any other app) may or may not support these values. Your mileage may vary; keep it on the safe side if you don't control which app your audience uses.
-
-### Step 1: Set up secret shared key
-
-When a user wants to setup two-factor auth (or, more correctly, multi-factor auth) you need to create a secret. This will be your **shared secret**. This secret will need to be entered by the user in their app. This can be done manually, in which case you simply display the secret and have the user type it in the app:
-
-````php
-$secret = $tfa->createSecret();
-````
-
-The `createSecret()` method accepts two arguments: `$bits` (default: `80`) and `$requirecryptosecure` (default: `true`). The former is the number of bits generated for the shared secret. Make sure this argument is a multiple of 8 and, again, keep in mind that not all combinations may be supported by all apps. Google authenticator seems happy with 80 and 160, the default is set to 80 because that's what most sites (that I know of) currently use; however a value of 160 or higher is recommended (see [RFC 4226 - Algorithm Requirements](https://tools.ietf.org/html/rfc4226#section-4)). The latter is used to ensure that the secret is cryptographically secure; if you don't care very much for cryptographically secure secrets you can specify `false` and use a **non**-cryptographically secure RNG provider.
-
-````php
-// Display shared secret
-
Please enter the following code in your app: ''
-````
-
-Another, more user-friendly, way to get the shared secret into the app is to generate a [QR-code](http://en.wikipedia.org/wiki/QR_code) which can be scanned by the app. To generate these QR codes you can use any one of the built-in `QRProvider` classes:
-
-1. `GoogleQRCodeProvider` (default)
-2. `QRServerProvider`
-3. `QRicketProvider`
-
-...or implement your own provider. To implement your own provider all you need to do is implement the `IQRCodeProvider` interface. You can use the built-in providers mentioned before to serve as an example or read the next chapter in this file. The built-in classes all use a 3rd (e.g. external) party (Google, QRServer and QRicket) for the hard work of generating QR-codes (note: each of these services might at some point not be available or impose limitations to the number of codes generated per day, hour etc.). You could, however, easily use a project like [PHP QR Code](http://phpqrcode.sourceforge.net/) (or one of the [many others](https://packagist.org/search/?q=qr)) to generate your QR-codes without depending on external sources. Later on we'll [demonstrate](#qr-code-providers) how to do this.
-
-The built-in providers all have some provider-specific 'tweaks' you can 'apply'. Some provide support for different colors, others may let you specify the desired image-format etc. What they all have in common is that they return a QR-code as binary blob which, in turn, will be turned into a [data URI](http://en.wikipedia.org/wiki/Data_URI_scheme) by the `TwoFactorAuth` class. This makes it easy for you to display the image without requiring extra 'roundtrips' from browser to server and vice versa.
-
-````php
-// Display QR code to user
-
Scan the following image with your app:
-
-````
-
-When outputting a QR-code you can choose a `$label` for the user (which, when entering a shared secret manually, will have to be chosen by the user). This label may be an empty string or `null`. Also a `$size` may be specified (in pixels, width == height) for which we use a default value of `200`.
-
-### Step 2: Verify secret shared key
-
-When the shared secret is added to the app, the app will be ready to start generating codes which 'expire' each '`$period`' number of seconds. To make sure the secret was entered, or scanned, correctly you need to verify this by having the user enter a generated code. To check if the generated code is valid you call the `verifyCode()` method:
-
-````php
-// Verify code
-$result = $tfa->verifyCode($_SESSION['secret'], $_POST['verification']);
-````
-
-`verifyCode()` will return either `true` (the code was valid) or `false` (the code was invalid; no points for you!). You may need to store `$secret` in a `$_SESSION` or other persistent storage between requests. The `verifyCode()` accepts, aside from `$secret` and `$code`, two more parameters. The first being `$discrepancy`. Since TOTP codes are based on time("slices") it is very important that the server (but also client) have a correct date/time. But because the two *may* differ a bit we usually allow a certain amount of leeway. Because generated codes are valid for a specific period (remember the `$period` parameter in the `TwoFactorAuth`'s constructor?) we usually check the period directly before and the period directly after the current time when validating codes. So when the current time is `14:34:21`, which results in a 'current timeslice' of `14:34:00` to `14:34:30` we also calculate/verify the codes for `14:33:30` to `14:34:00` and for `14:34:30` to `14:35:00`. This gives us a 'window' of `14:33:30` to `14:35:00`. The `$discrepancy` parameter specifies how many periods (or: timeslices) we check in either direction of the current time. The default `$discrepancy` of `1` results in (max.) 3 period checks: -1, current and +1 period. A `$discrepancy` of `4` would result in a larger window (or: bigger time difference between client and server) of -4, -3, -2, -1, current, +1, +2, +3 and +4 periods.
-
-The second parameter `$time` allows you to check a code for a specific point in time. This parameter has no real practical use but can be handy for unittesting etc. The default value, `null`, means: use the current time.
-
-### Step 3: Store `$secret` with user and we're done!
-
-Ok, so now the code has been verified and found to be correct. Now we can store the `$secret` with our user in our database (or elsewhere) and whenever the user begins a new session we ask for a code generated by the authentication app of their choice. All we need to do is call `verifyCode()` again with the shared secret and the entered code and we know if the user is legit or not.
-
-Simple as 1-2-3.
-
-All we need is 3 methods and a constructor:
-
-````php
-public function __construct(
- $issuer = null,
- $digits = 6,
- $period = 30,
- $algorithm = 'sha1',
- RobThree\Auth\Providers\Qr\IQRCodeProvider $qrcodeprovider = null,
- RobThree\Auth\Providers\Rng\IRNGProvider $rngprovider = null
-);
-public function createSecret($bits = 80, $requirecryptosecure = true): string;
-public function getQRCodeImageAsDataUri($label, $secret, $size = 200): string;
-public function verifyCode($secret, $code, $discrepancy = 1, $time = null): bool;
-````
-
-### QR-code providers
-
-As mentioned before, this library comes with three 'built-in' QR-code providers. This chapter will touch the subject a bit but most of it should be self-explanatory. The `TwoFactorAuth`-class accepts a `$qrcodeprovider` parameter which lets you specify a built-in or custom QR-code provider. All three built-in providers do a simple HTTP request to retrieve an image using cURL and implement the [`IQRCodeProvider`](lib/Providers/Qr/IQRCodeProvider.php) interface which is all you need to implement to write your own QR-code provider.
-
-The default provider is the [`GoogleQRCodeProvider`](lib/Providers/Qr/GoogleQRCodeProvider.php) which uses the [Google Chart Tools](https://developers.google.com/chart/infographics/docs/qr_codes) to render QR-codes. Then we have the [`QRServerProvider`](lib/Providers/Qr/QRServerProvider.php) which uses the [goqr.me API](http://goqr.me/api/doc/create-qr-code/) and finally we have the [`QRicketProvider`](lib/Providers/Qr/QRicketProvider.php) which uses the [QRickit API](http://qrickit.com/qrickit_apps/qrickit_api.php). All three inherit from a common (abstract) baseclass named [`BaseHTTPQRCodeProvider`](lib/Providers/Qr/BaseHTTPQRCodeProvider.php) because all three share the same functionality: retrieve an image from a 3rd party over HTTP. All three classes have constructors that allow you to tweak some settings and most, if not all, arguments should speak for themselves. If you're not sure which values are supported, click the links in this paragraph for documentation on the API's that are utilized by these classes.
-
-If you don't like any of the built-in classes because you don't want to rely on external resources for example or because you're paranoid about sending the TOTP secret to these 3rd parties (which is useless to them since they miss *at least one* other factor in the [MFA process](http://en.wikipedia.org/wiki/Multi-factor_authentication)), feel tree to implement your own. The `IQRCodeProvider` interface couldn't be any simpler. All you need to do is implement 2 methods:
-
-````php
-getMimeType();
-getQRCodeImage($qrtext, $size);
-````
-
-The `getMimeType()` method should return the [MIME type](http://en.wikipedia.org/wiki/Internet_media_type) of the image that is returned by our implementation of `getQRCodeImage()`. In this example it's simply `image/png`. The `getQRCodeImage()` method is passed two arguments: `$qrtext` and `$size`. The latter, `$size`, is simply the width/height in pixels of the image desired by the caller. The first, `$qrtext` is the text that should be encoded in the QR-code. An example of such a text would be:
-
-`otpauth://totp/LABEL:alice@google.com?secret=JBSWY3DPEHPK3PXP&issuer=ISSUER`
-
-All you need to do is return the QR-code as binary image data and you're done. All parts of the `$qrtext` have been escaped for you (but note: you *may* need to escape the entire `$qrtext` just once more when passing the data to another server as GET-parameter).
-
-Let's see if we can use [PHP QR Code](http://phpqrcode.sourceforge.net/) to implement our own, custom, no-3rd-parties-allowed-here, provider. We start with downloading the [required (single) file](https://github.com/t0k4rt/phpqrcode/blob/master/phpqrcode.php) and putting it in the directory where `TwoFactorAuth.php` is located as well. Now let's implement the provider: create another file named `myprovider.php` in the `Providers\Qr` directory and paste in this content:
-
-````php
-createSecret();
-?>
-
Next create a QR code and let the user scan it: ...or display the secret to the user for manual entry: ' . chunk_split($secret, 4, ' ');
- $code = $tfa->getCode($secret);
- echo '
Next, have the user verify the code; at this time the code displayed by a 2FA-app would be: ' . $code . ' (but that changes periodically)';
- echo '
When the code checks out, 2FA can be / is enabled; store (encrypted?) secret with user and have the user verify a code each time a new session is started.';
- echo '
When aforementioned code (' . $code . ') was entered, the result would be: ' . (($tfa->verifyCode($secret, $code) === true) ? 'OK' : 'FAIL');
- ?>
-
-
Note: Make sure your server-time is NTP-synced! Depending on the $discrepancy allowed your time cannot drift too much from the users' time!
- ensureCorrectTime();
- echo 'Your hosts time seems to be correct / within margin';
- } catch (RobThree\Auth\TwoFactorAuthException $ex) {
- echo 'Warning: Your hosts time seems to be off: ' . $ex->getMessage();
- }
- ?>
-
-
diff --git a/vendor/robthree/twofactorauth/demo/loader.php b/vendor/robthree/twofactorauth/demo/loader.php
deleted file mode 100644
index 208f24d4..00000000
--- a/vendor/robthree/twofactorauth/demo/loader.php
+++ /dev/null
@@ -1,50 +0,0 @@
-=0;$i--) {
- static::$parentPath = dirname(static::$parentPath);
- }
- static::$paths = array();
- static::$files = array(__FILE__);
- }
-
- public static function register($path,$namespace) {
- if (!static::$initialized) static::initialize();
- static::$paths[$namespace] = trim($path,DIRECTORY_SEPARATOR);
- }
-
- public static function load($class) {
- if (class_exists($class,false)) return;
- if (!static::$initialized) static::initialize();
-
- foreach (static::$paths as $namespace => $path) {
- if (!$namespace || $namespace.static::$nsChar === substr($class, 0, strlen($namespace.static::$nsChar))) {
-
- $fileName = substr($class,strlen($namespace.static::$nsChar)-1);
- $fileName = str_replace(static::$nsChar, DIRECTORY_SEPARATOR, ltrim($fileName,static::$nsChar));
- $fileName = static::$parentPath.DIRECTORY_SEPARATOR.$path.DIRECTORY_SEPARATOR.$fileName.'.php';
-
- if (file_exists($fileName)) {
- include $fileName;
- return true;
- }
- }
- }
- return false;
- }
-}
-
-spl_autoload_register(array('Loader', 'load'));
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php
deleted file mode 100644
index 5cb3adda..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php
+++ /dev/null
@@ -1,27 +0,0 @@
- $url,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_CONNECTTIMEOUT => 10,
- CURLOPT_DNS_CACHE_TIMEOUT => 10,
- CURLOPT_TIMEOUT => 10,
- CURLOPT_SSL_VERIFYPEER => $this->verifyssl,
- CURLOPT_USERAGENT => 'TwoFactorAuth'
- ));
- $data = curl_exec($curlhandle);
-
- curl_close($curlhandle);
- return $data;
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php
deleted file mode 100644
index 19e086b7..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php
+++ /dev/null
@@ -1,39 +0,0 @@
-verifyssl = $verifyssl;
-
- $this->errorcorrectionlevel = $errorcorrectionlevel;
- $this->margin = $margin;
- }
-
- public function getMimeType()
- {
- return 'image/png';
- }
-
- public function getQRCodeImage($qrtext, $size)
- {
- return $this->getContent($this->getUrl($qrtext, $size));
- }
-
- public function getUrl($qrtext, $size)
- {
- return 'https://chart.googleapis.com/chart?cht=qr'
- . '&chs=' . $size . 'x' . $size
- . '&chld=' . $this->errorcorrectionlevel . '|' . $this->margin
- . '&chl=' . rawurlencode($qrtext);
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php
deleted file mode 100644
index 83ed67ba..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php
+++ /dev/null
@@ -1,9 +0,0 @@
-verifyssl = $verifyssl;
-
- $this->errorcorrectionlevel = $errorcorrectionlevel;
- $this->margin = $margin;
- $this->qzone = $qzone;
- $this->bgcolor = $bgcolor;
- $this->color = $color;
- $this->format = $format;
- }
-
- public function getMimeType()
- {
- switch (strtolower($this->format))
- {
- case 'png':
- return 'image/png';
- case 'gif':
- return 'image/gif';
- case 'jpg':
- case 'jpeg':
- return 'image/jpeg';
- case 'svg':
- return 'image/svg+xml';
- case 'eps':
- return 'application/postscript';
- }
- throw new \QRException(sprintf('Unknown MIME-type: %s', $this->format));
- }
-
- public function getQRCodeImage($qrtext, $size)
- {
- return $this->getContent($this->getUrl($qrtext, $size));
- }
-
- private function decodeColor($value)
- {
- return vsprintf('%d-%d-%d', sscanf($value, "%02x%02x%02x"));
- }
-
- public function getUrl($qrtext, $size)
- {
- return 'https://api.qrserver.com/v1/create-qr-code/'
- . '?size=' . $size . 'x' . $size
- . '&ecc=' . strtoupper($this->errorcorrectionlevel)
- . '&margin=' . $this->margin
- . '&qzone=' . $this->qzone
- . '&bgcolor=' . $this->decodeColor($this->bgcolor)
- . '&color=' . $this->decodeColor($this->color)
- . '&format=' . strtolower($this->format)
- . '&data=' . rawurlencode($qrtext);
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Qr/QRicketProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Qr/QRicketProvider.php
deleted file mode 100644
index 59e27ccd..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Qr/QRicketProvider.php
+++ /dev/null
@@ -1,54 +0,0 @@
-verifyssl = false;
-
- $this->errorcorrectionlevel = $errorcorrectionlevel;
- $this->bgcolor = $bgcolor;
- $this->color = $color;
- $this->format = $format;
- }
-
- public function getMimeType()
- {
- switch (strtolower($this->format))
- {
- case 'p':
- return 'image/png';
- case 'g':
- return 'image/gif';
- case 'j':
- return 'image/jpeg';
- }
- throw new \QRException(sprintf('Unknown MIME-type: %s', $this->format));
- }
-
- public function getQRCodeImage($qrtext, $size)
- {
- return $this->getContent($this->getUrl($qrtext, $size));
- }
-
- public function getUrl($qrtext, $size)
- {
- return 'http://qrickit.com/api/qr'
- . '?qrsize=' . $size
- . '&e=' . strtolower($this->errorcorrectionlevel)
- . '&bgdcolor=' . $this->bgcolor
- . '&fgdcolor=' . $this->color
- . '&t=' . strtolower($this->format)
- . '&d=' . rawurlencode($qrtext);
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php
deleted file mode 100644
index 8dba7fc9..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Rng/CSRNGProvider.php
+++ /dev/null
@@ -1,14 +0,0 @@
-algorithm = $algorithm;
- }
-
- public function getRandomBytes($bytecount) {
- $result = '';
- $hash = mt_rand();
- for ($i = 0; $i < $bytecount; $i++) {
- $hash = hash($this->algorithm, $hash.mt_rand(), true);
- $result .= $hash[mt_rand(0, sizeof($hash))];
- }
- return $result;
- }
-
- public function isCryptographicallySecure() {
- return false;
- }
-}
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php
deleted file mode 100644
index 6be28006..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php
+++ /dev/null
@@ -1,9 +0,0 @@
-source = $source;
- }
-
- public function getRandomBytes($bytecount) {
- $result = mcrypt_create_iv($bytecount, $this->source);
- if ($result === false)
- throw new \RNGException('mcrypt_create_iv returned an invalid value');
- return $result;
- }
-
- public function isCryptographicallySecure() {
- return true;
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php
deleted file mode 100644
index dc66c64a..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Rng/OpenSSLRNGProvider.php
+++ /dev/null
@@ -1,25 +0,0 @@
-requirestrong = $requirestrong;
- }
-
- public function getRandomBytes($bytecount) {
- $result = openssl_random_pseudo_bytes($bytecount, $crypto_strong);
- if ($this->requirestrong && ($crypto_strong === false))
- throw new \RNGException('openssl_random_pseudo_bytes returned non-cryptographically strong value');
- if ($result === false)
- throw new \RNGException('openssl_random_pseudo_bytes returned an invalid value');
- return $result;
- }
-
- public function isCryptographicallySecure() {
- return $this->requirestrong;
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php b/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php
deleted file mode 100644
index eb5e913d..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Rng/RNGException.php
+++ /dev/null
@@ -1,5 +0,0 @@
-timestamp))
- throw new \TimeException('Unable to retrieve time from convert-unix-time.com');
- return $json->timestamp;
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Time/HttpTimeProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Time/HttpTimeProvider.php
deleted file mode 100644
index 8e7806e2..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Time/HttpTimeProvider.php
+++ /dev/null
@@ -1,54 +0,0 @@
-url = $url;
- $this->expectedtimeformat = $expectedtimeformat;
- $this->options = $options;
- if ($this->options === null) {
- $this->options = array(
- 'http' => array(
- 'method' => 'HEAD',
- 'follow_location' => false,
- 'ignore_errors' => true,
- 'max_redirects' => 0,
- 'request_fulluri' => true,
- 'header' => array(
- 'Connection: close',
- 'User-agent: TwoFactorAuth HttpTimeProvider (https://github.com/RobThree/TwoFactorAuth)',
- 'Cache-Control: no-cache'
- )
- )
- );
- }
- }
-
- public function getTime() {
- try {
- $context = stream_context_create($this->options);
- $fd = fopen($this->url, 'rb', false, $context);
- $headers = stream_get_meta_data($fd);
- fclose($fd);
-
- foreach ($headers['wrapper_data'] as $h) {
- if (strcasecmp(substr($h, 0, 5), 'Date:') === 0)
- return \DateTime::createFromFormat($this->expectedtimeformat, trim(substr($h,5)))->getTimestamp();
- }
- throw new \TimeException(sprintf('Unable to retrieve time from %s (Invalid or no "Date:" header found)', $this->url));
- }
- catch (Exception $ex) {
- throw new \TimeException(sprintf('Unable to retrieve time from %s (%s)', $this->url, $ex->getMessage()));
- }
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/Providers/Time/ITimeProvider.php b/vendor/robthree/twofactorauth/lib/Providers/Time/ITimeProvider.php
deleted file mode 100644
index a3b87a20..00000000
--- a/vendor/robthree/twofactorauth/lib/Providers/Time/ITimeProvider.php
+++ /dev/null
@@ -1,8 +0,0 @@
-issuer = $issuer;
- if (!is_int($digits) || $digits <= 0)
- throw new TwoFactorAuthException('Digits must be int > 0');
- $this->digits = $digits;
-
- if (!is_int($period) || $period <= 0)
- throw new TwoFactorAuthException('Period must be int > 0');
- $this->period = $period;
-
- $algorithm = strtolower(trim($algorithm));
- if (!in_array($algorithm, self::$_supportedalgos))
- throw new TwoFactorAuthException('Unsupported algorithm: ' . $algorithm);
- $this->algorithm = $algorithm;
- $this->qrcodeprovider = $qrcodeprovider;
- $this->rngprovider = $rngprovider;
- $this->timeprovider = $timeprovider;
-
- self::$_base32 = str_split(self::$_base32dict);
- self::$_base32lookup = array_flip(self::$_base32);
- }
-
- /**
- * Create a new secret
- */
- public function createSecret($bits = 80, $requirecryptosecure = true)
- {
- $secret = '';
- $bytes = ceil($bits / 5); //We use 5 bits of each byte (since we have a 32-character 'alphabet' / BASE32)
- $rngprovider = $this->getRngprovider();
- if ($requirecryptosecure && !$rngprovider->isCryptographicallySecure())
- throw new TwoFactorAuthException('RNG provider is not cryptographically secure');
- $rnd = $rngprovider->getRandomBytes($bytes);
- for ($i = 0; $i < $bytes; $i++)
- $secret .= self::$_base32[ord($rnd[$i]) & 31]; //Mask out left 3 bits for 0-31 values
- return $secret;
- }
-
- /**
- * Calculate the code with given secret and point in time
- */
- public function getCode($secret, $time = null)
- {
- $secretkey = $this->base32Decode($secret);
-
- $timestamp = "\0\0\0\0" . pack('N*', $this->getTimeSlice($this->getTime($time))); // Pack time into binary string
- $hashhmac = hash_hmac($this->algorithm, $timestamp, $secretkey, true); // Hash it with users secret key
- $hashpart = substr($hashhmac, ord(substr($hashhmac, -1)) & 0x0F, 4); // Use last nibble of result as index/offset and grab 4 bytes of the result
- $value = unpack('N', $hashpart); // Unpack binary value
- $value = $value[1] & 0x7FFFFFFF; // Drop MSB, keep only 31 bits
-
- return str_pad($value % pow(10, $this->digits), $this->digits, '0', STR_PAD_LEFT);
- }
-
- /**
- * Check if the code is correct. This will accept codes starting from ($discrepancy * $period) sec ago to ($discrepancy * period) sec from now
- */
- public function verifyCode($secret, $code, $discrepancy = 1, $time = null)
- {
- $result = false;
- $timetamp = $this->getTime($time);
-
- // To keep safe from timing-attachs we iterate *all* possible codes even though we already may have verified a code is correct
- for ($i = -$discrepancy; $i <= $discrepancy; $i++)
- $result |= $this->codeEquals($this->getCode($secret, $timetamp + ($i * $this->period)), $code);
-
- return (bool)$result;
- }
-
- /**
- * Timing-attack safe comparison of 2 codes (see http://blog.ircmaxell.com/2014/11/its-all-about-time.html)
- */
- private function codeEquals($safe, $user) {
- if (function_exists('hash_equals')) {
- return hash_equals($safe, $user);
- }
- // In general, it's not possible to prevent length leaks. So it's OK to leak the length. The important part is that
- // we don't leak information about the difference of the two strings.
- if (strlen($safe)===strlen($user)) {
- $result = 0;
- for ($i = 0; $i < strlen($safe); $i++)
- $result |= (ord($safe[$i]) ^ ord($user[$i]));
- return $result === 0;
- }
- return false;
- }
-
- /**
- * Get data-uri of QRCode
- */
- public function getQRCodeImageAsDataUri($label, $secret, $size = 200)
- {
- if (!is_int($size) || $size <= 0)
- throw new TwoFactorAuthException('Size must be int > 0');
-
- $qrcodeprovider = $this->getQrCodeProvider();
- return 'data:'
- . $qrcodeprovider->getMimeType()
- . ';base64,'
- . base64_encode($qrcodeprovider->getQRCodeImage($this->getQRText($label, $secret), $size));
- }
-
- /**
- * Compare default timeprovider with specified timeproviders and ensure the time is within the specified number of seconds (leniency)
- */
- public function ensureCorrectTime(array $timeproviders = null, $leniency = 5)
- {
- if ($timeproviders != null && !is_array($timeproviders))
- throw new TwoFactorAuthException('No timeproviders specified');
-
- if ($timeproviders == null)
- $timeproviders = array(
- new Providers\Time\ConvertUnixTimeDotComTimeProvider(),
- new Providers\Time\HttpTimeProvider()
- );
-
- // Get default time provider
- $timeprovider = $this->getTimeProvider();
-
- // Iterate specified time providers
- foreach ($timeproviders as $t) {
- if (!($t instanceof ITimeProvider))
- throw new TwoFactorAuthException('Object does not implement ITimeProvider');
-
- // Get time from default time provider and compare to specific time provider and throw if time difference is more than specified number of seconds leniency
- if (abs($timeprovider->getTime() - $t->getTime()) > $leniency)
- throw new TwoFactorAuthException(sprintf('Time for timeprovider is off by more than %d seconds when compared to %s', $leniency, get_class($t)));
- }
- }
-
- private function getTime($time)
- {
- return ($time === null) ? $this->getTimeProvider()->getTime() : $time;
- }
-
- private function getTimeSlice($time = null, $offset = 0)
- {
- return (int)floor($time / $this->period) + ($offset * $this->period);
- }
-
- /**
- * Builds a string to be encoded in a QR code
- */
- public function getQRText($label, $secret)
- {
- return 'otpauth://totp/' . rawurlencode($label)
- . '?secret=' . rawurlencode($secret)
- . '&issuer=' . rawurlencode($this->issuer)
- . '&period=' . intval($this->period)
- . '&algorithm=' . rawurlencode(strtoupper($this->algorithm))
- . '&digits=' . intval($this->digits);
- }
-
- private function base32Decode($value)
- {
- if (strlen($value)==0) return '';
-
- if (preg_match('/[^'.preg_quote(self::$_base32dict).']/', $value) !== 0)
- throw new TwoFactorAuthException('Invalid base32 string');
-
- $buffer = '';
- foreach (str_split($value) as $char)
- {
- if ($char !== '=')
- $buffer .= str_pad(decbin(self::$_base32lookup[$char]), 5, 0, STR_PAD_LEFT);
- }
- $length = strlen($buffer);
- $blocks = trim(chunk_split(substr($buffer, 0, $length - ($length % 8)), 8, ' '));
-
- $output = '';
- foreach (explode(' ', $blocks) as $block)
- $output .= chr(bindec(str_pad($block, 8, 0, STR_PAD_RIGHT)));
- return $output;
- }
-
- /**
- * @return IQRCodeProvider
- * @throws TwoFactorAuthException
- */
- public function getQrCodeProvider()
- {
- // Set default QR Code provider if none was specified
- if (null === $this->qrcodeprovider) {
- return $this->qrcodeprovider = new Providers\Qr\GoogleQRCodeProvider();
- }
- return $this->qrcodeprovider;
- }
-
- /**
- * @return IRNGProvider
- * @throws TwoFactorAuthException
- */
- public function getRngprovider()
- {
- if (null !== $this->rngprovider) {
- return $this->rngprovider;
- }
- if (function_exists('random_bytes')) {
- return $this->rngprovider = new Providers\Rng\CSRNGProvider();
- }
- if (function_exists('mcrypt_create_iv')) {
- return $this->rngprovider = new Providers\Rng\MCryptRNGProvider();
- }
- if (function_exists('openssl_random_pseudo_bytes')) {
- return $this->rngprovider = new Providers\Rng\OpenSSLRNGProvider();
- }
- if (function_exists('hash')) {
- return $this->rngprovider = new Providers\Rng\HashRNGProvider();
- }
- throw new TwoFactorAuthException('Unable to find a suited RNGProvider');
- }
-
- /**
- * @return ITimeProvider
- * @throws TwoFactorAuthException
- */
- public function getTimeProvider()
- {
- // Set default time provider if none was specified
- if (null === $this->timeprovider) {
- return $this->timeprovider = new Providers\Time\LocalMachineTimeProvider();
- }
- return $this->timeprovider;
- }
-}
\ No newline at end of file
diff --git a/vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php b/vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php
deleted file mode 100644
index af51b748..00000000
--- a/vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php
+++ /dev/null
@@ -1,7 +0,0 @@
-assertEquals('543160', $tfa->getCode('VMR466AB62ZBOKHE', 1426847216));
- $this->assertEquals('538532', $tfa->getCode('VMR466AB62ZBOKHE', 0));
- }
-
- /**
- * @expectedException \RobThree\Auth\TwoFactorAuthException
- */
- public function testCreateSecretThrowsOnInsecureRNGProvider() {
- $rng = new TestRNGProvider();
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', null, $rng);
- $tfa->createSecret();
- }
-
- public function testCreateSecretOverrideSecureDoesNotThrowOnInsecureRNG() {
- $rng = new TestRNGProvider();
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', null, $rng);
- $this->assertEquals('ABCDEFGHIJKLMNOP', $tfa->createSecret(80, false));
- }
-
- public function testCreateSecretDoesNotThrowOnSecureRNGProvider() {
- $rng = new TestRNGProvider(true);
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', null, $rng);
- $this->assertEquals('ABCDEFGHIJKLMNOP', $tfa->createSecret());
- }
-
- public function testCreateSecretGeneratesDesiredAmountOfEntropy() {
- $rng = new TestRNGProvider(true);
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', null, $rng);
- $this->assertEquals('A', $tfa->createSecret(5));
- $this->assertEquals('AB', $tfa->createSecret(6));
- $this->assertEquals('ABCDEFGHIJKLMNOPQRSTUVWXYZ', $tfa->createSecret(128));
- $this->assertEquals('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', $tfa->createSecret(160));
- $this->assertEquals('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', $tfa->createSecret(320));
- $this->assertEquals('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567ABCDEFGHIJKLMNOPQRSTUVWXYZ234567A', $tfa->createSecret(321));
- }
-
- public function testEnsureCorrectTimeDoesNotThrowForCorrectTime() {
- $tpr1 = new TestTimeProvider(123);
- $tpr2 = new TestTimeProvider(128);
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', null, null, $tpr1);
- $tfa->ensureCorrectTime(array($tpr2)); // 128 - 123 = 5 => within default leniency
- }
-
- /**
- * @expectedException \RobThree\Auth\TwoFactorAuthException
- */
- public function testEnsureCorrectTimeThrowsOnIncorrectTime() {
- $tpr1 = new TestTimeProvider(123);
- $tpr2 = new TestTimeProvider(124);
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', null, null, $tpr1);
- $tfa->ensureCorrectTime(array($tpr2), 0); // We force a leniency of 0, 124-123 = 1 so this should throw
- }
-
-
- public function testEnsureDefaultTimeProviderReturnsCorrectTime() {
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1');
- $tfa->ensureCorrectTime(array(new TestTimeProvider(time())), 1); // Use a leniency of 1, should the time change between both time() calls
- }
-
- public function testEnsureAllTimeProvidersReturnCorrectTime() {
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1');
- $tfa->ensureCorrectTime(array(
- new RobThree\Auth\Providers\Time\ConvertUnixTimeDotComTimeProvider(),
- new RobThree\Auth\Providers\Time\HttpTimeProvider(), // Uses google.com by default
- new RobThree\Auth\Providers\Time\HttpTimeProvider('https://github.com'),
- new RobThree\Auth\Providers\Time\HttpTimeProvider('https://yahoo.com'),
- ));
- }
-
- public function testVerifyCodeWorksCorrectly() {
-
- $tfa = new TwoFactorAuth('Test', 6, 30);
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 1, 1426847190));
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 0, 1426847190 + 29)); //Test discrepancy
- $this->assertEquals(false, $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 0, 1426847190 + 30)); //Test discrepancy
- $this->assertEquals(false, $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 0, 1426847190 - 1)); //Test discrepancy
-
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 1, 1426847205 + 0)); //Test discrepancy
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 1, 1426847205 + 35)); //Test discrepancy
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 1, 1426847205 - 35)); //Test discrepancy
-
- $this->assertEquals(false, $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 1, 1426847205 + 65)); //Test discrepancy
- $this->assertEquals(false, $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 1, 1426847205 - 65)); //Test discrepancy
-
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 2, 1426847205 + 65)); //Test discrepancy
- $this->assertEquals(true , $tfa->verifyCode('VMR466AB62ZBOKHE', '543160', 2, 1426847205 - 65)); //Test discrepancy
- }
-
- public function testTotpUriIsCorrect() {
- $qr = new TestQrProvider();
-
- $tfa = new TwoFactorAuth('Test&Issuer', 6, 30, 'sha1', $qr);
- $data = $this->DecodeDataUri($tfa->getQRCodeImageAsDataUri('Test&Label', 'VMR466AB62ZBOKHE'));
- $this->assertEquals('test/test', $data['mimetype']);
- $this->assertEquals('base64', $data['encoding']);
- $this->assertEquals('otpauth://totp/Test%26Label?secret=VMR466AB62ZBOKHE&issuer=Test%26Issuer&period=30&algorithm=SHA1&digits=6@200', $data['data']);
- }
-
- /**
- * @expectedException \RobThree\Auth\TwoFactorAuthException
- */
- public function testGetQRCodeImageAsDataUriThrowsOnInvalidSize() {
- $qr = new TestQrProvider();
-
- $tfa = new TwoFactorAuth('Test', 6, 30, 'sha1', $qr);
- $tfa->getQRCodeImageAsDataUri('Test', 'VMR466AB62ZBOKHE', 0);
- }
-
- /**
- * @expectedException \RobThree\Auth\TwoFactorAuthException
- */
- public function testGetCodeThrowsOnInvalidBase32String1() {
- $tfa = new TwoFactorAuth('Test');
- $tfa->getCode('FOO1BAR8BAZ9'); //1, 8 & 9 are invalid chars
- }
-
- /**
- * @expectedException \RobThree\Auth\TwoFactorAuthException
- */
- public function testGetCodeThrowsOnInvalidBase32String2() {
- $tfa = new TwoFactorAuth('Test');
- $tfa->getCode('mzxw6==='); //Lowercase
- }
-
- public function testKnownBase32DecodeTestVectors() {
- // We usually don't test internals (e.g. privates) but since we rely heavily on base32 decoding and don't want
- // to expose this method nor do we want to give people the possibility of implementing / providing their own base32
- // decoding/decoder (as we do with Rng/QR providers for example) we simply test the private base32Decode() method
- // with some known testvectors **only** to ensure base32 decoding works correctly following RFC's so there won't
- // be any bugs hiding in there. We **could** 'fool' ourselves by calling the public getCode() method (which uses
- // base32decode internally) and then make sure getCode's output (in digits) equals expected output since that would
- // mean the base32Decode() works as expected but that **could** hide some subtle bug(s) in decoding the base32 string.
-
- // "In general, you don't want to break any encapsulation for the sake of testing (or as Mom used to say, "don't
- // expose your privates!"). Most of the time, you should be able to test a class by exercising its public methods."
- // Dave Thomas and Andy Hunt -- "Pragmatic Unit Testing
- $tfa = new TwoFactorAuth('Test');
-
- $method = new ReflectionMethod('RobThree\Auth\TwoFactorAuth', 'base32Decode');
- $method->setAccessible(true);
-
- // Test vectors from: https://tools.ietf.org/html/rfc4648#page-12
- $this->assertEquals('', $method->invoke($tfa, ''));
- $this->assertEquals('f', $method->invoke($tfa, 'MY======'));
- $this->assertEquals('fo', $method->invoke($tfa, 'MZXQ===='));
- $this->assertEquals('foo', $method->invoke($tfa, 'MZXW6==='));
- $this->assertEquals('foob', $method->invoke($tfa, 'MZXW6YQ='));
- $this->assertEquals('fooba', $method->invoke($tfa, 'MZXW6YTB'));
- $this->assertEquals('foobar', $method->invoke($tfa, 'MZXW6YTBOI======'));
- }
-
- public function testKnownBase32DecodeUnpaddedTestVectors() {
- // See testKnownBase32DecodeTestVectors() for the rationale behind testing the private base32Decode() method.
- // This test ensures that strings without the padding-char ('=') are also decoded correctly.
- // https://tools.ietf.org/html/rfc4648#page-4:
- // "In some circumstances, the use of padding ("=") in base-encoded data is not required or used."
- $tfa = new TwoFactorAuth('Test');
-
- $method = new ReflectionMethod('RobThree\Auth\TwoFactorAuth', 'base32Decode');
- $method->setAccessible(true);
-
- // Test vectors from: https://tools.ietf.org/html/rfc4648#page-12
- $this->assertEquals('', $method->invoke($tfa, ''));
- $this->assertEquals('f', $method->invoke($tfa, 'MY'));
- $this->assertEquals('fo', $method->invoke($tfa, 'MZXQ'));
- $this->assertEquals('foo', $method->invoke($tfa, 'MZXW6'));
- $this->assertEquals('foob', $method->invoke($tfa, 'MZXW6YQ'));
- $this->assertEquals('fooba', $method->invoke($tfa, 'MZXW6YTB'));
- $this->assertEquals('foobar', $method->invoke($tfa, 'MZXW6YTBOI'));
- }
-
-
- public function testKnownTestVectors_sha1() {
- //Known test vectors for SHA1: https://tools.ietf.org/html/rfc6238#page-15
- $secret = 'GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ'; //== base32encode('12345678901234567890')
- $tfa = new TwoFactorAuth('Test', 8, 30, 'sha1');
- $this->assertEquals('94287082', $tfa->getCode($secret, 59));
- $this->assertEquals('07081804', $tfa->getCode($secret, 1111111109));
- $this->assertEquals('14050471', $tfa->getCode($secret, 1111111111));
- $this->assertEquals('89005924', $tfa->getCode($secret, 1234567890));
- $this->assertEquals('69279037', $tfa->getCode($secret, 2000000000));
- $this->assertEquals('65353130', $tfa->getCode($secret, 20000000000));
- }
-
- public function testKnownTestVectors_sha256() {
- //Known test vectors for SHA256: https://tools.ietf.org/html/rfc6238#page-15
- $secret = 'GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZA'; //== base32encode('12345678901234567890123456789012')
- $tfa = new TwoFactorAuth('Test', 8, 30, 'sha256');
- $this->assertEquals('46119246', $tfa->getCode($secret, 59));
- $this->assertEquals('68084774', $tfa->getCode($secret, 1111111109));
- $this->assertEquals('67062674', $tfa->getCode($secret, 1111111111));
- $this->assertEquals('91819424', $tfa->getCode($secret, 1234567890));
- $this->assertEquals('90698825', $tfa->getCode($secret, 2000000000));
- $this->assertEquals('77737706', $tfa->getCode($secret, 20000000000));
- }
-
- public function testKnownTestVectors_sha512() {
- //Known test vectors for SHA512: https://tools.ietf.org/html/rfc6238#page-15
- $secret = 'GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQGEZDGNA'; //== base32encode('1234567890123456789012345678901234567890123456789012345678901234')
- $tfa = new TwoFactorAuth('Test', 8, 30, 'sha512');
- $this->assertEquals('90693936', $tfa->getCode($secret, 59));
- $this->assertEquals('25091201', $tfa->getCode($secret, 1111111109));
- $this->assertEquals('99943326', $tfa->getCode($secret, 1111111111));
- $this->assertEquals('93441116', $tfa->getCode($secret, 1234567890));
- $this->assertEquals('38618901', $tfa->getCode($secret, 2000000000));
- $this->assertEquals('47863826', $tfa->getCode($secret, 20000000000));
- }
-
- /**
- * @requires function random_bytes
- */
- public function testCSRNGProvidersReturnExpectedNumberOfBytes() {
- $rng = new \RobThree\Auth\Providers\Rng\CSRNGProvider();
- foreach ($this->getRngTestLengths() as $l)
- $this->assertEquals($l, strlen($rng->getRandomBytes($l)));
- $this->assertEquals(true, $rng->isCryptographicallySecure());
- }
-
- /**
- * @requires function hash_algos
- * @requires function hash
- */
- public function testHashRNGProvidersReturnExpectedNumberOfBytes() {
- $rng = new \RobThree\Auth\Providers\Rng\HashRNGProvider();
- foreach ($this->getRngTestLengths() as $l)
- $this->assertEquals($l, strlen($rng->getRandomBytes($l)));
- $this->assertEquals(false, $rng->isCryptographicallySecure());
- }
-
- /**
- * @requires function mcrypt_create_iv
- */
- public function testMCryptRNGProvidersReturnExpectedNumberOfBytes() {
- $rng = new \RobThree\Auth\Providers\Rng\MCryptRNGProvider();
- foreach ($this->getRngTestLengths() as $l)
- $this->assertEquals($l, strlen($rng->getRandomBytes($l)));
- $this->assertEquals(true, $rng->isCryptographicallySecure());
- }
-
- /**
- * @requires function openssl_random_pseudo_bytes
- */
- public function testStrongOpenSSLRNGProvidersReturnExpectedNumberOfBytes() {
- $rng = new \RobThree\Auth\Providers\Rng\OpenSSLRNGProvider(true);
- foreach ($this->getRngTestLengths() as $l)
- $this->assertEquals($l, strlen($rng->getRandomBytes($l)));
- $this->assertEquals(true, $rng->isCryptographicallySecure());
- }
-
- /**
- * @requires function openssl_random_pseudo_bytes
- */
- public function testNonStrongOpenSSLRNGProvidersReturnExpectedNumberOfBytes() {
- $rng = new \RobThree\Auth\Providers\Rng\OpenSSLRNGProvider(false);
- foreach ($this->getRngTestLengths() as $l)
- $this->assertEquals($l, strlen($rng->getRandomBytes($l)));
- $this->assertEquals(false, $rng->isCryptographicallySecure());
- }
-
-
- private function getRngTestLengths() {
- return array(1, 16, 32, 256);
- }
-
- private function DecodeDataUri($datauri) {
- if (preg_match('/data:(?P[\w\.\-\/]+);(?P\w+),(?P.*)/', $datauri, $m) === 1) {
- return array(
- 'mimetype' => $m['mimetype'],
- 'encoding' => $m['encoding'],
- 'data' => base64_decode($m['data'])
- );
- }
- return null;
- }
-}
-
-class TestRNGProvider implements IRNGProvider {
- private $isSecure;
-
- function __construct($isSecure = false) {
- $this->isSecure = $isSecure;
- }
-
- public function getRandomBytes($bytecount) {
- $result = '';
- for ($i=0; $i<$bytecount; $i++)
- $result.=chr($i);
- return $result;
-
- }
-
- public function isCryptographicallySecure() {
- return $this->isSecure;
- }
-}
-
-class TestQrProvider implements IQRCodeProvider {
- public function getQRCodeImage($qrtext, $size) {
- return $qrtext . '@' . $size;
- }
-
- public function getMimeType() {
- return 'test/test';
- }
-}
-
-class TestTimeProvider implements ITimeProvider {
- private $time;
-
- function __construct($time) {
- $this->time = $time;
- }
-
- public function getTime() {
- return $this->time;
- }
-}
\ No newline at end of file
diff --git a/vendor/zendframework/zendxml/.gitignore b/vendor/zendframework/zendxml/.gitignore
deleted file mode 100644
index 0a4f6e27..00000000
--- a/vendor/zendframework/zendxml/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-composer.lock
-vendor
-.buildpath
-.project
-.settings
diff --git a/vendor/zendframework/zendxml/.travis.yml b/vendor/zendframework/zendxml/.travis.yml
deleted file mode 100644
index 877b0650..00000000
--- a/vendor/zendframework/zendxml/.travis.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-sudo: false
-
-language: php
-
-branches:
- except:
- - /^release-.*$/
- - /^ghgfk-.*$/
-
-cache:
- directories:
- - $HOME/.composer/cache
-
-matrix:
- allow_failures:
- - php: hhvm
-matrix:
- fast_finish: true
- include:
- - php: 5.3
- - php: 5.4
- - php: 5.5
- env:
- - EXECUTE_CS_CHECK=true
- - php: 5.6
- - php: 7
- - php: hhvm
- allow_failures:
- - php: hhvm
-
-before_install:
- - composer self-update
-
-install:
- - travis_retry composer install --no-interaction --ignore-platform-reqs
-
-script:
- - ./vendor/bin/phpunit -c ./tests
- - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/phpcs --standard=PSR2 --ignore=tests/Bootstrap.php library tests ; fi
-
-notifications:
- irc: "irc.freenode.org#zftalk.dev"
- email: false
diff --git a/vendor/zendframework/zendxml/CHANGELOG.md b/vendor/zendframework/zendxml/CHANGELOG.md
index bca2961b..20395b1e 100644
--- a/vendor/zendframework/zendxml/CHANGELOG.md
+++ b/vendor/zendframework/zendxml/CHANGELOG.md
@@ -2,6 +2,30 @@
All notable changes to this project will be documented in this file, in reverse chronological order by release.
+## 1.1.0 - 2018-04-30
+
+### Added
+
+- [#13](https://github.com/zendframework/ZendXml/pull/13) adds support for PHP 7.1 and 7.2.
+
+### Changed
+
+- Nothing.
+
+### Deprecated
+
+- Nothing.
+
+### Removed
+
+- [#13](https://github.com/zendframework/ZendXml/pull/13) removes support for PHP 5.3, 5.4, and 5.5.
+
+- [#13](https://github.com/zendframework/ZendXml/pull/13) removes support for HHVM.
+
+### Fixed
+
+- Nothing.
+
## 1.0.2 - 2016-02-04
### Added
diff --git a/vendor/zendframework/zendxml/LICENSE.md b/vendor/zendframework/zendxml/LICENSE.md
index 141d3a2d..3aa0dce1 100644
--- a/vendor/zendframework/zendxml/LICENSE.md
+++ b/vendor/zendframework/zendxml/LICENSE.md
@@ -1,12 +1,27 @@
-Copyright (c) 2014-2015, Zend Technologies USA, Inc.
+Copyright (c) 2014-2018, Zend Technologies USA, Inc.
All rights reserved.
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+- Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+- Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
-- Neither the name of Zend Technologies USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+- Neither the name of Zend Technologies USA, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/zendframework/zendxml/README.md b/vendor/zendframework/zendxml/README.md
index 2c67008d..7da0ddfa 100644
--- a/vendor/zendframework/zendxml/README.md
+++ b/vendor/zendframework/zendxml/README.md
@@ -1,10 +1,11 @@
-ZendXml
-=======
+# ZendXml
+
+[](https://secure.travis-ci.org/zendframework/ZendXml)
+[](https://coveralls.io/github/zendframework/ZendXml?branch=master)
An utility component for XML usage and best practices in PHP
-Installation
-------------
+## Installation
You can install using:
@@ -16,8 +17,7 @@ php composer.phar install
Notice that this library doesn't have any external dependencies, the usage of composer is for autoloading and standard purpose.
-ZendXml\Security
-----------------
+## ZendXml\Security
This is a security component to prevent [XML eXternal Entity](https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Processing) (XXE) and [XML Entity Expansion](http://projects.webappsec.org/w/page/13247002/XML%20Entity%20Expansion) (XEE) attacks on XML documents.
@@ -46,5 +46,3 @@ $dom = new \DOMDocument('1.0');
$dom = XmlSecurity::scan($xml, $dom);
printf ("DOMDocument: %s\n", ($dom instanceof \DOMDocument) ? 'yes' : 'no');
```
-
-
diff --git a/vendor/zendframework/zendxml/composer.json b/vendor/zendframework/zendxml/composer.json
index d9efb222..28b81108 100644
--- a/vendor/zendframework/zendxml/composer.json
+++ b/vendor/zendframework/zendxml/composer.json
@@ -1,40 +1,54 @@
{
"name": "zendframework/zendxml",
"description": "Utility library for XML usage, best practices, and security in PHP",
- "type": "library",
"license": "BSD-3-Clause",
"keywords": [
- "zf2",
+ "zf",
+ "zendframework",
"xml",
"security"
],
- "homepage": "http://packages.zendframework.com/",
+ "support": {
+ "issues": "https://github.com/zendframework/ZendXml/issues",
+ "source": "https://github.com/zendframework/ZendXml",
+ "rss": "https://github.com/zendframework/ZendXml/releases.atom",
+ "chat": "https://zendframework-slack.herokuapp.com",
+ "forum": "https://discourse.zendframework.com/c/questions/components"
+ },
+ "require": {
+ "php": "^5.6 || ^7.0"
+ },
+ "require-dev": {
+ "zendframework/zend-coding-standard": "~1.0.0",
+ "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.4"
+ },
"autoload": {
- "psr-0": {
- "ZendXml\\": "library/"
+ "psr-4": {
+ "ZendXml\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "ZendTest\\Xml\\": "tests/ZendXmlTest/"
+ "ZendXmlTest\\": "test/"
}
},
- "repositories": [
- {
- "type": "composer",
- "url": "http://packages.zendframework.com/"
- }
- ],
- "require": {
- "php": "^5.3.3 || ^7.0"
+ "config": {
+ "sort-packages": true
},
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "1.1.x-dev",
+ "dev-develop": "1.2.x-dev"
}
},
- "require-dev": {
- "phpunit/phpunit": "^3.7 || ^4.0",
- "squizlabs/php_codesniffer": "^1.5"
+ "scripts": {
+ "check": [
+ "@cs-check",
+ "@test"
+ ],
+ "cs-check": "phpcs",
+ "cs-fix": "phpcbf",
+ "test": "phpunit --colors=always",
+ "test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
}
}
diff --git a/vendor/zendframework/zendxml/library/ZendXml/Exception/ExceptionInterface.php b/vendor/zendframework/zendxml/library/ZendXml/Exception/ExceptionInterface.php
deleted file mode 100644
index c55eb903..00000000
--- a/vendor/zendframework/zendxml/library/ZendXml/Exception/ExceptionInterface.php
+++ /dev/null
@@ -1,14 +0,0 @@
-loadXml($xml, LIBXML_NONET);
restore_error_handler();
- if (!$result) {
+ if (! $result) {
// Entity load to previous setting
- if (!self::isPhpFpm()) {
+ if (! self::isPhpFpm()) {
libxml_disable_entity_loader($loadEntities);
libxml_use_internal_errors($useInternalXmlErrors);
}
@@ -78,7 +77,7 @@ class Security
}
// Scan for potential XEE attacks using ENTITY, if not PHP-FPM
- if (!self::isPhpFpm()) {
+ if (! self::isPhpFpm()) {
foreach ($dom->childNodes as $child) {
if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
if ($child->entities->length > 0) {
@@ -89,14 +88,14 @@ class Security
}
// Entity load to previous setting
- if (!self::isPhpFpm()) {
+ if (! self::isPhpFpm()) {
libxml_disable_entity_loader($loadEntities);
libxml_use_internal_errors($useInternalXmlErrors);
}
if (isset($simpleXml)) {
$result = simplexml_import_dom($dom);
- if (!$result instanceof SimpleXMLElement) {
+ if (! $result instanceof SimpleXMLElement) {
return false;
}
return $result;
@@ -114,7 +113,7 @@ class Security
*/
public static function scanFile($file, DOMDocument $dom = null)
{
- if (!file_exists($file)) {
+ if (! file_exists($file)) {
throw new Exception\InvalidArgumentException(
"The file $file specified doesn't exist"
);
@@ -244,28 +243,28 @@ class Security
$closePos = strpos($xml, $close);
if (false === $closePos) {
- return array($fileEncoding);
+ return [$fileEncoding];
}
$encPos = strpos($xml, $encAttr);
if (false === $encPos
|| $encPos > $closePos
) {
- return array($fileEncoding);
+ return [$fileEncoding];
}
$encPos += strlen($encAttr);
$quotePos = strpos($xml, $quote, $encPos);
if (false === $quotePos) {
- return array($fileEncoding);
+ return [$fileEncoding];
}
$encoding = self::substr($xml, $encPos, $quotePos);
- return array(
+ return [
// Following line works because we're only supporting 8-bit safe encodings at this time.
str_replace('\0', '', $encoding), // detected encoding
$fileEncoding, // file encoding
- );
+ ];
}
/**
@@ -279,38 +278,38 @@ class Security
*/
protected static function getBomMap()
{
- return array(
- array(
+ return [
+ [
'encoding' => 'UTF-32BE',
'bom' => pack('CCCC', 0x00, 0x00, 0xfe, 0xff),
'length' => 4,
- ),
- array(
+ ],
+ [
'encoding' => 'UTF-32LE',
'bom' => pack('CCCC', 0xff, 0xfe, 0x00, 0x00),
'length' => 4,
- ),
- array(
+ ],
+ [
'encoding' => 'GB-18030',
'bom' => pack('CCCC', 0x84, 0x31, 0x95, 0x33),
'length' => 4,
- ),
- array(
+ ],
+ [
'encoding' => 'UTF-16BE',
'bom' => pack('CC', 0xfe, 0xff),
'length' => 2,
- ),
- array(
+ ],
+ [
'encoding' => 'UTF-16LE',
'bom' => pack('CC', 0xff, 0xfe),
'length' => 2,
- ),
- array(
+ ],
+ [
'encoding' => 'UTF-8',
'bom' => pack('CCC', 0xef, 0xbb, 0xbf),
'length' => 3,
- ),
- );
+ ],
+ ];
}
/**
@@ -324,7 +323,7 @@ class Security
*/
protected static function getAsciiEncodingMap()
{
- return array(
+ return [
'UTF-32BE' => function ($ascii) {
return preg_replace('/(.)/', "\0\0\0\\1", $ascii);
},
@@ -349,7 +348,7 @@ class Security
'GB-18030' => function ($ascii) {
return $ascii;
},
- );
+ ];
}
/**
diff --git a/vendor/zendframework/zendxml/tests/Bootstrap.php b/vendor/zendframework/zendxml/tests/Bootstrap.php
deleted file mode 100644
index a9d0e6a5..00000000
--- a/vendor/zendframework/zendxml/tests/Bootstrap.php
+++ /dev/null
@@ -1,92 +0,0 @@
-addDirectoryToWhitelist($zfCoreLibrary . '/' . $lastArg);
- } elseif (is_file($zfCoreTests . '/' . $lastArg)) {
- $codeCoverageFilter->addDirectoryToWhitelist(dirname($zfCoreLibrary . '/' . $lastArg));
- } else {
- $codeCoverageFilter->addDirectoryToWhitelist($zfCoreLibrary);
- }
-
- /*
- * Omit from code coverage reports the contents of the tests directory
- */
- $codeCoverageFilter->addDirectoryToBlacklist($zfCoreTests, '');
- $codeCoverageFilter->addDirectoryToBlacklist(PEAR_INSTALL_DIR, '');
- $codeCoverageFilter->addDirectoryToBlacklist(PHP_LIBDIR, '');
-
- unset($codeCoverageFilter);
-}
-
-/*
- * Unset global variables that are no longer needed.
- */
-unset($phpUnitVersion);
diff --git a/vendor/zendframework/zendxml/tests/ZendXmlTest/MultibyteTest.php b/vendor/zendframework/zendxml/tests/ZendXmlTest/MultibyteTest.php
deleted file mode 100644
index 165e8fa5..00000000
--- a/vendor/zendframework/zendxml/tests/ZendXmlTest/MultibyteTest.php
+++ /dev/null
@@ -1,125 +0,0 @@
- array('UTF-16LE', pack('CC', 0xff, 0xfe), 3),
- 'UTF-16BE' => array('UTF-16BE', pack('CC', 0xfe, 0xff), 3),
- 'UTF-32LE' => array('UTF-32LE', pack('CCCC', 0xff, 0xfe, 0x00, 0x00), 4),
- 'UTF-32BE' => array('UTF-32BE', pack('CCCC', 0x00, 0x00, 0xfe, 0xff), 4),
- );
- }
-
- public function getXmlWithXXE()
- {
- return <<
-
-]>
-
- retrieved: &pocdata;
-
-XML;
- }
-
- /**
- * Invoke ZendXml\Security::heuristicScan with the provided XML.
- *
- * @param string $xml
- * @return void
- * @throws Exception\RuntimeException
- */
- public function invokeHeuristicScan($xml)
- {
- $r = new ReflectionMethod('ZendXml\Security', 'heuristicScan');
- $r->setAccessible(true);
- return $r->invoke(null, $xml);
- }
-
- /**
- * @dataProvider multibyteEncodings
- * @group heuristicDetection
- */
- public function testDetectsMultibyteXXEVectorsUnderFPMWithEncodedStringMissingBOM($encoding, $bom, $bomLength)
- {
- $xml = $this->getXmlWithXXE();
- $xml = str_replace('{ENCODING}', $encoding, $xml);
- $xml = iconv('UTF-8', $encoding, $xml);
- $this->assertNotSame(0, strncmp($xml, $bom, $bomLength));
- $this->setExpectedException('ZendXml\Exception\RuntimeException', 'ENTITY');
- $this->invokeHeuristicScan($xml);
- }
-
- /**
- * @dataProvider multibyteEncodings
- */
- public function testDetectsMultibyteXXEVectorsUnderFPMWithEncodedStringUsingBOM($encoding, $bom)
- {
- $xml = $this->getXmlWithXXE();
- $xml = str_replace('{ENCODING}', $encoding, $xml);
- $orig = iconv('UTF-8', $encoding, $xml);
- $xml = $bom . $orig;
- $this->setExpectedException('ZendXml\Exception\RuntimeException', 'ENTITY');
- $this->invokeHeuristicScan($xml);
- }
-
- public function getXmlWithoutXXE()
- {
- return <<
-
- retrieved: &pocdata;
-
-XML;
- }
-
- /**
- * @dataProvider multibyteEncodings
- */
- public function testDoesNotFlagValidMultibyteXmlAsInvalidUnderFPM($encoding)
- {
- $xml = $this->getXmlWithoutXXE();
- $xml = str_replace('{ENCODING}', $encoding, $xml);
- $xml = iconv('UTF-8', $encoding, $xml);
- try {
- $result = $this->invokeHeuristicScan($xml);
- $this->assertNull($result);
- } catch (\Exception $e) {
- $this->fail('Security scan raised exception when it should not have');
- }
- }
-
- /**
- * @dataProvider multibyteEncodings
- * @group mixedEncoding
- */
- public function testDetectsXXEWhenXMLDocumentEncodingDiffersFromFileEncoding($encoding, $bom)
- {
- $xml = $this->getXmlWithXXE();
- $xml = str_replace('{ENCODING}', 'UTF-8', $xml);
- $xml = iconv('UTF-8', $encoding, $xml);
- $xml = $bom . $xml;
- $this->setExpectedException('ZendXml\Exception\RuntimeException', 'ENTITY');
- $this->invokeHeuristicScan($xml);
- }
-}
diff --git a/vendor/zendframework/zendxml/tests/ZendXmlTest/SecurityTest.php b/vendor/zendframework/zendxml/tests/ZendXmlTest/SecurityTest.php
deleted file mode 100644
index fa3b30bf..00000000
--- a/vendor/zendframework/zendxml/tests/ZendXmlTest/SecurityTest.php
+++ /dev/null
@@ -1,135 +0,0 @@
-
-]>
-
- This result is &harmless;
-
-XML;
-
- $this->setExpectedException('ZendXml\Exception\RuntimeException');
- $result = XmlSecurity::scan($xml);
- }
-
- public function testScanForXXE()
- {
- $file = tempnam(sys_get_temp_dir(), 'ZendXml_Security');
- file_put_contents($file, 'This is a remote content!');
- $xml = <<
-
-]>
-
- &foo;
-
-XML;
-
- try {
- $result = XmlSecurity::scan($xml);
- } catch (Exception\RuntimeException $e) {
- unlink($file);
- return;
- }
- $this->fail('An expected exception has not been raised.');
- }
-
- public function testScanSimpleXmlResult()
- {
- $result = XmlSecurity::scan($this->getXml());
- $this->assertTrue($result instanceof SimpleXMLElement);
- $this->assertEquals($result->result, 'test');
- }
-
- public function testScanDom()
- {
- $dom = new DOMDocument('1.0');
- $result = XmlSecurity::scan($this->getXml(), $dom);
- $this->assertTrue($result instanceof DOMDocument);
- $node = $result->getElementsByTagName('result')->item(0);
- $this->assertEquals($node->nodeValue, 'test');
- }
-
- public function testScanInvalidXml()
- {
- $xml = <<test
-XML;
-
- $result = XmlSecurity::scan($xml);
- $this->assertFalse($result);
- }
-
- public function testScanInvalidXmlDom()
- {
- $xml = <<test
-XML;
-
- $dom = new DOMDocument('1.0');
- $result = XmlSecurity::scan($xml, $dom);
- $this->assertFalse($result);
- }
-
- public function testScanFile()
- {
- $file = tempnam(sys_get_temp_dir(), 'ZendXml_Security');
- file_put_contents($file, $this->getXml());
-
- $result = XmlSecurity::scanFile($file);
- $this->assertTrue($result instanceof SimpleXMLElement);
- $this->assertEquals($result->result, 'test');
- unlink($file);
- }
-
- public function testScanXmlWithDTD()
- {
- $xml = <<
-
-
-]>
-
- test
-
-XML;
-
- $dom = new DOMDocument('1.0');
- $result = XmlSecurity::scan($xml, $dom);
- $this->assertTrue($result instanceof DOMDocument);
- $this->assertTrue($result->validate());
- }
-
- protected function getXml()
- {
- return <<
-
- test
-
-XML;
- }
-}
diff --git a/vendor/zendframework/zendxml/tests/phpunit.xml.dist b/vendor/zendframework/zendxml/tests/phpunit.xml.dist
deleted file mode 100755
index 069784bd..00000000
--- a/vendor/zendframework/zendxml/tests/phpunit.xml.dist
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- ./ZendXmlTest
- ./ZendXmlTest/TestAsset
-
-
-
-
-
-
-
-
-
-
-
-
-
- ./ZendXmlTest
- ../vendor
-
-
-
-
-
-
-