export type GetApiCurrentIdentityMfaQrCodeOptions = {baseUrl?: string | undefined, ztSession?: string | undefined, fetch?: typeof fetch | undefined}; /** * Show a QR code for unverified MFA enrollments * * GET /current-identity/mfa/qr-code * * Also accepts auth: oauth2 */ export const getApiCurrentIdentityMfaQrCode = async (options?: GetApiCurrentIdentityMfaQrCodeOptions) => { const {baseUrl = "https://demo.ziti.dev/edge/client/v1", fetch: fetchFn = fetch, ztSession} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ztSession !== undefined) headers.set("zt-session", ztSession) const url = `${baseUrl.replace(/\/+$/, '')}/current-identity/mfa/qr-code${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };