2022-09-30 13:56:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services\Migrators;
|
|
|
|
|
2022-10-07 18:58:48 +02:00
|
|
|
use Illuminate\Support\Collection;
|
2022-09-30 13:56:11 +02:00
|
|
|
|
|
|
|
abstract class Migrator
|
|
|
|
{
|
|
|
|
/**
|
2022-10-07 18:58:48 +02:00
|
|
|
* Convert migration data to a 2FAccounts collection.
|
|
|
|
*
|
2022-11-21 11:16:43 +01:00
|
|
|
* @return \Illuminate\Support\Collection<int|string, \App\Models\TwoFAccount> The converted accounts
|
2022-09-30 13:56:11 +02:00
|
|
|
*/
|
2022-10-12 11:13:13 +02:00
|
|
|
abstract public function migrate(mixed $migrationPayload) : Collection;
|
2022-09-30 13:56:11 +02:00
|
|
|
|
2022-10-11 11:20:07 +02:00
|
|
|
/**
|
|
|
|
* Pad a string to 8 chars min
|
2022-11-22 15:15:52 +01:00
|
|
|
*
|
2022-10-12 11:13:13 +02:00
|
|
|
* @return string The padded string
|
2022-10-11 11:20:07 +02:00
|
|
|
*/
|
|
|
|
protected function padToValidBase32Secret(string $string)
|
|
|
|
{
|
|
|
|
return str_pad($string, 8, '=');
|
|
|
|
}
|
2022-09-30 13:56:11 +02:00
|
|
|
}
|