Documentation
¶
Overview ¶
Package nonce handles the logic of a nonce.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenerateOption ¶ added in v0.2.0
type GenerateOption func(*GenerateOptions)
GenerateOption is the interface for the options of Generate method.
func WithExpiration ¶ added in v0.2.0
func WithExpiration(expiration time.Duration) GenerateOption
WithExpiration sets the expiration time of a nonce.
func WithRef ¶ added in v0.2.0
func WithRef(ref string) GenerateOption
WithRef sets a reference to a nonce.
type GenerateOptions ¶ added in v0.2.0
type GenerateOptions struct {
// contains filtered or unexported fields
}
GenerateOptions contains the options for the Generate method.
type Repository ¶
type Repository interface { Generate(ctx context.Context, opts ...GenerateOption) (string, error) IsValid(ctx context.Context, nonce string) (bool, error) ClearByRef(ctx context.Context, ref string) error }
Repository defines the nonce methods.
func NewRepository ¶
func NewRepository(db *sql.DB) Repository
NewRepository wraps around a SQL database to execute the nonce methods.
Click to show internal directories.
Click to hide internal directories.