| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Jose\Component\Core\Util\Ecc; |
| 6 | |
| 7 | use Brick\Math\BigInteger; |
| 8 | |
| 9 | /** |
| 10 | * Copyright (C) 2012 Matyas Danter. |
| 11 | * |
| 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
| 13 | * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the |
| 14 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
| 15 | * permit persons to whom the Software is furnished to do so, subject to the following conditions: |
| 16 | * |
| 17 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
| 18 | * Software. |
| 19 | * |
| 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 21 | * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 22 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | * @internal |
| 28 | */ |
| 29 | final class PrivateKey |
| 30 | { |
| 31 | private function __construct( |
| 32 | private readonly BigInteger $secret |
| 33 | ) { |
| 34 | } |
| 35 | |
| 36 | public static function create(BigInteger $secret): self |
| 37 | { |
| 38 | return new self($secret); |
| 39 | } |
| 40 | |
| 41 | public function getSecret(): BigInteger |
| 42 | { |
| 43 | return $this->secret; |
| 44 | } |
| 45 | } |