Conditions | 2 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
25 | public function encrypt( |
||
26 | PasswordInterface $password, |
||
27 | string $data, |
||
28 | int $ttl = 0 |
||
29 | ): Token { |
||
30 | $salt = call_user_func($this->saltGenerator); |
||
31 | $iv = random_bytes(openssl_cipher_iv_length($this->method)); |
||
32 | |||
33 | return new Token( |
||
34 | $password, |
||
35 | $salt, |
||
36 | $iv, |
||
37 | $this->generateCipherText($data, $password, $salt, $iv), |
||
38 | $ttl ? time() + $ttl : $ttl, |
||
39 | $this->keyProvider, |
||
40 | $this->saltGenerator |
||
41 | ); |
||
42 | } |
||
43 | |||
70 |