<?php

namespace App\Services;

use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Client\Response;


class Google2FaServices
{
    protected $google2fa;
    public function __construct()
    {
       $this->google2fa = (new \PragmaRX\Google2FAQRCode\Google2FA());
    }

    public function generateQRImage($email, $name='AryanIct.com') {

        $data = [];
        $data["google2fa_secret"] = $this->google2fa->generateSecretKey();

        $QR_Image = $this->google2fa->getQRCodeInline(
            $name,
            $email,
            $data["google2fa_secret"]
        );

        return ['QR_Image'=>$QR_Image, 'google2fa_secret'=>$data["google2fa_secret"]];
    }

    public function verifyKey($generatedKey, $key){
        return $this->google2fa->verifyKey($generatedKey , $key);
    }
}