Skip to content

Commit

Permalink
feat: Enables easy development via a docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodedrift committed Jan 17, 2025
1 parent ec80282 commit 6403696
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/.idea/
/coverage/
/vendor/
hooks
.phpunit.result.cache
composer.lock
composer.phar
cghooks.lock
26 changes: 22 additions & 4 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
HOTP - PHP Based HMAC One Time Passwords
========================================
# HOTP - PHP Based HMAC One Time Passwords

**What is HOTP**:
HOTP is a class that simplifies One Time Password systems for PHP Authentication. The HOTP/TOTP Algorithms have been around for a bit, so this is a straightforward class to meet the test vector requirements.

**What works with HOTP/TOTP**:
It's been tested to the test vectors, and I've verified the time-sync hashes against the following:

* Android: Mobile-OTP
* iPhone: OATH Token
- Android: Mobile-OTP
- iPhone: OATH Token

**Why would I use this**:
Who wouldn't love a simple drop-in class for HMAC Based One Time Passwords? It's a great extra layer of security (creating two-factor auth) and it's pretty darn zippy.
Expand Down Expand Up @@ -40,3 +39,22 @@ $result->toDec();
// how many digits in your OTP?
$result->toHotp( $length );
```

# Development

In order to support multiple PHP versions, a docker file and compose is available.

To build a php docker image with composer (and dependencies):

```bash
# Bring up the environment, mounts to /app in the container
docker compose up

# Get into the PHP environment
docker compose exec php bash

# Run composer
cd /app
composer install
composer test
```
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "jakobo/hotp-php",
"version": "2.0.0",
"description": "HOTP simplifies One Time Password systems for PHP Authentication",
"license": "BSD-3-Clause",
"authors" : [
Expand Down
5 changes: 5 additions & 0 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM php:fpm
RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get update
RUN apt install -y git-all unzip
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
php:
build: ./dev
volumes:
- ./:/app

0 comments on commit 6403696

Please sign in to comment.