anvil: zntr.io/anvil/forge Index | Files

package forge

import "zntr.io/anvil/forge"

Index

Package Files

options.go

Variables

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
)

type Option Uses

type Option func(*Options)

Option defines forge option contract option function

func WithDecryptor Uses

func WithDecryptor(decryptor ProcessorFunc) Option

WithDecryptor defines the challenge decryptor

func WithEncryptor Uses

func WithEncryptor(encryptor ProcessorFunc) Option

WithEncryptor defines the challenge encryptor

func WithExpiration Uses

func WithExpiration(expiration time.Duration) Option

WithExpiration defines the expiration interval

func WithRandomSessionID Uses

func WithRandomSessionID() Option

WithRandomSessionID defines the SessionId generation

func WithSessionIDGenerator Uses

func WithSessionIDGenerator(generator SessionIDGeneratorFunc) Option

WithSessionIDGenerator defines the SessionId generation function

type Options Uses

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

Options for challenge forging

type ProcessorFunc Uses

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

ProcessorFunc contract for challenge pre/post processing

type SessionIDGeneratorFunc Uses

type SessionIDGeneratorFunc func() string

SessionIDGeneratorFunc is the contract for Session ID generation implementation

Package forge imports 2 packages (graph) and is imported by 1 packages. Updated 2020-06-25. Refresh now. Tools for package owners.