Interface TOTP

  • All Implemented Interfaces:

    
    public interface TOTP
    
                        

    The TOTP interface provides methods for creating and authenticating TOTP codes; retrieving recovery codes; and consuming a recovery code

    • Constructor Detail

    • 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 TOTP
        callback - 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 TOTP
        callback - 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
      • 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 instance
        callback - 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