All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.supertokens.sdk.recipes.multifactor.MultiFactorAuthRecipe.kt Maven / Gradle / Ivy

The newest version!
package com.supertokens.sdk.recipes.multifactor

import com.supertokens.sdk.SuperTokensClient
import com.supertokens.sdk.recipes.Recipe
import com.supertokens.sdk.recipes.RecipeBuilder
import com.supertokens.sdk.recipes.RecipeConfig
import com.supertokens.sdk.recipes.multifactor.usecases.CheckMultiFactorStatusUseCase

class MultiFactorAuthConfig : RecipeConfig

class MultiFactorAuthRecipe(
    private val superTokens: SuperTokensClient,
    private val config: MultiFactorAuthConfig,
) : Recipe {

  private val checkMultiFactorStatusUseCase by lazy {
    CheckMultiFactorStatusUseCase(
        client = superTokens.apiClient,
    )
  }

  suspend fun checkMfaStatus() = checkMultiFactorStatusUseCase.checkStatus()
}

object MultiFactorAuth : RecipeBuilder() {
  override fun install(
      configure: MultiFactorAuthConfig.() -> Unit
  ): (SuperTokensClient) -> MultiFactorAuthRecipe {
    val config = MultiFactorAuthConfig().apply(configure)

    return { MultiFactorAuthRecipe(it, config) }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy