This repository has been archived by the owner on Feb 17, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from DarkGhostHunter/master
Added issuer config key plus other minor fixes.
- Loading branch information
Showing
6 changed files
with
39 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Help me support this package | ||
|
||
ko_fi: DarkGhostHunter | ||
custom: ['https://paypal.me/darkghosthunter'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,8 @@ | |
| | ||
*/ | ||
|
||
'issuer' => env('APP_NAME', 'Laravel'), | ||
|
||
'totp' => [ | ||
'digits' => 6, | ||
'seconds' => 30, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,11 @@ | |
namespace Tests\Eloquent; | ||
|
||
use Carbon\Carbon; | ||
use Tests\RunsPublishableMigrations; | ||
use Tests\RegistersPackage; | ||
use Orchestra\Testbench\TestCase; | ||
use ParagonIE\ConstantTime\Base32; | ||
use Tests\Stubs\UserTwoFactorStub; | ||
use Tests\RunsPublishableMigrations; | ||
use Illuminate\Support\Facades\Cache; | ||
use Illuminate\Database\Eloquent\Relations\MorphTo; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
|
@@ -269,7 +269,7 @@ public function test_serializes_to_grouped_string() | |
|
||
public function test_serializes_to_uri() | ||
{ | ||
config(['app.name' => 'quz']); | ||
config(['laraguard.issuer' => 'quz']); | ||
|
||
$tfa = factory(TwoFactorAuthentication::class)->states('with recovery', 'with safe devices')->make([ | ||
'label' => '[email protected]', | ||
|
@@ -285,7 +285,7 @@ public function test_serializes_to_uri() | |
|
||
public function test_serializes_to_qr_and_renders_to_qr() | ||
{ | ||
config(['app.name' => 'quz']); | ||
config(['laraguard.issuer' => 'quz']); | ||
|
||
$tfa = factory(TwoFactorAuthentication::class)->states('with recovery', 'with safe devices')->make([ | ||
'label' => '[email protected]', | ||
|
@@ -300,7 +300,7 @@ public function test_serializes_to_qr_and_renders_to_qr() | |
|
||
public function test_serializes_uri_to_json() | ||
{ | ||
config(['app.name' => 'quz']); | ||
config(['laraguard.issuer' => 'quz']); | ||
|
||
$tfa = factory(TwoFactorAuthentication::class)->states('with recovery', 'with safe devices')->make([ | ||
'label' => '[email protected]', | ||
|
@@ -315,4 +315,22 @@ public function test_serializes_uri_to_json() | |
$this->assertEquals($uri, $tfa->toJson()); | ||
$this->assertEquals($uri, json_encode($tfa)); | ||
} | ||
|
||
public function test_changes_issuer() | ||
{ | ||
config(['laraguard.issuer' => 'foo bar']); | ||
|
||
$tfa = factory(TwoFactorAuthentication::class)->states('with recovery', 'with safe devices')->make([ | ||
'label' => '[email protected]', | ||
'shared_secret' => 'KS72XBTN5PEBGX2IWBMVW44LXHPAQ7L3', | ||
'algorithm' => 'sHa256', | ||
'digits' => 14, | ||
]); | ||
|
||
$uri = '"otpauth:\/\/totp\/foo%20bar%[email protected]?issuer=foo%20bar&label=test%40foo.com&secret=KS72XBTN5PEBGX2IWBMVW44LXHPAQ7L3&algorithm=SHA256&digits=14"'; | ||
|
||
$this->assertJson($tfa->toJson()); | ||
$this->assertEquals($uri, $tfa->toJson()); | ||
$this->assertEquals($uri, json_encode($tfa)); | ||
} | ||
} |
5110363
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change env variable in config for issuer with something else, that developers can easier add variable to own .env and change value.
You already set the default value with app name in toUri function.
I suggest OTP_TOTP_ISSUER
Good job btw :)
5110363
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After consideration, I will add it since it may become very handful when testing on different environments. Ill add it on 1.3.1