summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2021-09-16 12:42:38 +0530
committerGitHub <noreply@github.com>2021-09-16 09:12:38 +0200
commit9270cad67cffefa4c7ced8361580834d92a00732 (patch)
treec46cf2b4357805af1d98347e2e523cb5560cd8f3 /ext/crypto/00_crypto.js
parent3c97dbf06bc26fc79f0f58a360ef821f75ba82e9 (diff)
fix(ext/crypto): don't use core.decode for encoding jwk keys (#12088)
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js7
1 files changed, 5 insertions, 2 deletions
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, "");
}