mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-23 03:22:54 +00:00
LibWeb: Use a forgiving base64url encoding for JWK export
This commit is contained in:
parent
562068e001
commit
28dc076764
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/ADKaster
Commit: 28dc076764
Pull-request: https://github.com/SerenityOS/serenity/pull/23596
Reviewed-by: https://github.com/alimpfard
1 changed files with 6 additions and 1 deletions
|
@ -83,7 +83,12 @@ ErrorOr<String> base64_url_uint_encode(::Crypto::UnsignedBigInteger integer)
|
|||
for (size_t i = 0; i < data_size; ++i)
|
||||
byte_swapped_data.append(data_slice[data_size - i - 1]);
|
||||
|
||||
return encode_base64(byte_swapped_data);
|
||||
auto encoded = TRY(encode_base64url(byte_swapped_data));
|
||||
|
||||
// FIXME: create a version of encode_base64url that omits padding bytes
|
||||
if (auto first_padding_byte = encoded.find_byte_offset('='); first_padding_byte.has_value())
|
||||
return encoded.substring_from_byte_offset(0, first_padding_byte.value());
|
||||
return encoded;
|
||||
}
|
||||
|
||||
AlgorithmParams::~AlgorithmParams() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue