From 9270cad67cffefa4c7ced8361580834d92a00732 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 16 Sep 2021 12:42:38 +0530 Subject: fix(ext/crypto): don't use core.decode for encoding jwk keys (#12088) --- ext/crypto/00_crypto.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 5eb283b22..50ee9a7db 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -24,6 +24,7 @@ StringPrototypeToUpperCase, StringPrototypeReplace, StringPrototypeCharCodeAt, + StringFromCharCode, Symbol, SymbolFor, SymbolToStringTag, @@ -140,9 +141,11 @@ } function unpaddedBase64(bytes) { - const binaryString = core.decode(bytes); + let binaryString = ""; + for (let i = 0; i < bytes.length; i++) { + binaryString += StringFromCharCode(bytes[i]); + } const base64String = btoa(binaryString); - return StringPrototypeReplace(base64String, /=/g, ""); } -- cgit v1.2.3