| Total Complexity | 3 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 11 | trait TOTPAware |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Gets the encryption key to use from environment variables. This is generated by default on the Common Web |
||
| 15 | * Platform, but can be defined as a custom value if required. |
||
| 16 | * |
||
| 17 | * @return string |
||
| 18 | */ |
||
| 19 | protected function getEncryptionKey(): string |
||
| 20 | { |
||
| 21 | return (string) Environment::getEnv('SS_MFA_SECRET_KEY'); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Get an instance of the TOTP handler service. The secret must already be defined and set to the StoreInterface. |
||
| 26 | * |
||
| 27 | * @param StoreInterface $store |
||
| 28 | * @return TOTPInterface |
||
| 29 | * @throws RuntimeException |
||
| 30 | */ |
||
| 31 | protected function getTotp(StoreInterface $store): TOTPInterface |
||
| 38 | } |
||
| 39 | } |
||
| 40 |