export type PasswordType = string; export type WebAuthnAuthenticationResponse = {id: string, rawId: string, type: 'public-key', authenticatorAttachment?: ('cross-platform' | 'platform') | undefined, clientExtensionResults: {appid?: boolean | undefined, credProps?: ({rk?: boolean | undefined} | {[key: string]: unknown}) | undefined, hmacCreateSecret?: boolean | undefined} | {[key: string]: unknown}, response: {clientDataJSON: string, authenticatorData: string, signature: string, userHandle?: string | undefined} | {[key: string]: unknown}} | {[key: string]: unknown}; export type SudoVerificationSchema = {password?: PasswordType | undefined, mfa_method?: ('totp' | 'webauthn' | 'email_code') | undefined, mfa_code?: string | undefined, email_code_ticket?: string | undefined, email_code?: string | undefined, webauthn_response?: WebAuthnAuthenticationResponse | undefined, webauthn_challenge?: string | undefined}; export type DeleteApiUsersMeMfaWebauthnCredentialsCredentialIdArgs = {credential_id: string, body: SudoVerificationSchema}; export type DeleteApiUsersMeMfaWebauthnCredentialsCredentialIdOptions = {baseUrl?: string | undefined, sessionToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete WebAuthn credential * * DELETE /users/@me/mfa/webauthn/credentials/{credential_id} */ export const deleteApiUsersMeMfaWebauthnCredentialsCredentialId = async (args: DeleteApiUsersMeMfaWebauthnCredentialsCredentialIdArgs, options?: DeleteApiUsersMeMfaWebauthnCredentialsCredentialIdOptions) => { const {baseUrl = "https://web.fluxer.app/api/v1", fetch: fetchFn = fetch, sessionToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (sessionToken !== undefined) headers.set("Authorization", sessionToken) const url = `${baseUrl.replace(/\/+$/, '')}/users/@me/mfa/webauthn/credentials/${encodeURIComponent(String(args.credential_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };