You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-27Lines changed: 49 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,18 +18,22 @@ A generator for counter based ([RFC 4226](https://tools.ietf.org/html/rfc4226))
18
18
19
19
# Documentation
20
20
## Requirements
21
-
- PHP 7.0+
21
+
- PHP 7.2+
22
+
-[`ext-curl`](https://www.php.net/manual/book.curl) for Battle.net and Steam Guard server time synchronization
23
+
-[`ext-gmp`](https://www.php.net/manual/book.gmp) for Battle.net authenticator secret retrieval (RSA encryption)
24
+
-[`ext-sodium`](https://www.php.net/manual/book.sodium) for constant time implementations of base64 encode/decode and hex2bin/bin2hex
25
+
([`paragonie/constant_time_encoding`](https://github.com/paragonie/constant_time_encoding) is used as fallback)
22
26
23
27
## Installation
24
28
**requires [composer](https://getcomposer.org)**
25
29
26
30
via terminal: `composer require chillerlan/php-authenticator`
27
31
28
-
*composer.json* (note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^2.1` - see [releases](https://github.com/chillerlan/php-authenticator/releases) for valid versions)
32
+
*composer.json* (note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^3.1` - see [releases](https://github.com/chillerlan/php-authenticator/releases) for valid versions)
29
33
```json
30
34
{
31
35
"require": {
32
-
"php": "^7.0",
36
+
"php": "^7.2 || ^8.0",
33
37
"chillerlan/php-authenticator": "dev-main"
34
38
}
35
39
}
@@ -43,12 +47,15 @@ The secret is usually being created once during the activation process in a user
43
47
So all you need to do there is to display it to the user in a convenient way -
44
48
as a text string and QR code for example - and save it somewhere with the user data.
45
49
```php
46
-
use chillerlan\Authenticator\Authenticator;
50
+
use chillerlan\Authenticator\{Authenticator, AuthenticatorOptions};
47
51
48
-
$authenticator = new Authenticator;
52
+
$options = new AuthenticatorOptions;
53
+
$options->secret_length = 32;
54
+
55
+
$authenticator = new Authenticator($options);
49
56
// create a secret (stored somewhere in a *safe* place on the server. safe... hahaha jk)
50
57
$secret = $authenticator->createSecret();
51
-
// you can also specify the length of the secret key
58
+
// you can also specify the length of the secret key, which overrides the options setting
0 commit comments