<?php

namespace Buckhill\U2F;

use Buckhill\U2F\Authenticate\Authentication;
use Buckhill\U2F\Enroll\Enrollment;

class U2F
{
    protected $enroll;
    protected $authenticate;

    /**
     * @return Enrollment
     */
    public function enroll()
    {
        if(!$this->enroll instanceof Enrollment)
        {
            $this->enroll = new Enrollment();
        }

        return $this->enroll;
    }


    /**
     * @return Authentication
     */
    public function authenticate()
    {
        if(!$this->authenticate instanceof Authentication)
        {
            $this->authenticate = new Authentication();
        }

        return $this->authenticate;
    }


    /**
     * @param array $input
     *
     * @return U2FKey
     */
    public function key(array $input)
    {
        return U2FKey::fromArray($input);
    }
}