Skip to content

Commit 9294d74

Browse files
committed
:octocat: omit URI settings by default
1 parent 6995cd1 commit 9294d74

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/AuthenticatorOptionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ trait AuthenticatorOptionsTrait{
9797
*
9898
* @link https://github.com/google/google-authenticator/wiki/Key-Uri-Format#parameters
9999
*/
100-
protected bool $omitUriSettings = false;
100+
protected bool $omitUriSettings = true;
101101

102102
/**
103103
* Sets the code length to either 6 or 8

tests/Authenticators/HOTPTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@ public function HOTP(int $counter, string $hmac, int $code, string $hotp):void{
6464

6565
public static function uriSettingsProvider():array{
6666
return [
67-
'default' => [[], '&counter=42&digits=6&algorithm=SHA1'],
68-
'digits' => [['digits' => 8], '&counter=42&digits=8&algorithm=SHA1'],
69-
'algo' => [['algorithm' => AuthenticatorInterface::ALGO_SHA512], '&counter=42&digits=6&algorithm=SHA512'],
67+
'default' => [['omitUriSettings' => false], '&counter=42&digits=6&algorithm=SHA1'],
68+
'digits' => [['omitUriSettings' => false, 'digits' => 8], '&counter=42&digits=8&algorithm=SHA1'],
69+
'algo' => [
70+
['omitUriSettings' => false, 'algorithm' => AuthenticatorInterface::ALGO_SHA512],
71+
'&counter=42&digits=6&algorithm=SHA512',
72+
],
7073
'omit' => [['omitUriSettings' => true], '&counter=42'],
7174
];
7275
}

tests/Authenticators/TOTPTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ public function adjacent(string $algorithm, int $timestamp, string $timeslice, i
120120

121121
public static function uriSettingsProvider():array{
122122
return [
123-
'default' => [[], '&digits=6&algorithm=SHA1&period=30'],
124-
'digits' => [['digits' => 8], '&digits=8&algorithm=SHA1&period=30'],
125-
'period' => [['period' => 45], '&digits=6&algorithm=SHA1&period=45'],
126-
'algo' => [['algorithm' => AuthenticatorInterface::ALGO_SHA512], '&digits=6&algorithm=SHA512&period=30'],
123+
'default' => [['omitUriSettings' => false], '&digits=6&algorithm=SHA1&period=30'],
124+
'digits' => [['omitUriSettings' => false, 'digits' => 8], '&digits=8&algorithm=SHA1&period=30'],
125+
'period' => [['omitUriSettings' => false, 'period' => 45], '&digits=6&algorithm=SHA1&period=45'],
126+
'algo' => [
127+
['omitUriSettings' => false, 'algorithm' => AuthenticatorInterface::ALGO_SHA512],
128+
'&digits=6&algorithm=SHA512&period=30',
129+
],
127130
'omit' => [['omitUriSettings' => true], ''],
128131
];
129132
}

0 commit comments

Comments
 (0)