2019-06-06 13:40:06 +02:00
|
|
|
<?php
|
|
|
|
|
2021-12-02 13:15:53 +01:00
|
|
|
namespace Database\Factories;
|
2019-06-06 13:40:06 +02:00
|
|
|
|
2020-11-17 21:27:44 +01:00
|
|
|
use ParagonIE\ConstantTime\Base32;
|
2021-12-02 13:15:53 +01:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
2019-06-06 13:40:06 +02:00
|
|
|
|
2022-11-21 11:16:43 +01:00
|
|
|
/**
|
|
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\TwoFAccount>
|
|
|
|
*/
|
2021-12-02 13:15:53 +01:00
|
|
|
class TwoFAccountFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function definition()
|
|
|
|
{
|
|
|
|
$account = $this->faker->safeEmail();
|
2023-03-08 09:41:18 +01:00
|
|
|
$service = $this->faker->domainName();
|
2021-12-02 13:15:53 +01:00
|
|
|
$secret = Base32::encodeUpper($this->faker->regexify('[A-Z0-9]{8}'));
|
|
|
|
|
|
|
|
return [
|
2023-02-27 00:32:49 +01:00
|
|
|
'group_id' => null,
|
2021-12-02 13:15:53 +01:00
|
|
|
'otp_type' => 'totp',
|
|
|
|
'account' => $account,
|
|
|
|
'service' => $service,
|
|
|
|
'secret' => $secret,
|
|
|
|
'algorithm' => 'sha1',
|
|
|
|
'digits' => 6,
|
|
|
|
'period' => 30,
|
|
|
|
'legacy_uri' => 'otpauth://hotp/' . $service . ':' . $account . '?secret=' . $secret . '&issuer=' . $service,
|
|
|
|
'icon' => '',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|