forge

package
v0.0.1-0...-e5b290b Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultSessionGenerator defines the default session id generator
	DefaultSessionGenerator = func() string {
		return uniuri.NewLen(64)
	}

	// NoOperationProcessor defines the copy source processor
	NoOperationProcessor = func(payload []byte) ([]byte, error) {
		return payload, nil
	}

	// DefaultEncryptor is the default data encryptor for challenge
	DefaultEncryptor = NoOperationProcessor
)

Functions

This section is empty.

Types

type Option

type Option func(*Options)

Option defines forge option contract option function

func WithDecryptor

func WithDecryptor(decryptor ProcessorFunc) Option

WithDecryptor defines the challenge decryptor

func WithEncryptor

func WithEncryptor(encryptor ProcessorFunc) Option

WithEncryptor defines the challenge encryptor

func WithExpiration

func WithExpiration(expiration time.Duration) Option

WithExpiration defines the expiration interval

func WithRandomSessionID

func WithRandomSessionID() Option

WithRandomSessionID defines the SessionId generation

func WithSessionIDGenerator

func WithSessionIDGenerator(generator SessionIDGeneratorFunc) Option

WithSessionIDGenerator defines the SessionId generation function

type Options

type Options struct {
	Expiration  time.Duration
	IDGenerator SessionIDGeneratorFunc
	Encryptor   ProcessorFunc
	Decryptor   ProcessorFunc
}

Options for challenge forging

type ProcessorFunc

type ProcessorFunc func([]byte) ([]byte, error)

ProcessorFunc contract for challenge pre/post processing

type SessionIDGeneratorFunc

type SessionIDGeneratorFunc func() string

SessionIDGeneratorFunc is the contract for Session ID generation implementation

Jump to

Keyboard shortcuts

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