1 | <?php |
||
17 | class WifPrivateKeySerializer |
||
18 | { |
||
19 | /** |
||
20 | * @var PrivateKeySerializerInterface |
||
21 | */ |
||
22 | private $keySerializer; |
||
23 | |||
24 | /** |
||
25 | * @param PrivateKeySerializerInterface $serializer |
||
26 | */ |
||
27 | 151 | public function __construct(PrivateKeySerializerInterface $serializer) |
|
31 | |||
32 | /** |
||
33 | * @param NetworkInterface $network |
||
34 | * @param PrivateKeyInterface $privateKey |
||
35 | * @return string |
||
36 | * @throws \Exception |
||
37 | */ |
||
38 | 11 | public function serialize(NetworkInterface $network, PrivateKeyInterface $privateKey): string |
|
49 | |||
50 | /** |
||
51 | * @param string $wif |
||
52 | * @param NetworkInterface|null $network |
||
53 | * @return PrivateKeyInterface |
||
54 | * @throws Base58ChecksumFailure |
||
55 | * @throws InvalidPrivateKey |
||
56 | * @throws \Exception |
||
57 | */ |
||
58 | 10 | public function parse(string $wif, NetworkInterface $network = null): PrivateKeyInterface |
|
80 | } |
||
81 |