Documentation ¶
Index ¶
- func NewTOTPOptionsFromSchema(config schema.TOTP) *model.TOTPOptions
- type Context
- type Provider
- type SimpleContext
- type TimeBased
- func (p TimeBased) Generate(ctx Context, username string) (config *model.TOTPConfiguration, err error)
- func (p TimeBased) GenerateCustom(ctx Context, username, algorithm, secret string, digits uint32, ...) (config *model.TOTPConfiguration, err error)
- func (p TimeBased) Options() model.TOTPOptions
- func (p TimeBased) Validate(ctx Context, token string, config *model.TOTPConfiguration) (valid bool, step uint64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTOTPOptionsFromSchema ¶ added in v4.38.0
func NewTOTPOptionsFromSchema(config schema.TOTP) *model.TOTPOptions
Types ¶
type Provider ¶
type Provider interface { Generate(ctx Context, username string) (config *model.TOTPConfiguration, err error) GenerateCustom(ctx Context, username string, algorithm, secret string, digits uint32, period, secretSize uint) (config *model.TOTPConfiguration, err error) Validate(ctx Context, token string, config *model.TOTPConfiguration) (valid bool, step uint64, err error) Options() model.TOTPOptions }
Provider for TOTP functionality.
type SimpleContext ¶ added in v4.38.0
func (*SimpleContext) GetClock ¶ added in v4.38.0
func (c *SimpleContext) GetClock() clock.Provider
func (*SimpleContext) GetRandom ¶ added in v4.38.0
func (c *SimpleContext) GetRandom() random.Provider
type TimeBased ¶
type TimeBased struct {
// contains filtered or unexported fields
}
TimeBased totp.Provider for production use.
func NewTimeBasedProvider ¶
NewTimeBasedProvider creates a new totp.TimeBased which implements the totp.Provider.
func (TimeBased) Generate ¶
func (p TimeBased) Generate(ctx Context, username string) (config *model.TOTPConfiguration, err error)
Generate generates a TOTP with default options.
func (TimeBased) GenerateCustom ¶
func (p TimeBased) GenerateCustom(ctx Context, username, algorithm, secret string, digits uint32, period, secretSize uint) (config *model.TOTPConfiguration, err error)
GenerateCustom generates a TOTP with custom options.
func (TimeBased) Options ¶ added in v4.38.0
func (p TimeBased) Options() model.TOTPOptions
Options returns the configured options for this provider.
Click to show internal directories.
Click to hide internal directories.