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

View File

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

View File

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