1 | <?php |
||
19 | class SecretKeyValidator implements ValidatorInterface |
||
20 | { |
||
21 | use FailReasonTrait; |
||
22 | |||
23 | /** |
||
24 | * Enforce Google Authenticator compatibility. |
||
25 | */ |
||
26 | protected $googleAuthenticatorCompatibility; |
||
27 | |||
28 | /** |
||
29 | * Encoder constructor. |
||
30 | * |
||
31 | * @param bool $enforceGoogleAuthenticatorCompatibility |
||
32 | */ |
||
33 | public function __construct(bool $enforceGoogleAuthenticatorCompatibility = true) |
||
37 | |||
38 | /** |
||
39 | * @param bool $enforce |
||
40 | */ |
||
41 | public function enforceGoogleAuthenticatorCompatibility(bool $enforce): void |
||
45 | |||
46 | /** |
||
47 | * @return bool |
||
48 | */ |
||
49 | public function isGoogleAuthenticatorCompatibilityEnforced(): bool |
||
53 | |||
54 | /** |
||
55 | * @param mixed $value |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function validate($value): bool |
||
73 | |||
74 | /** |
||
75 | * Check if the secret key is compatible with Google Authenticator. |
||
76 | * |
||
77 | * @param string $value |
||
78 | * |
||
79 | * @throws GoogleAuthenticatorCompatibilityException |
||
80 | */ |
||
81 | protected function checkGoogleAuthenticatorCompatibility(string $value): void |
||
90 | |||
91 | /** |
||
92 | * Check if all secret key characters are valid. |
||
93 | * |
||
94 | * @param string $value |
||
95 | * |
||
96 | * @throws InvalidCharactersException |
||
97 | */ |
||
98 | protected function checkForValidCharacters(string $value): void |
||
104 | } |
||
105 |