<?php

declare(strict_types=1);

namespace PhpWA\Crypto;

use InvalidArgumentException;

final class SignedPreKey extends PreKey
{
    /** @var string */ private $signature;

    public function __construct(int $id, KeyPair $keyPair, string $signature)
    {
        parent::__construct($id, $keyPair);
        if (strlen($signature) !== 64) {
            throw new InvalidArgumentException('Signal signed pre-key signature must contain 64 bytes.');
        }
        $this->signature = $signature;
    }

    public function signature(): string { return $this->signature; }
}
