Commit Graph

47 Commits

Author SHA1 Message Date
2080319f6f make QR Code Provider a mandatory constructor argument
This change is discussed in #104
Currently, the library defaults to a QR Code Provider using an external
service, thus leaking secrets.

This change forces the definition of a QR Code Provider in the
constructor. It is a breaking change.

fixes #104
2024-04-25 21:23:39 +02:00
d4a5026d86 Revert back to the intended 160 bits 2024-04-17 20:43:49 +02:00
e08b0a5445 Merge branch 'master' into nico-sensitive-attr
* master:
  add CI4-auth link in README. fix #107 (#123)
  remove insecure rng providers and remove polyfill for hash_equals (#122)
  delete files specific to code editors (#120)
  Exclude useless files from dist archive #103
2024-04-16 18:21:01 +02:00
194ecc28eb remove insecure rng providers and remove polyfill for hash_equals (#122)
* remove insecure rng providers

and remove the openssl provider. We now rely exclusively on
random_bytes(), as there are no reasons not to. Fix #121

* remove the isSecure property of the test rng class

* remove pointless test rng class

we were testing a test class, which didn't make a lot of sense.

* Revert "remove pointless test rng class"

This reverts commit f6da6bee6d.

* Reapply "remove pointless test rng class"

This reverts commit 06220d4a54.

* assing rng provider to class attribute

this also aligns with other providers

* remove polyfill for hash_equals
2024-04-16 16:52:51 +01:00
bba4c207c2 use global import 2024-04-15 21:43:53 +02:00
76f420e6b2 add SensitiveParameter to sensitive arguments
This change adds the PHP attribute SensitiveParameter to the secret
holding variables.
See: https://www.php.net/manual/en/class.sensitiveparameter

This feature is only available in PHP 8.2, so the minimum php version
required has been updated.

Github Actions now use PHP 8.2 and 8.3 for the tests.
The checkout action has been updated to v4, too.

Fix issue #118
2024-04-15 21:40:19 +02:00
9bc454f425 use null coalescing assignment instead of just null coalescing 2023-05-28 18:58:39 +02:00
d4f6aa1ee6 add missing @throws tag 2023-05-27 21:41:10 +02:00
d94ee9c769 remove useless @throws because it never throws 2023-05-27 21:36:04 +02:00
955ce522f0 add readonly modifiers wherever possible 2023-05-27 21:33:54 +02:00
e584f0c56a remove unnecessary type casts 2023-05-27 21:30:29 +02:00
5949a29b89 use null coalescing operator instead of if checks 2023-05-27 21:29:57 +02:00
8bf8800523 use empty string comparison instead of strlen call 2023-05-27 21:29:57 +02:00
26413e69f0 extract strlen check from loop 2023-05-27 21:29:57 +02:00
3adb3e54e5 add missing delimiter for proper escaping 2023-05-27 21:29:57 +02:00
7675282f45 put scalar types to the right 2023-05-27 21:29:57 +02:00
9a1aeb8c1f fix formatting 2023-05-27 20:19:48 +02:00
921425d0ff use psr12 in phpcs config 2022-12-29 13:35:16 +01:00
4711674ec0 crank phpstan to level 6 2022-12-29 13:32:02 +01:00
ac721e57b9 add php-cs-fixer 2022-12-07 23:10:13 +01:00
a8c297c178 second batch with QR providers 2022-12-07 23:02:41 +01:00
aeb4b00c60 first batch 2022-12-07 22:28:52 +01:00
0096cce02d convert issuer to string prevents php 8.1 errors
By forcing $this->issuer to be string, even if null is set, it prevents throwing errors in PHP 8.1 is `rawurlencode` is not allowed to have null as parameter.

It would be better to force string to be already in `__construct`, but this may create a breaking change for existing users.
2021-11-29 06:50:54 +01:00
38f349fccd Merge remote-tracking branch 'igorsantos/qr-logos' 2021-03-09 18:09:38 +00:00
33a32cb099 📚 doc blocks 2021-03-08 18:24:44 +00:00
58d3354367 🐛 correct some minor issues 2021-03-08 18:20:07 +00:00
2aa6f46e20 🎨 fix the majority of code sniffs 2021-02-08 17:28:05 +00:00
cc2ae19bcd Document the need for the code to be a string 2021-01-25 02:32:41 -03:00
3407c33775 * Switched default ImageChartsQRCodeProvider to QRServerProvider 2019-06-21 10:51:04 +02:00
7477d5d656 * Replace google image charts with image-charts.com 2019-03-19 22:51:19 +01:00
c18ec155ae * Minor refactoring of verifyCode. 2018-06-09 12:09:24 +02:00
fca87f2d09 * Fix a bug that caused timeslices to be returned instead of the intended timeslice
* Upped version
2018-06-06 02:32:07 +02:00
93fc6355d4 * Dropped ConvertUnixTimeDotComTimeProvider
* Added NTPTimeProvider
* Added out argument on verifyCode() method that returns the matched timeslice (if any) when a valid code was entered
2018-06-05 22:17:49 +02:00
5093ab230c * Fix TwoFactorAuth class actually uses the TimeProvider
* Update README and DEMO to advise using 160+ bits secret
2017-02-17 16:24:54 +01:00
9735116635 * Implemented ITimeProviders 2017-02-17 14:53:55 +01:00
178c60d947 * Redo #15 which somehow didn't merge... 2017-02-17 12:15:17 +01:00
aec91881bf changed getQRText() from private to public
Changed access modifier for the function getQRText() from private to
public.
This allows for generating the QR Code in different ways (eg pass the
data from getQRText() to the client and have a Javascript Library render
the QR Code)
2016-06-24 17:34:39 +02:00
c94fcd83d8 * Added new (PHP7+) CSRNGProvider (uses random_bytes)
* Added a bunch basic of unittests for the RNG's
* QRicketProvider and QRServerProvider now throw on invalid MIME-types
* TwoFactorAuth now first tries to use CSRNGProvider before any of the other RNG providers
2015-12-02 16:38:20 +01:00
e837caa9ce * Force VerifyCode() to return bool 2015-07-16 15:43:45 +02:00
52cbcf7579 * Removed stupid typo 2015-04-30 14:39:06 +02:00
955e9b0b03 * Fix for possible timing-attack in verifyCode() method 2015-04-30 12:53:21 +02:00
f1a729c9ed * Better variable naming 2015-04-06 20:29:16 +02:00
74a18a8fa6 * Added some base32 decoding-specific unittests
* Base32 decoding now allows for padding chars
2015-03-22 23:46:15 +01:00
34b6f279ca * Tabs -> Spaces. Yep. 2015-03-21 01:35:08 +01:00
9e417bdb2f * Size for QR image must be > 0 2015-03-20 12:57:03 +01:00
3687b0b32d * Renamed namespace 2015-03-19 15:46:46 +01:00
553b725ab7 * Move stuff around 2015-03-19 15:05:51 +01:00