furi-kuri/two-factor-auth-sdk

TwoFactorAuth

dev-master 2019-06-30 13:50 UTC

This package is not auto-updated.

Last update: 2019-07-01 12:37:01 UTC


README

The preferred way to install this extension is through composer.

Either run

composer require furi-kuri/two-factor-auth-sdk

Or add

"furi-kuri/two-factor-auth-sdk": "*"

to the require section of your composer.json file.

Usage

<?php

require_once __DIR__ . '/../vendor/autoload.php';

$project = 123456;
$hmacKey = 'test';

try {
    $config = new \TwoFactorAuth\Config($project, $hmacKey);
    $gateway = new \TwoFactorAuth\Gateway($config);
    $requestFactory = new \TwoFactorAuth\Request\RequestFactory;
    
    $request = $requestFactory->createOperation(1, 'confirm you action');
    $response = $gateway->send($request);
    
    $request = $requestFactory->getOperationInfo(1);
    $response = $gateway->send($request);

    var_dump($response);
} catch (\TwoFactorAuth\Exception\TwoFactorAuthExceptionInterface $e) {
    var_dump($e->getMessage());
}