Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
28 | public function sign(string $message): string |
||
29 | { |
||
30 | if (function_exists('sodium_crypto_sign_detached')) { |
||
31 | try { |
||
32 | return sodium_crypto_sign_detached($message, $this->privateKey); |
||
33 | } catch (SodiumException $e) { |
||
34 | throw new SigningException("Cannot sign using Sodium extension", 0, $e); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | throw new RuntimeException('The sodium_crypto_sign_detached function is not available'); |
||
39 | } |
||
56 |