challenger

package
v0.1.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ChallengeExpirationDelta = 5 * time.Minute

Variables

View Source
var (
	ErrChallengeWasNotRequested = errors.New("challenge was not requested")
	ErrChallengeExpired         = errors.New("challenge expired")
	ErrDecodeHex                = errors.New("failed to decode hex string")
	ErrBadLength                = errors.New("bad signature length")
	ErrBadRecoverByte           = errors.New("bad recovery byte")
	ErrMissMatched              = errors.New("recovered address didn't match any of the given ones")
)
View Source
var AddressRegexp = regexp.MustCompile("^0x[0-9a-fA-F]{40}$")
View Source
var SHA256HexRegexp = regexp.MustCompile("^0x[0-9a-fA-F]{64}$")
View Source
var SignatureRegexp = regexp.MustCompile("^0x[0-9a-fA-F]{130}$")

Functions

func ChallengeToHash

func ChallengeToHash(challenge string) []byte

func DecodeSignature

func DecodeSignature(signature string) ([]byte, error)

Types

type AuthVerifier

type AuthVerifier struct {
	Disabled bool
	// contains filtered or unexported fields
}

func (*AuthVerifier) Challenge

func (v *AuthVerifier) Challenge(user string) (string, error)

func (*AuthVerifier) VerifySignature

func (v *AuthVerifier) VerifySignature(signature string, address string) error

type AuthVerifierer

type AuthVerifierer interface {
	AuthVerifier() *AuthVerifier
}

func NewAuthVerifierer

func NewAuthVerifierer(getter kv.Getter) AuthVerifierer

type Challenge

type Challenge struct {
	Value string
	Exp   time.Time
}

Jump to

Keyboard shortcuts

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