qrcodes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package qrcodes provides QR code generation for TOTP two-factor authentication setup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBuilder

func RegisterBuilder(i do.Injector)

RegisterBuilder registers a Builder with the injector.

Types

type Builder

type Builder interface {
	BuildQRCode(ctx context.Context, username, twoFactorSecret string) (string, error)
}

Builder generates QR codes for TOTP two-factor authentication.

type Issuer

type Issuer string

Issuer identifies the service that issued the TOTP secret.

type Option

type Option func(*options)

Option configures the Builder this package constructs. The zero configuration works: an absent logger logs nowhere and an absent tracer provider traces nowhere.

func WithLogger

func WithLogger(logger logging.Logger) Option

WithLogger attaches a logger.

func WithTracerProvider

func WithTracerProvider(tracerProvider tracing.Provider) Option

WithTracerProvider attaches a tracer provider, enabling spans on every operation.

type StandardBuilder

type StandardBuilder struct {
	// contains filtered or unexported fields
}

StandardBuilder is the one Builder implementation. It is exported, and returned by NewBuilder, so a caller can depend on the builder it built rather than on the Builder seam.

func NewBuilder

func NewBuilder(issuer Issuer, opts ...Option) *StandardBuilder

NewBuilder returns a new QR code Builder.

func (*StandardBuilder) BuildQRCode

func (s *StandardBuilder) BuildQRCode(ctx context.Context, username, twoFactorSecret string) (string, error)

BuildQRCode builds a QR code for a given username and secret.

Directories

Path Synopsis
Package noop is the qrcodes.Builder that draws nothing.
Package noop is the qrcodes.Builder that draws nothing.

Jump to

Keyboard shortcuts

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