best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
crypto: replace base64 with base64url
wukko73b63e5487ca
diff --git a/src/modules/sub/crypto.js b/src/modules/sub/crypto.jsindex 3f02edc5..6a221e1a 100644--- a/src/modules/sub/crypto.js+++ b/src/modules/sub/crypto.js@@ -4,14 +4,14 @@ const algorithm = "aes256"const keyLength = 32;export function generateHmac(str, salt) {- return createHmac("sha256", salt).update(str).digest("base64");+ return createHmac("sha256", salt).update(str).digest("base64url");}export function encryptStream(str, iv, secret) {const buff = Buffer.from(JSON.stringify(str), "utf-8");- const key = scryptSync(Buffer.from(secret, "base64"), "salt", keyLength);- const cipher = createCipheriv(algorithm, key, Buffer.from(iv, "base64"));+ const key = scryptSync(Buffer.from(secret, "base64url"), "salt", keyLength);+ const cipher = createCipheriv(algorithm, key, Buffer.from(iv, "base64url"));return Buffer.concat([ cipher.update(buff), cipher.final() ])}@@ -19,8 +19,8 @@ export function encryptStream(str, iv, secret) {export function decryptStream(buf, iv, secret) {const buff = Buffer.from(buf, "binary");- const key = scryptSync(Buffer.from(secret, "base64"), "salt", keyLength);- const decipher = createDecipheriv(algorithm, key, Buffer.from(iv, "base64"));+ const key = scryptSync(Buffer.from(secret, "base64url"), "salt", keyLength);+ const decipher = createDecipheriv(algorithm, key, Buffer.from(iv, "base64url"));return Buffer.concat([ decipher.update(buff), decipher.final() ])}