Total Complexity | 6 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | class Argon2IdHandler extends ArgonHandler |
||
22 | { |
||
23 | /** |
||
24 | * {@inheritDoc} |
||
25 | * |
||
26 | * @throws RuntimeException |
||
27 | */ |
||
28 | public function check(string $value, string $hashedValue, array $options = []): bool |
||
29 | { |
||
30 | if ($hashedValue === '') { |
||
31 | return false; |
||
32 | } |
||
33 | |||
34 | if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) { |
||
35 | throw new RuntimeException("Ce mot de passe n'utilise pas l'algorithme Argon2id."); |
||
36 | } |
||
37 | |||
38 | return password_verify($value, $hashedValue); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | protected function isUsingCorrectAlgorithm(string $hashedValue): bool |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | */ |
||
52 | protected function algorithm(): string |
||
57 |