2FAuth/database/factories/TwoFAccountFactory.php

38 lines
1.1 KiB
PHP
Raw Normal View History

2019-06-06 13:40:06 +02:00
<?php
/* @var $factory \Illuminate\Database\Eloquent\Factory */
use App\TwoFAccount;
use Faker\Generator as Faker;
2020-11-17 21:27:44 +01:00
use ParagonIE\ConstantTime\Base32;
2019-06-06 13:40:06 +02:00
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(TwoFAccount::class, function (Faker $faker) {
2021-11-14 01:52:46 +01:00
$account = $faker->safeEmail;
$service = $faker->unique()->domainName;
$secret = Base32::encodeUpper($faker->regexify('[A-Z0-9]{8}'));
2019-06-06 13:40:06 +02:00
return [
2021-11-12 09:53:40 +01:00
'otp_type' => 'totp',
2021-11-14 01:52:46 +01:00
'account' => $account,
'service' => $service,
'secret' => $secret,
2021-11-12 09:53:40 +01:00
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
2021-11-14 01:52:46 +01:00
'legacy_uri' => 'otpauth://hotp/' . $service . ':' . $account . '?secret=' . $secret . '&issuer=' . $service,
2020-01-10 13:43:36 +01:00
'icon' => '',
2019-06-06 13:40:06 +02:00
];
2021-11-12 09:53:40 +01:00
});