diff --git a/assets/modules/analytics.js b/assets/modules/analytics.js index cf4db1c..0fa2079 100644 --- a/assets/modules/analytics.js +++ b/assets/modules/analytics.js @@ -5,7 +5,7 @@ const SK_HASH = '_h' let encKey = null async function importKey(b64) { - const raw = Uint8Array.from(atob(b64), c => c.charCodeAt(0)) + const raw = Uint8Array.from(globalThis.atob(b64), c => c.charCodeAt(0)) return globalThis.crypto.subtle.importKey('raw', raw, 'AES-GCM', false, ['encrypt', 'decrypt']) } @@ -18,12 +18,12 @@ async function encrypt(data) { const combined = new Uint8Array(12 + buf.length) combined.set(iv) combined.set(buf, 12) - return btoa(String.fromCharCode(...combined)) + return globalThis.btoa(String.fromCharCode(...combined)) } async function decrypt(b64) { if (!encKey) return null - const raw = Uint8Array.from(atob(b64), c => c.charCodeAt(0)) + const raw = Uint8Array.from(globalThis.atob(b64), c => c.charCodeAt(0)) const iv = raw.slice(0, 12) const data = raw.slice(12) try {