adapter = $adapter ?: MathAdapterFactory::getAdapter(); $this->formatter = new Formatter(); $this->parser = new Parser($this->adapter, $pointSerializer ?: new UncompressedPointSerializer()); } /** * * @param PublicKeyInterface $key * @return string */ public function serialize(PublicKeyInterface $key): string { return $this->formatter->format($key); } /** * @param PublicKeyInterface $key * @return string */ public function getUncompressedKey(PublicKeyInterface $key): string { return $this->formatter->encodePoint($key->getPoint()); } /** * {@inheritDoc} * @see \Mdanter\Ecc\Serializer\PublicKey\PublicKeySerializerInterface::parse() */ public function parse(string $string): PublicKeyInterface { return $this->parser->parse($string); } }