Base64 backward compatibility and performance #400
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #397
After replacing the spooky-labs/base64url library with another one, you lost backward compatibility since the new library can't decode standard base64 (non-URL safe). Also, the new library is much slower since it uses a pure PHP implementation of the base64 decoding algorithm.
This PR contains tests only, which are now falling on the master branch.
I would to borrow code here (from the old library) https://github.com/Spomky-Labs/base64url/blob/v2.x/src/Base64Url.php
and place it directly in the package, and refactor the code, of course.
The ideal solution would be to extract Base64 encoder as a dependency while adding the possibility of passing a custom encoder as a parameter.
Pseudo-code:
However, it will require deep refractory; for example, the Encryption class must not be static anymore.