Skip to content

Commit

Permalink
Removes duplicated section
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkGhostHunter authored Jul 29, 2022
1 parent fc05688 commit 0f284c5
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,24 +372,6 @@ To add your own language, publish the translation files. These will be located i
php artisan vendor:publish --provider="Laragear\TwoFactor\TwoFactorServiceProvider" --tag="translations"
```

## Custom Recovery Codes

Recovery codes are automatically generated using [`Str::random()`](https://laravel.com/docs/9.x/helpers#method-str-random) with [small configuration](#recovery-codes). This will suffice for most applications, but you can also create your own random string code generator.

To create your own generator, set a custom callback to generate a recovery code with `TwoFactorAuthentication::generateRecoveryCodesUsing()`. This callable will receive the configuration string length, iteration, and total amount of codes, and should return an alfa-numeric string.

```php
use Laragear\TwoFactor\Models\TwoFactorAuthentication;
use Illuminate\Support\Str;

TwoFactorAuthentication::generateRecoveryCodesUsing(function ($length, $iteration, $total) {
// Append the index of the code before the string.
return $iteration . Str::random($length);
});
```

This package will handle the recovery code match and usage for you, so you don't need to worry about that.

## Configuration

To further configure the package, publish the configuration file:
Expand Down

0 comments on commit 0f284c5

Please sign in to comment.