trust

package
v0.0.0-...-48663ca Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

This is a simple authentiaction scheme based on Hawk.

NOTE This does not provide encryption of requests! All requests are still visible in plain sight unless other precautions are taken.

Only the client is verified - not the server response!

Index

Constants

This section is empty.

Variables

View Source
var (
	// Maximum skew in times between servers
	MaxRequestSkew = time.Duration(GetEnvInt("MAX_REQUEST_SKEW", 4)) * time.Minute
	// Maximum authorization field size
	MaxAuthorizationSize = 10 << 10
)

Functions

func GetEnvInt

func GetEnvInt(key string, defaultValue int) int

func SerializeValues

func SerializeValues(values ...string) []byte

func Sign

func Sign(serialized, key []byte) []byte

Types

type Peer

type Peer struct {
	// key that will be used to authenticate
	Key []byte
}

Peer is trusted server information

func (Peer) Sign

func (peer Peer) Sign(id string) (string, error)

Sign signs the request from id.

func (Peer) Verify

func (peer Peer) Verify(auth string) (id string, err error)

Verify checks whether the request is trusted.

Jump to

Keyboard shortcuts

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