Table of Contents

Interface IEmailTotpService

Namespace
GastroSky.Services.Totp.EmailTotpService
Assembly
GastroSky.dll

TOTP service for ensuring people don't accidentally input the wrong email address when buying from our store.

public interface IEmailTotpService

Methods

GenerateAndSendTotp(string, Language)

Generates a TFA token for a given email address and sends it to it. It will be valid for 20 minutes.

Task<bool> GenerateAndSendTotp(string email, Language language)

Parameters

email string

The email address for which to generate the TOTP.

language Language

The Language to use in the email that is sent out.

Returns

Task<bool>

Whether generation + sending succeeded.

GenerateTotp(string)

Generates a TFA token for a given email address without sending it or anything. Raw and dirty. Valid for 20 minutes.

Task<string> GenerateTotp(string email)

Parameters

email string

The email address for which to generate the TOTP.

Returns

Task<string>

The TOTP token (or string.Empty if generation failed somehow).

ValidateTotp(string, string)

Validates a TOTP for a given email address that was generated using GenerateAndSendTotp(string, Language).

Task<bool> ValidateTotp(string email, string totp)

Parameters

email string

The email address for which the TOTP was generated.

totp string

The token to validate.

Returns

Task<bool>