2017 © Pedro Peláez
 

library expiring-token

A cryptographically safe token with a build in customizable expiration date

image

pageon/expiring-token

A cryptographically safe token with a build in customizable expiration date

  • Wednesday, February 22, 2017
  • by justcarakas
  • Repository
  • 1 Watchers
  • 2 Stars
  • 81 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 23 % Grown

The README.md

Expiring Token

Build Status License Code Coverage Scrutinizer Code Quality, (*1)

The expiring token generates a random token of 128 characters with an expiration date., (*2)

The token uses base64 but the length is calculated so that it is url safe, so no padding with the = character., (*3)

The actual token is generated with random_bytes with a length of 32, (*4)

Installation

You can add this library as a local, per-project dependency to your project using Composer:, (*5)

composer require pageon/expiring-token

Public api

ExpiringToken::create

You can create a new token this way. It accepts a DateInterval as optional parameter to set a different expiration date., (*6)

The default expiration date is 3 days., (*7)

ExpiringToken::fromString

Used to create an instance of the token from the string representation, (*8)

ExpiringToken::__toString

This turns the class instance into the string version of the token when the instance is used as or cast to a string., (*9)

ExpiringToken::validateAgainst

This can be used to validate the current token against an other token, (*10)

  • When the tokens maths this method will return true
  • An InvalidToken exception will be thrown if the tokens don't match
  • An TokenHasExpired exception will be thrown if the token has expired

ExpiringToken::hasExpired

Returns a bool indicating if the current token has expired, (*11)

ExpiringToken::getExpiresOn

Can be used to get the expiration date of the token, (*12)

The Versions

22/02 2017

dev-master

9999999-dev https://pageon.github.io/ExpriringToken

A cryptographically safe token with a build in customizable expiration date

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Jelmer Prins

php token password reset expiring time sensitive password forgotten

22/02 2017

1.0.2

1.0.2.0 https://pageon.github.io/ExpriringToken

A cryptographically safe token with a build in customizable expiration date

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Jelmer Prins

php token password reset expiring time sensitive password forgotten

22/02 2017

1.0.1

1.0.1.0 https://pageon.github.io/ExpriringToken

A cryptographically safe token with a build in customizable expiration date

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Jelmer Prins

php token password reset expiring time sensitive password forgotten

22/02 2017

1.0.0

1.0.0.0 https://pageon.github.io/ExpriringToken

A cryptographically safe token with a build in customizable expiration date

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Jelmer Prins

php token password reset expiring time sensitive password forgotten