<?php

declare(strict_types=1);

namespace PhpWA\Crypto;

use InvalidArgumentException;

final class KeyPair
{
      private $privateKey;
      private $publicKey;

    public function __construct(string $privateKey, string $publicKey)
    {
        if (strlen($privateKey) !== 32 || strlen($publicKey) !== 32) {
            throw new InvalidArgumentException('Curve25519 keys must contain exactly 32 bytes.');
        }
        $this->privateKey = $privateKey;
        $this->publicKey = $publicKey;
    }

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

     
    public function toPublicDebugArray(): array
    {
        return ['public_key_sha256' => hash('sha256', $this->publicKey)];
    }
}
