access

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(code *Code) error

Check checks if the given code is valid.

func Import

func Import(code *Code) error

Import imports a code into the given zone.

func RegisterZone

func RegisterZone(zone string, handler CodeHandler)

RegisterZone registers a handler with the given zone name.

func TestMode

func TestMode()

TestMode activates test mode and only uses a fixed testing access code.

Types

type Code

type Code struct {
	Zone string
	Data []byte
}

func Generate

func Generate(zone string) (*Code, error)

Generate generates a new code for the given zone.

func Get

func Get() (code *Code, err error)

func ParseCode

func ParseCode(code string) (*Code, error)

func ParseRawCode

func ParseRawCode(code []byte) (*Code, error)

func (*Code) Raw

func (c *Code) Raw() []byte

func (*Code) String

func (c *Code) String() string

type CodeHandler

type CodeHandler interface {
	Generate() (*Code, error)
	Check(code *Code) error
	Import(code *Code) error
	Get() (*Code, error)
}

func GetZoneHandler

func GetZoneHandler(zone string) (CodeHandler, error)

GetZoneHandler returns the handler for the given zone.

type SaticCodeHandler

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

func NewSaticCodeHandler

func NewSaticCodeHandler(verificationHash string, scrambleAlg lhash.Algorithm) (*SaticCodeHandler, error)

func (*SaticCodeHandler) Check

func (h *SaticCodeHandler) Check(code *Code) error

func (*SaticCodeHandler) Generate

func (h *SaticCodeHandler) Generate() (*Code, error)

func (*SaticCodeHandler) Get

func (h *SaticCodeHandler) Get() (*Code, error)

func (*SaticCodeHandler) Import

func (h *SaticCodeHandler) Import(code *Code) error

Jump to

Keyboard shortcuts

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