Update db seeds & factories

This commit is contained in:
Bubka 2021-11-12 09:53:40 +01:00
parent 5687a99cb7
commit b6a5ce6677
3 changed files with 71 additions and 41 deletions

View File

@ -20,13 +20,14 @@
$factory->define(TwoFAccount::class, function (Faker $faker) {
$service = $faker->unique()->domainName;
$account = $faker->safeEmail;
return [
'service' => $service,
'account' => $account,
'uri' => 'otpauth://totp/' . $service . ':' . $account . '?secret=' . Base32::encodeUpper($faker->regexify('[A-Z0-9]{8}')) . '&issuer=' . $service,
'otp_type' => 'totp',
'account' => $faker->safeEmail,
'service' => $faker->unique()->domainName,
'secret' => Base32::encodeUpper($faker->regexify('[A-Z0-9]{8}')),
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => '',
];
});
});

View File

@ -20,65 +20,74 @@ public function run()
]);
TwoFAccount::create([
'service' => 'Amazon',
'otp_type' => 'totp',
'account' => 'johndoe',
'uri' => 'otpauth://totp/johndoe@amazon.com?secret=A7GRFTVVRBGY7UIW&issuer=amazon',
'icon' => 'amazon.png'
'service' => 'Amazon',
'secret' => 'A7GRFTVVRBGY7UIW',
'icon' => 'amazon.png',
]);
TwoFAccount::create([
'service' => 'Apple',
'otp_type' => 'totp',
'account' => 'john.doe@icloud.com',
'uri' => 'otpauth://totp/john@apple.com?secret=A2GRFTVVRBGY7UIW&issuer=apple',
'icon' => 'apple.png'
'service' => 'Apple',
'secret' => 'A2GRFTVVRBGY7UIW',
'icon' => 'apple.png',
]);
TwoFAccount::create([
'service' => 'Dropbox',
'otp_type' => 'totp',
'account' => 'john.doe',
'uri' => 'otpauth://totp/johndoe@dropbox.com?secret=A3GRFTVVRBGY7UIW&issuer=dropbox',
'icon' => 'dropbox.png'
'service' => 'Dropbox',
'secret' => 'A3GRFTVVRBGY7UIW',
'icon' => 'dropbox.png',
]);
TwoFAccount::create([
'service' => 'Facebook',
'otp_type' => 'totp',
'account' => 'johndoe@facebook.com',
'uri' => 'otpauth://totp/johndoe@facebook.com?secret=A4GRFTVVRBGY7UIW&issuer=facebook',
'icon' => 'facebook.png'
'service' => 'Facebook',
'secret' => 'A4GRFTVVRBGY7UIW',
'icon' => 'facebook.png',
]);
TwoFAccount::create([
'service' => 'Github',
'otp_type' => 'totp',
'account' => '@john',
'uri' => 'otpauth://totp/johndoe@github.com?secret=A2GRFTVVRBGY7UIW&issuer=github',
'icon' => 'github.png'
'service' => 'Github',
'secret' => 'A2GRFTVVRBGY7UIW',
'icon' => 'github.png',
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'Google',
'account' => 'john.doe@gmail.com',
'uri' => 'otpauth://totp/johndoe@google.com?secret=A5GRFTVVRBGY7UIW&issuer=google',
'secret' => 'A5GRFTVVRBGY7UIW',
'icon' => 'google.png'
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'Instagram',
'account' => '@johndoe',
'uri' => 'otpauth://totp/johndoe@instagram.com?secret=A6GRFTVVRBGY7UIW&issuer=instagram',
'secret' => 'A6GRFTVVRBGY7UIW',
'icon' => 'instagram.png'
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'LinkedIn',
'account' => '@johndoe',
'uri' => 'otpauth://totp/johndoe@linkedin.com?secret=A7GRFTVVRBGY7UIW&issuer=linkedin',
'secret' => 'A7GRFTVVRBGY7UIW',
'icon' => 'linkedin.png'
]);
TwoFAccount::create([
'otp_type' => 'totp',
'service' => 'Twitter',
'account' => '@john',
'uri' => 'otpauth://totp/johndoe@twitter.com?secret=A2GRFTVVRBGY7UIW&issuer=twitter',
'secret' => 'A2GRFTVVRBGY7UIW',
'icon' => 'twitter.png'
]);
}

View File

@ -14,34 +14,54 @@ public function run()
$faker = \Faker\Factory::create();
TwoFAccount::create([
'otp_type' => 'totp',
'account' => $faker->safeEmail,
'service' => $faker->unique()->domainName,
'account' => $faker->email,
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFTVVRBGY7UIW&issuer=test',
'icon' => 'https://fakeimg.pl/64x64/'
'secret' => 'A4GRFHZVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'https://fakeimg.pl/64x64/',
]);
TwoFAccount::create([
'otp_type' => 'totp',
'account' => $faker->safeEmail,
'service' => $faker->unique()->domainName,
'account' => $faker->email,
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHYVRBGY7UIW&issuer=test',
'icon' => 'https://fakeimg.pl/64x64/'
'secret' => 'A4GRFHZVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'https://fakeimg.pl/64x64/',
]);
TwoFAccount::create([
'otp_type' => 'totp',
'account' => $faker->safeEmail,
'service' => $faker->unique()->domainName,
'account' => $faker->email,
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHZVRBGY7UIW&issuer=test',
'icon' => 'https://fakeimg.pl/64x64/'
'secret' => 'A4GRFHZVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'https://fakeimg.pl/64x64/',
]);
TwoFAccount::create([
'otp_type' => 'totp',
'account' => $faker->safeEmail,
'service' => $faker->unique()->domainName,
'account' => $faker->email,
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVIRBGY7UIW&issuer=test',
'icon' => 'https://fakeimg.pl/64x64/'
'secret' => 'A4GRFHZVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'https://fakeimg.pl/64x64/',
]);
TwoFAccount::create([
'otp_type' => 'totp',
'account' => $faker->safeEmail,
'service' => $faker->unique()->domainName,
'account' => $faker->email,
'uri' => 'otpauth://totp/test@test.com?secret=A4GRFHVVOBGY7UIW&issuer=test',
'icon' => 'https://fakeimg.pl/64x64/'
'secret' => 'A4GRFHZVRBGY7UIW',
'algorithm' => 'sha1',
'digits' => 6,
'period' => 30,
'icon' => 'https://fakeimg.pl/64x64/',
]);
}
}