This repository has been archived by the owner on Jul 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure payload is always base64url encoded
- Loading branch information
Niklas Grießer
committed
Apr 27, 2021
1 parent
dec802c
commit 6cd69b6
Showing
3 changed files
with
19 additions
and
2 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,17 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace BauerKirch\CoronaWarnAppEventRegistration; | ||
|
||
class Base64UrlUtil | ||
{ | ||
public static function encode(string $input): string | ||
{ | ||
return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($input)); | ||
} | ||
|
||
public static function decode(string $input): string | ||
{ | ||
return base64_decode(str_replace(['-', '_'], ['+', '/'], $input)); | ||
} | ||
} |
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