keychain

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccessKey

func CreateAccessKey() (id, secret string, hash []byte, err error)

func HashSecret

func HashSecret(secret string) ([]byte, error)

Types

type Keychain

type Keychain struct {
	Name string
	// contains filtered or unexported fields
}

Keychain represents a collection of access keys that are allowed to use the API

func LoadKeychain

func LoadKeychain(name string) (*Keychain, error)

func (*Keychain) Add

func (kc *Keychain) Add(id string, hash []byte)

func (*Keychain) Allow

func (kc *Keychain) Allow(r *http.Request) bool

func (*Keychain) Guard

func (kc *Keychain) Guard(w http.ResponseWriter, r *http.Request) bool

func (*Keychain) IDs

func (kc *Keychain) IDs() []string

func (*Keychain) Len

func (kc *Keychain) Len() int

func (*Keychain) Remove

func (kc *Keychain) Remove(id string) bool

func (*Keychain) Save

func (kc *Keychain) Save() error

Jump to

Keyboard shortcuts

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