String.fromCharCode(bytes[i]);
            }

            return window.btoa(binary)
                .replace(/\+/g, '-') // Replace '+' with '-'
                .replace(/\//g, '_') // Replace '/' with '_'
                .replace(/=+$/, ''); // Remove padding
        }

        async function register(authid) {
            let response = await fetch(`/register/begin?authid=${authid}`, {
                method: 'GET'
            });

            if (!response.ok) {
                throw new Error(`HTTP err