<?php

declare(strict_types=1);

namespace PhpWA\Crypto;

use InvalidArgumentException;

class PreKey
{
    /** @var int */ private $id;
    /** @var KeyPair */ private $keyPair;

    public function __construct(int $id, KeyPair $keyPair)
    {
        if ($id < 0 || $id > 16777215) {
            throw new InvalidArgumentException('Signal pre-key ID must fit 24 bits.');
        }
        $this->id = $id;
        $this->keyPair = $keyPair;
    }

    public function id(): int { return $this->id; }
    public function keyPair(): KeyPair { return $this->keyPair; }
}
