Skip to content

Commit 26aebeb

Browse files
committed
rename conversion function
1 parent 388c2b6 commit 26aebeb

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/JWK.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public static function parseKey(array $jwk, string $defaultAlg = null): ?Key
174174
throw new UnexpectedValueException('x not set');
175175
}
176176

177-
$publicKey = JWT::urlsafeToStandardB64($jwk['x']);
177+
$publicKey = JWT::convertBase64urlToBase64($jwk['x']);
178178
$alg = self::OKP_CURVES[$jwk['crv']];
179179
return new Key($publicKey, $alg);
180180
default:

src/JWT.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,18 +400,20 @@ public static function jsonEncode(array $input): string
400400
*/
401401
public static function urlsafeB64Decode(string $input): string
402402
{
403-
return \base64_decode(self::urlsafeToStandardB64($input));
403+
return \base64_decode(self::convertBase64urlToBase64($input));
404404
}
405405

406406
/**
407-
* Convert a string from URL-safe Base64 to standard Base64.
407+
* Convert a string in the base64url (URL-safe Base64) encoding to standard base64.
408408
*
409409
* @param string $input A Base64 encoded string with URL-safe characters (-_ and no padding)
410410
*
411411
* @return string A Base64 encoded string with standard characters (+/) and padding (=), when
412412
* needed.
413+
*
414+
* @see https://www.rfc-editor.org/rfc/rfc4648
413415
*/
414-
public static function urlsafeToStandardB64(string $input): string
416+
public static function convertBase64urlToBase64(string $input): string
415417
{
416418
$remainder = \strlen($input) % 4;
417419
if ($remainder) {

0 commit comments

Comments
 (0)