remove Buffer

This commit is contained in:
Jorrin 2023-12-27 21:14:18 +01:00
parent c44d13f0bd
commit a208aef364
1 changed files with 3 additions and 4 deletions

View File

@ -2,12 +2,11 @@ const DECRYPTION_KEY = '8z5Ag5wgagfsOuhz';
export const decodeBase64UrlSafe = (str: string) => { export const decodeBase64UrlSafe = (str: string) => {
const standardizedInput = str.replace(/_/g, '/').replace(/-/g, '+'); const standardizedInput = str.replace(/_/g, '/').replace(/-/g, '+');
const decodedData = atob(standardizedInput);
const binaryData = Buffer.from(standardizedInput, 'base64').toString('binary'); const bytes = new Uint8Array(decodedData.length);
const bytes = new Uint8Array(binaryData.length);
for (let i = 0; i < bytes.length; i += 1) { for (let i = 0; i < bytes.length; i += 1) {
bytes[i] = binaryData.charCodeAt(i); bytes[i] = decodedData.charCodeAt(i);
} }
return bytes; return bytes;