Skip to content

Releases: ericmann/totp

Modern Build Pipelines

30 Jul 01:03
b7cc9e7
Compare
Choose a tag to compare
  • Upgrades build pipelines to leverage GitHub Actions rather than Travis-CI
  • Leverages static analysis by way of PHPStan
  • Updates minimum PHP support to 7.4 (while also forward-testing 8.0)

Modern PHP Update

26 Jan 05:55
40fb7b8
Compare
Choose a tag to compare

This newest release bumps the minimum supported version of PHP to 7.2 and, since we're now on PHP 7, drops the dependency on random_compat.

Developers will also experience:

  • More consistent code quality, enforced by PHP Code Sniffer
  • A formal code of conduct for the project
  • Contribution templates for GitHub

Multi-Hash Authentication Support

22 Nov 23:55
Compare
Choose a tag to compare

While creating TOTPs for all three hash variants was previously supported, we lacked support for authenticating TOTPs for anything except sha1. This version introduces optional parameters to support all three hashing variants where needed.

Stellar Code Coverage

22 Nov 04:58
bf268b4
Compare
Choose a tag to compare

Cover one final edge case where a broken invocation could trigger a divide-by-zero error. The library at this stage is stable, has 100% test coverage, and is compatible with PHP 5.6-7.2.

Key-length Padding

22 Nov 04:32
3f1f33f
Compare
Choose a tag to compare

The HMAC algorithm requires a minimum key length for hashing, but doesn't specify a maximum. Rather than assume keys are generated to fit the spec, automatically pad them (with bytes from the key itself) until we've got to the correct length.

The following key lengths are needed for the various hashing algorithms:

  • SHA1: 20 bytes
  • SHA256: 32 bytes
  • SHA512: 64 bytes

If the HMAC key specified is shorter than the length required for a given hash, we'll concatenate bytes from the key to make up length.

For example:

$secret = 'abcdef'; // 6 bytes
$hash = 'sha1';

$padded = EAMann\TOTP\pad_secret($secret, $hash);
// $padded => abcdefabcdefabcdefab

Hashing Update

21 Nov 19:25
Compare
Choose a tag to compare

Our initial implementation covered the SHA1 hash and, though it suggested coverage of SHA256/512, these implementations were broken.

This release shores up our hashing implementation to properly support the full set of available hashes for TOTP generation. It further leverages the test vectors included in Appendix B of the TOTP RFC spec to ensure proper coverage according to reference implementations.

PHP version compatibility is unchanged and no method signatures were updated.

Initial Release

22 Nov 04:59
1b81368
Compare
Choose a tag to compare

Port the core of the TOTP mechanism that powers Dovedi into a standalone library.