tokens

package
v0.0.0-...-76c1feb Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlgodTokenFilename      = "algod.token"
	AlgodAdminTokenFilename = "algod.admin.token"
	KmdTokenFilename        = "kmd.token"
)

API tokens that live in the datadirs of their respective daemons

Variables

This section is empty.

Functions

func GenerateAPIToken

func GenerateAPIToken(dataDir, tokenFilename string) (string, error)

GenerateAPIToken writes a cryptographically secure APIToken to disk

func GetAndValidateAPIToken

func GetAndValidateAPIToken(dataDir, tokenFilename string) (string, error)

GetAndValidateAPIToken reads the APIToken from the token file and validates it. Always returns the potentially invalid token along with the error

func ValidateAPIToken

func ValidateAPIToken(apiToken string) error

ValidateAPIToken returns a non-nil error if the passed APIToken fails our validation checks

func ValidateOrGenerateAPIToken

func ValidateOrGenerateAPIToken(dataDir, tokenFilename string) (apiToken string, wroteToken bool, err error)

ValidateOrGenerateAPIToken generates an APIToken if it does not exist, and checks that any set token is valid

Types

This section is empty.

Jump to

Keyboard shortcuts

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