import { Get } from "./Client"; import { ExtendedConfigurationPath, ConfigurationPath } from "./Api"; import { toEnum, Method2FA } from "./UserPreferences"; import { Configuration, ExtendedConfiguration } from "../models/Configuration"; export async function getConfiguration(): Promise { return Get(ConfigurationPath); } interface ExtendedConfigurationPayload { available_methods: Method2FA[]; one_factor_default_policy: boolean; } export async function getExtendedConfiguration(): Promise { const config = await Get(ExtendedConfigurationPath); return { ...config, available_methods: new Set(config.available_methods.map(toEnum)) }; }