<?php

namespace Buckhill\U2F\Authenticate;

use Buckhill\U2F\U2FKey;

class Authentication
{

    /**
     * @param U2FKey $key
     *
     * @return U2FKey
     */
    public function challenge(U2FKey $key)
    {
        $challenge_request = new Request();

        return $challenge_request->challenge($key);
    }


    /**
     * @param array  $input
     * @param U2FKey $key
     *
     * @return U2FKey
     */
    public function response(array $input, U2FKey $key)
    {
        $response = Response::fromArray($input);

        return $key->verifyAgainst($response);
    }
}