You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
For the implementation of WebAuthn in a web app, I need to send a key id in the uri. So I use base64 encoding for that. But following the rfc the encoding uses + and / characters which are not really safe for an uri. Section 5 of rfc describe an url version of encoding using - and _ characters. Is it possible to implement it inside psl?
Describe the solution you'd like
It will be nice to have functions like this:
function encodeUrl(string$binary): string;
function decodeUrl(string$base64): string;
Describe alternatives you've considered
Currently, as a workaround I'm doing that:
strtr(encode($key_id), '+/', '-_');
The text was updated successfully, but these errors were encountered:
I'm okay with adding two new functions to Psl\Encoding\Base64, or a new Psl\Encoding\Base64\Url sub-component.
a PR would be welcome.
usePsl;
usePsl\Encoding\Base64;
$data = '...';
$encoded = Base64\url_encode($data);
$decoded = Base64\url_decode($encoded);
Psl\invariant($data === $decoded, 'expected $decoded to be the same as $data');
or
usePsl;
usePsl\Encoding\Base64\Url;
$data = '...';
$encoded = Url\encode($data);
$decoded = Url\decode($encoded);
Psl\invariant($data === $decoded, 'expected $decoded to be the same as $data');
Gashmob
added a commit
to Gashmob/psl
that referenced
this issue
Jun 5, 2023
issue azjezz#407
This commit introduces functions url_encode and url_decode in
Psl\Encoding\Base64 namespace. Following rfc4648 it uses base64url
alphabet to make base64 encoding url safe.
Is your feature request related to a problem? Please describe.
For the implementation of WebAuthn in a web app, I need to send a key id in the uri. So I use base64 encoding for that. But following the rfc the encoding uses + and / characters which are not really safe for an uri. Section 5 of rfc describe an url version of encoding using - and _ characters. Is it possible to implement it inside psl?
Describe the solution you'd like
It will be nice to have functions like this:
Describe alternatives you've considered
Currently, as a workaround I'm doing that:
The text was updated successfully, but these errors were encountered: