<?php

declare(strict_types=1);

namespace PhpWA\Transport\Noise;

use PhpWA\Crypto\KeyPair;
use PhpWA\Runtime\Deadline;

interface NoiseTransportInterface
{
    /** @param callable(string,string):bool $verifyCertificate */
    public function open(
        KeyPair $staticNoiseKey,
        ?string $routingInfo,
        string $clientPayload,
        callable $verifyCertificate,
        Deadline $deadline
    ): void;

    public function sendPayload(string $payload, Deadline $deadline): void;
    public function receivePayload(Deadline $deadline): string;
    public function close(): void;
    public function isOpen(): bool;
}
