nonce

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL