Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tonydspaniard committed Aug 28, 2017
0 parents commit 921ad1c
Show file tree
Hide file tree
Showing 32 changed files with 1,653 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# yii console command
/yii

# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer vendor dir
/vendor

# no need in composer distribution
/composer.phar

# Mac DS_Store Files
.DS_Store

/phpunit.phar
# local phpunit config
/phpunit.xml

# vagrant runtime
/.vagrant
# vagrant folder we are not using it
vagrant
Vagrantfile

# javascript files
/node_modules
tests/_support/_generated
tests/_output/*

# temporary directory for various purposes
/temp

# ignore local codeception settings
codeception.yml

# Code Style Checkers and Mess Detectors
/phpcs.xml
/.php_cs.cache
/.php_cs

# test
/build

# composer.lock
composer.lock
48 changes: 48 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
$header = <<<'EOF'
This file is part of the 2amigos/2fa-library project.
(c) 2amigOS! <http://2amigos.us/>
For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude([
'.github',
'docs',
'temp',
'tests',
'vendor',
])
->in(__DIR__);

return PhpCsFixer\Config::create()
->setRules(array(
'@PSR1' => true,
'@PSR2' => true,
'header_comment' => ['header' => $header],
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'no_extra_consecutive_blank_lines' => array(
'break',
'continue',
'extra',
'return',
'throw',
'use',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block'
),
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_align' => true

))
->setFinder($finder);
35 changes: 35 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
filter:
excluded_paths: [tests/*, src/lib/*, src/cache/*]
checks:
php:
code_rating: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true
tools:
external_code_coverage:
timeout: 600
runs: 3
php_analyzer: true
php_code_coverage: false
php_code_sniffer:
config:
standard: PSR2
filter:
paths: ['src']
php_loc:
enabled: true
excluded_dirs: [vendor, tests]
php_cpd:
enabled: true
excluded_dirs: [vendor, tests]
51 changes: 51 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# faster builds on new travis setup not using sudo
sudo: false

language: php

php:
- 5.6
- 7.0
- 7.1

cache:
directories:
- vendor
- $HOME/.composer/cache

install:
- |
if [[ $TRAVIS_PHP_VERSION != '7.1' && $TRAVIS_PHP_VERSION != hhv* ]]; then
# disable xdebug for performance reasons when code coverage is not needed
# note: xdebug on hhvm is disabled by default
phpenv config-rm xdebug.ini || echo "xdebug is not installed"
fi
- travis_retry composer self-update && composer --version
- travis_retry composer global require "fxp/composer-asset-plugin:^1.3.0" --no-plugins
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install --prefer-dist --no-interaction

before_script:
- php -r "echo INTL_ICU_VERSION . \"\n\";"
- php -r "echo INTL_ICU_DATA_VERSION . \"\n\";"

# enable code coverage on PHP 7.1, only one PHP version needs to generate coverage data
- |
if [ $TRAVIS_PHP_VERSION = '7.1' ]; then
CODECEPTION_FLAGS="--coverage-xml"
fi
script:
- composer validate --no-check-lock
- vendor/bin/codecept run $CODECEPTION_FLAGS

notifications:
email:
- hola@2amigos.us

after_script:
- |
if [ $TRAVIS_PHP_VERSION = '7.1' ]; then
travis_retry wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
fi
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# CHANGELOG

## 1.0.0 - August 27, 2017
- Initial release (tonydspaniard)
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

We accept contributions via Pull Requests on [Github](https://github.com/2amigos/yii2-qrcode-helper).


## Pull Requests

- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.

- **Create feature branches** - Don't ask us to pull from your master branch.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.


## Running Tests

``` bash
$ phpunit
```


**Happy coding**!
28 changes: 28 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The BSD License (BSD)

Copyright (c) 2013-2015, 2amigOS! Consulting Group LLC.

> 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 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 2amigOS! Consulting Group, LLC. 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 HOLDER 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.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
2fa library
===========

[![Latest Version](https://img.shields.io/github/tag/2amigos/2fa-library.svg?style=flat-square&label=release)](https://github.com/2amigos/2fa-library/tags)
[![Software License](https://img.shields.io/badge/license-BSD-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/2amigos/2fa-library/master.svg?style=flat-square)](https://travis-ci.org/2amigos/2fa-library)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/2amigos/2fa-library.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/2fa-library/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/2amigos/2fa-library.svg?style=flat-square)](https://scrutinizer-ci.com/g/2amigos/2fa-library)
[![Total Downloads](https://img.shields.io/packagist/dt/2amigos/2fa-library.svg)](https://packagist.org/packages/2amigos/2fa-library)


This library allows developers to implement Time Based One Time Passwords (TOTP) for the PHP implementation of the
2factor Authentication (2FA), supporting both the HMAC-based one-time password (HOTP) and the time-based one-time
passwords (TOTP).

## Documentation

You can read the latest docs on [http://2fa-library.readthedocs.io/en/latest/](http://2fa-library.readthedocs.io/en/latest/)

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Credits

- [Antonio Ribeiro Google 2FA](https://github.com/antonioribeiro/google2fa)
- [Antonio Ramirez](https://github.com/tonydspaniard)
- [All Contributors](../../contributors)

## License

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.


> [![2amigOS!](http://www.gravatar.com/avatar/55363394d72945ff7ed312556ec041e0.png)](http://www.2amigos.us)
<i>Web development has never been so fun!</i>
[www.2amigos.us](http://www.2amigos.us)
75 changes: 75 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "2amigos/2fa-library",
"description": "2 Factor Authentication (2FA) library",
"type": "library",
"keywords": [
"2amigos",
"php",
"extension",
"library",
"2FA",
"TOTP",
"HOTP",
"authticator"
],
"homepage": "http://www.2amigos.us/open-source/details/twofa-library",
"license": "BSD-3-Clause",
"authors": [
{
"name": "2amigOS! Consulting Group",
"email": "hola@2amigos.us",
"homepage": "http://2amigos.us",
"role": "Developer"
}
],
"support": {
"issues": "https://github.com/2amigos/2fa-library/issues",
"source": "https://github.com/2amigos/2fa-library"
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=5.6",
"paragonie/constant_time_encoding": "^2.0",
"paragonie/random_compat": "^2.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.3",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "*",
"phpmd/phpmd": "@stable",
"codeception/specify": "^0.4.3",
"codeception/verify": "^0.3.1",
"codeception/codeception": "*",
"2amigos/qrcode-library": "^1.1"
},
"suggest": {
"2amigos/2fa-library": "To be able to create inline QrCodes data uri schemes with logos and labels"
},
"autoload": {
"psr-4": {
"Da\\TwoFA\\": "./src"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"config": {
"preferred-install": {
"*": "auto"
},
"fxp-asset": {
"installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
},
"vcs-driver-options": {
"github-no-api": true
},
"git-skip-update": "2 days",
"pattern-skip-version": "(-build|-patch)"
}
}
}
Loading

0 comments on commit 921ad1c

Please sign in to comment.