access

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: AGPL-3.0 Imports: 13 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OpTypeAccessCodeAuth = "auth"
)

Variables

View Source
var (
	MainZone = "alpha2"
)

Functions

func BootstrapStaticCodeHandler added in v0.3.0

func BootstrapStaticCodeHandler(zone string, scrambleAlg lhash.Algorithm) (
	h *SaticCodeHandler,
	accessCode *Code,
	scrambledCode *Code,
	verificationHash *lhash.LabeledHash,
	err error,
)

func Check

func Check(code *Code) (granted terminal.Permission, err error)

Check checks if the given code is valid.

func EnableTestMode added in v0.3.0

func EnableTestMode()

func Import

func Import(code *Code) error

Import imports a code into the given zone.

func RegisterZone

func RegisterZone(zone string, handler CodeHandler, grants terminal.Permission)

RegisterZone registers a handler with the given zone name.

Types

type AuthorizeOp added in v0.3.0

type AuthorizeOp struct {
	terminal.OpBaseRequest
}

func AuthorizeToTerminal added in v0.3.0

func AuthorizeToTerminal(t terminal.OpTerminal) (*AuthorizeOp, *terminal.Error)

func (*AuthorizeOp) Type added in v0.3.0

func (op *AuthorizeOp) Type() string

type Code

type Code struct {
	Zone string
	Data []byte
}

func Generate

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

Generate generates a new code for the given zone.

func GetCode added in v0.3.0

func GetCode(zoneID string) (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)
}

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

type Zone added in v0.3.0

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

func GetZone added in v0.3.0

func GetZone(zoneID string) (*Zone, error)

GetZone returns the zone data for the given zone ID.

Jump to

Keyboard shortcuts

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