Interface TOTP
-
- All Implemented Interfaces:
public interface TOTPThe TOTP interface provides methods for creating and authenticating TOTP codes; retrieving recovery codes; and consuming a recovery code
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classTOTP.CreateParametersA data class wrapping the parameters used in a TOTP create request
public final classTOTP.AuthenticateParametersA data class wrapping the parameters use in a TOTP authenticate request
public final classTOTP.RecoverParametersA data class wrapping the parameters use in a TOTP recover request
-
Method Summary
Modifier and Type Method Description abstract StytchResult<TOTPCreateResponseData>create(TOTP.CreateParameters parameters)Call this method to create a new TOTP instance for a user. abstract Unitcreate(TOTP.CreateParameters parameters, Function1<StytchResult<TOTPCreateResponseData>, Unit> callback)Call this method to create a new TOTP instance for a user. abstract CompletableFuture<StytchResult<TOTPCreateResponseData>>createCompletable(TOTP.CreateParameters parameters)Call this method to create a new TOTP instance for a user. abstract StytchResult<TOTPAuthenticateResponseData>authenticate(TOTP.AuthenticateParameters parameters)Call this method to authenticate a TOTP code entered by a user. abstract Unitauthenticate(TOTP.AuthenticateParameters parameters, Function1<StytchResult<TOTPAuthenticateResponseData>, Unit> callback)Call this method to authenticate a TOTP code entered by a user. abstract CompletableFuture<StytchResult<TOTPAuthenticateResponseData>>authenticateCompletable(TOTP.AuthenticateParameters parameters)Call this method to authenticate a TOTP code entered by a user. abstract StytchResult<TOTPRecoveryCodesResponseData>recoveryCodes()Call this method to retrieve the recovery codes for a TOTP instance tied to a user. abstract UnitrecoveryCodes(Function1<StytchResult<TOTPRecoveryCodesResponseData>, Unit> callback)Call this method to retrieve the recovery codes for a TOTP instance tied to a user. abstract CompletableFuture<StytchResult<TOTPRecoveryCodesResponseData>>recoveryCodesCompletable()Call this method to retrieve the recovery codes for a TOTP instance tied to a user. abstract StytchResult<TOTPRecoverResponseData>recover(TOTP.RecoverParameters parameters)Call this method to authenticate a recovery code for a TOTP instance. abstract Unitrecover(TOTP.RecoverParameters parameters, Function1<StytchResult<TOTPRecoverResponseData>, Unit> callback)Call this method to authenticate a recovery code for a TOTP instance. abstract CompletableFuture<StytchResult<TOTPRecoverResponseData>>recoverCompletable(TOTP.RecoverParameters parameters)Call this method to authenticate a recovery code for a TOTP instance. -
-
Method Detail
-
create
abstract StytchResult<TOTPCreateResponseData> create(TOTP.CreateParameters parameters)
Call this method to create a new TOTP instance for a user. The user can use the authenticator application of their choice to scan the QR code or enter the secret.
- Parameters:
parameters- the parameters required to create a TOTP- Returns:
TOTPCreateResponse
-
create
abstract Unit create(TOTP.CreateParameters parameters, Function1<StytchResult<TOTPCreateResponseData>, Unit> callback)
Call this method to create a new TOTP instance for a user. The user can use the authenticator application of their choice to scan the QR code or enter the secret.
- Parameters:
parameters- the parameters required to create a TOTPcallback- a callback that receives a TOTPCreateResponse
-
createCompletable
abstract CompletableFuture<StytchResult<TOTPCreateResponseData>> createCompletable(TOTP.CreateParameters parameters)
Call this method to create a new TOTP instance for a user. The user can use the authenticator application of their choice to scan the QR code or enter the secret.
- Parameters:
parameters- the parameters required to create a TOTP- Returns:
TOTPCreateResponse
-
authenticate
abstract StytchResult<TOTPAuthenticateResponseData> authenticate(TOTP.AuthenticateParameters parameters)
Call this method to authenticate a TOTP code entered by a user. If this method succeeds, the user will be logged in and granted an active session
- Parameters:
parameters- the parameters required to authenticate a TOTP- Returns:
TOTPAuthenticateResponse
-
authenticate
abstract Unit authenticate(TOTP.AuthenticateParameters parameters, Function1<StytchResult<TOTPAuthenticateResponseData>, Unit> callback)
Call this method to authenticate a TOTP code entered by a user. If this method succeeds, the user will be logged in and granted an active session
- Parameters:
parameters- the parameters required to authenticate a TOTPcallback- a callback that receives a TOTPAuthenticateResponse
-
authenticateCompletable
abstract CompletableFuture<StytchResult<TOTPAuthenticateResponseData>> authenticateCompletable(TOTP.AuthenticateParameters parameters)
Call this method to authenticate a TOTP code entered by a user. If this method succeeds, the user will be logged in and granted an active session
- Parameters:
parameters- the parameters required to authenticate a TOTP- Returns:
TOTPAuthenticateResponse
-
recoveryCodes
abstract StytchResult<TOTPRecoveryCodesResponseData> recoveryCodes()
Call this method to retrieve the recovery codes for a TOTP instance tied to a user.
- Returns:
TOTPRecoveryCodesResponse
-
recoveryCodes
abstract Unit recoveryCodes(Function1<StytchResult<TOTPRecoveryCodesResponseData>, Unit> callback)
Call this method to retrieve the recovery codes for a TOTP instance tied to a user.
- Parameters:
callback- a callback that receives a TOTPRecoveryCodesResponse
-
recoveryCodesCompletable
abstract CompletableFuture<StytchResult<TOTPRecoveryCodesResponseData>> recoveryCodesCompletable()
Call this method to retrieve the recovery codes for a TOTP instance tied to a user.
- Returns:
TOTPRecoveryCodesResponse
-
recover
abstract StytchResult<TOTPRecoverResponseData> recover(TOTP.RecoverParameters parameters)
Call this method to authenticate a recovery code for a TOTP instance. If this method succeeds, the user will be logged in and granted an active session
- Parameters:
parameters- the parameters required to authenticate a recovery code for a TOTP instance- Returns:
TOTPRecoverResponse
-
recover
abstract Unit recover(TOTP.RecoverParameters parameters, Function1<StytchResult<TOTPRecoverResponseData>, Unit> callback)
Call this method to authenticate a recovery code for a TOTP instance. If this method succeeds, the user will be logged in and granted an active session
- Parameters:
parameters- the parameters required to authenticate a recovery code for a TOTP instancecallback- a callback that receives a TOTPRecoverResponse
-
recoverCompletable
abstract CompletableFuture<StytchResult<TOTPRecoverResponseData>> recoverCompletable(TOTP.RecoverParameters parameters)
Call this method to authenticate a recovery code for a TOTP instance. If this method succeeds, the user will be logged in and granted an active session
- Parameters:
parameters- the parameters required to authenticate a recovery code for a TOTP instance- Returns:
TOTPRecoverResponse
-
-
-
-