Skip to content

Commit

Permalink
Build for version v7.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
2fas-com committed Mar 13, 2020
1 parent ec91d10 commit d6a689a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
28 changes: 14 additions & 14 deletions src/Sdk.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Sdk
/**
* @var string
*/
const VERSION = '7.1.0';
const VERSION = '7.2.0';

/**
* @var string
Expand Down Expand Up @@ -195,13 +195,13 @@ public function requestAuthViaSms($phoneNumber)
{
$response = $this->call(
'POST',
$this->createEndpoint('v2/auth/sms'),
$this->createEndpoint('v3/auth/sms'),
[
'phone_number' => (string) $phoneNumber
]
);

if ($response->matchesHttpCode(HttpCodes::OK)) {
if ($response->matchesHttpCode(HttpCodes::CREATED)) {
return $this->hydrator->getAuthenticationFromResponse($response);
}

Expand All @@ -228,13 +228,13 @@ public function requestAuthViaCall($phoneNumber)
{
$response = $this->call(
'POST',
$this->createEndpoint('v2/auth/vms'),
$this->createEndpoint('v3/auth/vms'),
[
'phone_number' => (string) $phoneNumber
]
);

if ($response->matchesHttpCode(HttpCodes::OK)) {
if ($response->matchesHttpCode(HttpCodes::CREATED)) {
return $this->hydrator->getAuthenticationFromResponse($response);
}

Expand All @@ -258,13 +258,13 @@ public function requestAuthViaEmail($email)
{
$response = $this->call(
'POST',
$this->createEndpoint('v2/auth/email'),
$this->createEndpoint('v3/auth/email'),
[
'email' => (string) $email
]
);

if ($response->matchesHttpCode(HttpCodes::OK)) {
if ($response->matchesHttpCode(HttpCodes::CREATED)) {
return $this->hydrator->getAuthenticationFromResponse($response);
}

Expand All @@ -288,13 +288,13 @@ public function requestAuthViaTotp($secret)
{
$response = $this->call(
'POST',
$this->createEndpoint('v2/auth/totp'),
$this->createEndpoint('v3/auth/totp'),
[
'totp_secret' => (string) $secret
]
);

if ($response->matchesHttpCode(HttpCodes::OK)) {
if ($response->matchesHttpCode(HttpCodes::CREATED)) {
return $this->hydrator->getAuthenticationFromResponse($response);
}

Expand All @@ -303,7 +303,7 @@ public function requestAuthViaTotp($secret)

/**
* @param string $secret
* @param string $mobileSecret
* @param string $pushId
* @param string $sessionId
* @param string $browserVersion
*
Expand All @@ -314,20 +314,20 @@ public function requestAuthViaTotp($secret)
* @throws ValidationException
* @throws Exception
*/
public function requestAuthViaTotpWithMobileSupport($secret, $mobileSecret, $sessionId, $browserVersion)
public function requestAuthViaTotpWithMobileSupport($secret, $pushId, $sessionId, $browserVersion)
{
$response = $this->call(
'POST',
$this->createEndpoint('v2/auth/totp/mobile'),
$this->createEndpoint('v3/auth/totp/mobile'),
[
'totp_secret' => (string) $secret,
'mobile_secret' => (string) $mobileSecret,
'push_id' => (string) $pushId,
'session_id' => (string) $sessionId,
'browser_version' => (string) $browserVersion,
]
);

if ($response->matchesHttpCode(HttpCodes::OK)) {
if ($response->matchesHttpCode(HttpCodes::CREATED)) {
return $this->hydrator->getAuthenticationFromResponse($response);
}

Expand Down
16 changes: 8 additions & 8 deletions tests/Sdk/TwoFASTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testAuthRequestViaSms()
['phone_number' => $phoneNumber]
);

$this->nextApiCallWillReturn($response, HttpCodes::OK);
$this->nextApiCallWillReturn($response, HttpCodes::CREATED);
}

$authentication = $this->sdk->requestAuthViaSms($phoneNumber);
Expand All @@ -46,7 +46,7 @@ public function testAuthRequestViaCall()
['phone_number' => $phoneNumber]
);

$this->nextApiCallWillReturn($response, HttpCodes::OK);
$this->nextApiCallWillReturn($response, HttpCodes::CREATED);
}

$authentication = $this->sdk->requestAuthViaCall($phoneNumber);
Expand All @@ -61,7 +61,7 @@ public function testAuthRequestViaEmail()
if ($this->isDevelopmentEnvironment()) {
$response = $this->getNewAuthenticationResponse();

$this->nextApiCallWillReturn($response, HttpCodes::OK);
$this->nextApiCallWillReturn($response, HttpCodes::CREATED);
}

$authentication = $this->sdk->requestAuthViaEmail('[email protected]');
Expand All @@ -76,7 +76,7 @@ public function testAuthRequestViaTotp()
if ($this->isDevelopmentEnvironment()) {
$response = $this->getNewAuthenticationResponse();

$this->nextApiCallWillReturn($response, HttpCodes::OK);
$this->nextApiCallWillReturn($response, HttpCodes::CREATED);
}

$authentication = $this->sdk->requestAuthViaTotp('PEHMPSDNLXIOG65U');
Expand All @@ -90,18 +90,18 @@ public function testAuthRequestViaTotpWithMobileSupport()
{
$this->setUpTwoFAS(getenv('second_oauth_token'), $this->mockedMethods);

$totpSecret = 'PEHMPSDNLXIOG65U';
$mobileSecret = '9e3d5538259e283b2e6f3ecb29a0d269';
$totpSecret = 'PEHMPSDNLXIOG65U';
$pushId = '9e3d5538259e283b2e6f3ecb29a0d269';

if ($this->isDevelopmentEnvironment()) {
$response = $this->getNewAuthenticationResponse();

$this->nextApiCallWillReturn($response, HttpCodes::OK);
$this->nextApiCallWillReturn($response, HttpCodes::CREATED);
}

$authentication = $this->sdk->requestAuthViaTotpWithMobileSupport(
$totpSecret,
$mobileSecret,
$pushId,
uniqid('remaining_characters'),
'Chrome 56, macOS Sierra'
);
Expand Down

0 comments on commit d6a689a

Please sign in to comment.