diff --git a/database/factories/TwoFAccountFactory.php b/database/factories/TwoFAccountFactory.php index 489971b8..8ac0c98c 100644 --- a/database/factories/TwoFAccountFactory.php +++ b/database/factories/TwoFAccountFactory.php @@ -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' => '', ]; -}); +}); \ No newline at end of file diff --git a/database/seeds/DemoSeeder.php b/database/seeds/DemoSeeder.php index 30227f33..19154347 100644 --- a/database/seeds/DemoSeeder.php +++ b/database/seeds/DemoSeeder.php @@ -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' ]); } diff --git a/database/seeds/TwoFAccountsTableSeeder.php b/database/seeds/TwoFAccountsTableSeeder.php index 8a4121c3..1c256a52 100644 --- a/database/seeds/TwoFAccountsTableSeeder.php +++ b/database/seeds/TwoFAccountsTableSeeder.php @@ -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/', ]); } } \ No newline at end of file