Skip to content

Commit 5dbe1c8

Browse files
author
Matej Labas
committed
Rename length to byteLength
1 parent a34c276 commit 5dbe1c8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/OAuth2/AbstractProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class AbstractProvider extends AbstractBaseProvider
2727

2828
protected bool $pkce = false;
2929

30-
protected int $pkceCodeVerifierLength = 96;
30+
protected int $pkceCodeVerifierByteLength = 96;
3131

3232
/**
3333
* @return string
@@ -52,7 +52,7 @@ public function getAuthUrlParameters(): array
5252
$parameters['response_type'] = 'code';
5353

5454
if ($this->pkce) {
55-
$codeVerifier = $this->generatePKCECodeVerifier($this->pkceCodeVerifierLength);
55+
$codeVerifier = $this->generatePKCECodeVerifier($this->pkceCodeVerifierByteLength);
5656
$this->session->set('code_verifier', $codeVerifier);
5757

5858
$parameters['code_challenge'] = $this->generatePKCECodeChallenge($codeVerifier);
@@ -62,15 +62,15 @@ public function getAuthUrlParameters(): array
6262
return $parameters;
6363
}
6464

65-
private function generatePKCECodeVerifier(int $length = 96): string
65+
private function generatePKCECodeVerifier(int $byteLength = 96): string
6666
{
67-
if ($length < 32 || $length > 96) {
67+
if ($byteLength < 32 || $byteLength > 96) {
6868
throw new \Exception(
6969
"Final length must be between 43 and 128, so the number of random bytes must be between 32 and 96"
7070
);
7171
}
7272

73-
$randomBytes = random_bytes($length);
73+
$randomBytes = random_bytes($byteLength);
7474
return rtrim(strtr(base64_encode($randomBytes), '+/', '-_'), '=');
7575
}
7676

0 commit comments

Comments
 (0)