<?php

declare(strict_types=1);

namespace PhpWA\Transport\Noise;

use InvalidArgumentException;

final class ServerHello
{
    /** @var string */ private $ephemeral;
    /** @var string */ private $staticCiphertext;
    /** @var string */ private $payloadCiphertext;

    public function __construct(string $ephemeral, string $staticCiphertext, string $payloadCiphertext)
    {
        if (strlen($ephemeral) !== 32 || strlen($staticCiphertext) < 16 || strlen($payloadCiphertext) < 16) {
            throw new InvalidArgumentException('Malformed Noise server hello.');
        }
        $this->ephemeral = $ephemeral;
        $this->staticCiphertext = $staticCiphertext;
        $this->payloadCiphertext = $payloadCiphertext;
    }

    public function ephemeral(): string { return $this->ephemeral; }
    public function staticCiphertext(): string { return $this->staticCiphertext; }
    public function payloadCiphertext(): string { return $this->payloadCiphertext; }
}
