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