hashedsecret

package
v0.0.0-...-b5a46b0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: MIT Imports: 7 Imported by: 0

README

hashedsecret: a library for hashing a timestamp, a hostname, and a shared secret as a simple authorization check

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAcceptPast   = 1 * time.Minute
	DefaultAcceptFuture = 1 * time.Minute
)

Functions

This section is empty.

Types

type Generator

type Generator struct {
	SharedSecret        string
	TargetCanonicalHost string
}

func (*Generator) Generate

func (g *Generator) Generate(now time.Time) (string, error)

func (*Generator) IsSafeForUntrustedTarget

func (g *Generator) IsSafeForUntrustedTarget() bool

func (*Generator) Username

func (g *Generator) Username() string

type VerificationError

type VerificationError struct {
	UnderlyingError error
}

func (VerificationError) Error

func (e VerificationError) Error() string

func (VerificationError) HttpCode

func (e VerificationError) HttpCode() int

type Verifier

type Verifier struct {
	SharedSecret  string
	CanonicalHost string
	AcceptPast    time.Duration
	AcceptFuture  time.Duration
}

func (*Verifier) Verify

func (v *Verifier) Verify(ignoredUsername string, now time.Time, token string) (bool, error)

Jump to

Keyboard shortcuts

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